:root {
    color-scheme: light;
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1a1f36;
    --muted: #5f6b7a;
    --primary: #e63946;
    --primary-dark: #c1121f;
    --accent: #2a9d8f;
    --warning: #ffb703;
    --success: #3a86ff;
    --border: #e2e6f0;
    --shadow: 0 20px 40px rgba(26, 31, 54, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: #0b132b;
    color: #fff;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand__badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #f77f00);
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav__item {
    border: none;
    background: transparent;
    color: #d7e1ff;
    font-size: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav__item:hover,
.nav__item.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar__footer {
    margin-top: auto;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
}

.btn--logout {
    width: 100%;
    padding: 10px 18px;
    text-align: center;
}

.content {
    flex: 1;
    padding: 32px 40px 48px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 20px;
}

.topbar h2 {
    margin: 0;
    font-size: 28px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar__actions {
    display: flex;
    gap: 12px;
}

.btn {
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.btn--ghost {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn--tiny {
    padding: 6px 12px;
    font-size: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card.highlight {
    background: linear-gradient(135deg, #fff, #ffe5e5);
    border: 1px solid #ffd6d6;
}

.metric {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 4px;
}

.section {
    margin-top: 36px;
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.section__header h3 {
    margin: 0 0 6px;
    font-size: 20px;
}

.section__header p {
    margin: 0;
    color: var(--muted);
}

.table {
    display: grid;
    gap: 12px;
}

.table__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.table__row--head {
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f0f3ff;
    color: #2b3a67;
    font-size: 12px;
}

.pill--info {
    background: #e0fbfc;
    color: #05668d;
}

.pill--warning {
    background: #fff4d6;
    color: #b76e00;
}

.pill--success {
    background: #e5f6ff;
    color: #006d77;
}

.tasks {
    display: grid;
    gap: 16px;
}

.task {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
}

.task ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.permissions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.muted {
    color: var(--muted);
}

@media (max-width: 960px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .sidebar__footer {
        width: 100%;
    }

    .content {
        padding: 24px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Admin settings (Material 3 inspired) */
#section-settings {
    padding: 0;
    background: linear-gradient(135deg, rgba(232, 240, 254, 0.7), rgba(255, 248, 240, 0.7));
    border: 1px solid #e5eaf5;
}

.admin-shell {
    padding: 28px;
    display: grid;
    gap: 24px;
}

.admin-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    background: #ffffff;
    border-radius: 22px;
    padding: 20px 22px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.admin-hero h3 {
    margin: 6px 0 4px;
    font-size: 22px;
}

.admin-eyebrow {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #2158d8;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-tabs {
    display: inline-flex;
    padding: 6px;
    border-radius: 999px;
    background: #f5f6fb;
    border: 1px solid #e6e9f4;
    gap: 6px;
    width: fit-content;
}

.admin-tab {
    border: none;
    background: transparent;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    color: #49546a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-tab.is-active {
    background: #1f2a44;
    color: #fff;
    box-shadow: 0 6px 14px rgba(31, 42, 68, 0.25);
}

.admin-panel {
    display: none;
    animation: admin-fade 0.3s ease;
}

.admin-panel.is-active {
    display: block;
}

@keyframes admin-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 20px;
}

.admin-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    border: 1px solid #eef1f7;
}

.admin-card h4 {
    margin: 0 0 16px;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.admin-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #5f6b7a;
}

.admin-field input,
.admin-field select {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e6f0;
    background: #f8f9fd;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-field input:focus,
.admin-field select:focus {
    outline: none;
    border-color: #8aa4ff;
    box-shadow: 0 0 0 3px rgba(138, 164, 255, 0.2);
    background: #fff;
}

.admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.admin-list__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-search input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e6f0;
    background: #f8f9fd;
    min-width: 220px;
}

.admin-list__body {
    display: grid;
    gap: 12px;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid #eef1f7;
    background: #fff;
}

.admin-row__actions {
    display: inline-flex;
    gap: 8px;
}

.admin-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #2158d8;
    font-size: 12px;
    font-weight: 600;
}

.admin-chip--ghost {
    background: #f0f3ff;
    color: #4c5aa8;
}

.admin-chip--status {
    background: #e9f7f1;
    color: #1b7f5a;
}

.admin-permissions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 8px;
    max-height: 320px;
    overflow: auto;
    padding-right: 6px;
}

.admin-permission {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8f9fd;
    border: 1px solid #edf0f6;
    font-size: 13px;
}

@media (max-width: 1200px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-list__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
}

/* Module sections (Inventory, Orders, Personal, Tasks) */
.dashboard-grid .metric-card {
    min-height: 140px;
}

.module-section {
    background: linear-gradient(135deg, rgba(244, 247, 255, 0.8), rgba(255, 250, 244, 0.8));
    border: 1px solid #e8ebf5;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.module-grid {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 20px;
}

.module-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 20px;
    border: 1px solid #eef1f7;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.module-card h4 {
    margin: 0 0 16px;
}

.module-form {
    display: grid;
    gap: 12px;
}

.module-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #5f6b7a;
}

.module-field input,
.module-field select,
.module-field textarea {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e6f0;
    background: #f8f9fd;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.module-field input:focus,
.module-field select:focus,
.module-field textarea:focus {
    outline: none;
    border-color: #8aa4ff;
    box-shadow: 0 0 0 3px rgba(138, 164, 255, 0.2);
    background: #fff;
}

.module-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.module-list__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.module-search input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e6f0;
    background: #f8f9fd;
    min-width: 220px;
}

.module-list__body {
    display: grid;
    gap: 12px;
}

.module-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid #edf0f6;
    background: #fff;
}

.module-row--stack {
    grid-template-columns: 1fr;
    gap: 10px;
}

.module-row__actions {
    display: inline-flex;
    gap: 8px;
}

.module-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.module-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #2158d8;
    font-size: 12px;
    font-weight: 600;
}

.module-chip--status {
    background: #e9f7f1;
    color: #1b7f5a;
}

.module-subtasks {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #5f6b7a;
}

.module-tabs {
    display: inline-flex;
    padding: 6px;
    border-radius: 999px;
    background: #f5f6fb;
    border: 1px solid #e6e9f4;
    gap: 6px;
    width: fit-content;
    margin-bottom: 16px;
}

.module-tab {
    border: none;
    background: transparent;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    color: #49546a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.module-tab.is-active {
    background: #1f2a44;
    color: #fff;
    box-shadow: 0 6px 14px rgba(31, 42, 68, 0.25);
}

.module-panel {
    display: none;
    animation: admin-fade 0.3s ease;
}

.module-panel.is-active {
    display: block;
}

@media (max-width: 1200px) {
    .module-grid {
        grid-template-columns: 1fr;
    }

    .module-list__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
}
