:root {
    --primary-color: #1a73e8;
    --sidebar-bg: #f8f9fa;
    --border-color: #dadce0;
    --text-color: #202124;
    --header-height: 64px;
    --sidebar-width: 256px;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Login */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background: #f1f3f4;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    width: 300px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #5f6368;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

button:hover {
    box-shadow: 0 1px 2px rgba(60,64,67,0.3);
}

/* Layout */
#main-layout {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    color: #5f6368;
}

.brand .material-icons {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 48px;
    color: #5f6368;
    text-decoration: none;
    border-radius: 0 24px 24px 0;
    margin-right: 0.5rem;
}

.nav-item:hover {
    background: rgba(0,0,0,0.04);
}

.nav-item.active {
    background: #e8f0fe;
    color: var(--primary-color);
}

.nav-item .material-icons {
    margin-right: 1rem;
    font-size: 20px;
}

.content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

/* Page Content */
h1 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.data-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
}

.search-box input {
    padding: 6px;
    border: 1px solid #dadce0;
    border-radius: 4px;
}

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 500;
    color: #5f6368;
    border-bottom: 1px solid #dadce0;
}

th.sortable {
    cursor: pointer;
}
th.sortable:hover {
    background-color: #f1f3f4;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.pagination-controls button {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.pagination-controls button:disabled {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: default;
    box-shadow: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #5f6368;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    background: white;
    color: #5f6368;
    border: 1px solid #dadce0;
}

.btn-secondary:hover {
    background: #f1f3f4;
    box-shadow: none;
}

/* Dashboard */
.card {
    background: white;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 1.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.kpi {
    text-align: center;
}
.kpi h3 {
    margin: 0 0 0.5rem 0;
    color: #5f6368;
    font-size: 1rem;
}
.kpi .value {
    font-size: 2rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* Chips */
.multi-select-container {
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 5px;
}
.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
}
.chip {
    background: #e8f0fe;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chip.success {
    background: #e6f4ea;
    color: #1e8e3e;
}
.chip.error {
    background: #fce8e6;
    color: #d93025;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: #f1f3f4;
    color: #5f6368;
    border: 1px solid #dadce0;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-overlay.modal-fade-out {
    animation: modalFadeOut 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.modal-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 500px;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-color);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #5f6368;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-footer .btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.modal-footer .btn-primary {
    background: var(--primary-color);
    color: white;
}

.modal-footer .btn-primary:hover {
    background: #1557b0;
}

.modal-footer .btn-secondary {
    background: #f1f3f4;
    color: #5f6368;
}

.modal-footer .btn-secondary:hover {
    background: #e8eaed;
}

.modal-footer .btn-danger {
    background: #d93025;
    color: white;
}

.modal-footer .btn-danger:hover {
    background: #b31412;
}
