* {
    box-sizing: border-box;
}

:root {
    --ink: #17212b;
    --muted: #647381;
    --line: #dbe5ea;
    --page: #f5f8fa;
    --panel: #ffffff;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --blue: #2563eb;
    --danger: #b42318;
    --shadow: 0 16px 42px rgba(24, 45, 63, .09);
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, #e9f5f4 0, var(--page) 280px),
        var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}

a {
    color: var(--teal-dark);
    font-weight: 700;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 22px;
    color: #eafdfb;
    background:
        linear-gradient(180deg, rgba(11, 95, 88, .96), rgba(17, 94, 89, .98)),
        #115e59;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sidebar h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.12;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--teal);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .08em;
    font-weight: 800;
}

.sidebar .eyebrow {
    color: rgba(234, 253, 251, .72);
}

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

.sidebar .muted,
.sidebar a,
.sidebar span {
    color: rgba(234, 253, 251, .82);
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 13px;
    border-radius: 8px;
    color: #f4fffd;
    text-decoration: none;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .08);
}

.nav a:hover {
    background: rgba(255, 255, 255, .14);
}

.user-card {
    margin-top: auto;
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .12);
    display: grid;
    gap: 3px;
}

.main {
    width: 100%;
    max-width: 1320px;
    padding: 30px;
    display: grid;
    gap: 22px;
}

.page-header,
.section-title,
.module-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-header h2,
.card h3,
.auth-card h2 {
    margin: 0;
    font-size: clamp(22px, 3vw, 34px);
    letter-spacing: 0;
}

.card,
.hero-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.hero-panel {
    min-height: 420px;
    display: grid;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(15, 118, 110, .94), rgba(37, 99, 235, .58)),
        url("https://images.unsplash.com/photo-1576091160550-2173dba999ef?auto=format&fit=crop&w=1600&q=80") center/cover;
    color: #fff;
}

.hero-panel .muted,
.hero-panel p {
    color: rgba(255, 255, 255, .9);
}

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

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-grid {
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.stat-card {
    border-top: 4px solid var(--teal);
}

.stat-card span {
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1;
}

.narrow {
    max-width: 620px;
}

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

label {
    display: grid;
    gap: 7px;
    font-size: 14px;
}

label span {
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #c9d8df;
    border-radius: 8px;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(15, 118, 110, .16);
    border-color: var(--teal);
}

textarea {
    min-height: 104px;
    resize: vertical;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--teal);
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.button:hover {
    background: var(--teal-dark);
}

.button.secondary {
    background: #334155;
}

.button.danger {
    background: var(--danger);
}

.hero-actions,
.module-toolbar,
.form-actions,
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    justify-content: flex-end;
    padding: 12px 0 2px;
    background: linear-gradient(180deg, rgba(245, 248, 250, 0), var(--page) 42%);
}

.form-heading {
    grid-column: 1 / -1;
    padding: 11px 13px;
    color: #0f3d3a;
    background: #e8f7f5;
    border: 1px solid #bde8e2;
    border-left: 5px solid var(--teal);
    border-radius: 8px;
    font-weight: 900;
}

.section-nav,
.export-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.section-nav a,
.export-link,
.chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 8px;
    color: #0f4f4a;
    background: #e7f5f3;
    border: 1px solid #c5e6e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}

.module-card {
    scroll-margin-top: 18px;
}

.module-body {
    margin-top: 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 11px;
    border-bottom: 1px solid #e5edf1;
    text-align: left;
    vertical-align: top;
}

th {
    color: #435260;
    background: #f3f7f9;
    font-size: 13px;
}

.flash {
    padding: 13px 15px;
    border-radius: 8px;
    font-weight: 700;
}

.flash-success {
    color: #065f46;
    background: #dff7ed;
}

.flash-error {
    color: #8a1f17;
    background: #fde4e1;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #edf3f6;
}

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

    .sidebar {
        position: static;
        height: auto;
        padding: 20px 16px;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 16px;
    }

    .page-header,
    .section-title,
    .module-head {
        display: grid;
    }

    .two-up,
    .dashboard-stats,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .card,
    .hero-panel {
        padding: 16px;
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .form-actions .button {
        width: 100%;
    }
}

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

    .hero-actions,
    .module-toolbar {
        display: grid;
    }

    .button {
        width: 100%;
    }

    .section-nav a,
    .export-link {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 720px;
    }
}
