:root {
    color-scheme: light;
    --bg: #f3f6fa;
    --panel: #ffffff;
    --text: #111827;
    --muted: #64748b;
    --line: #dbe3ef;
    --soft: #f8fafc;
    --brand: #0f766e;
    --brand-strong: #0b5f59;
    --ink: #0f172a;
    --danger: #b42318;
    --ok: #067647;
    --warning: #b54708;
}

* { box-sizing: border-box; }

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

a { color: var(--brand); font-weight: 700; text-decoration: none; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent 34%),
        linear-gradient(315deg, rgba(220, 38, 38, 0.12), transparent 30%),
        var(--bg);
}

.login-card {
    width: min(430px, 100%);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

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

.topbar {
    height: 76px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(14px);
}

.topbar h1 { margin: 0; font-size: 21px; letter-spacing: 0; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-pill {
    display: grid;
    gap: 2px;
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
}
.user-pill strong { font-size: 13px; }
.user-pill span { color: var(--muted); font-size: 12px; }

.sidebar {
    background: #101826;
    color: #e2e8f0;
    padding: 22px 16px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #ffffff;
    color: #101826;
    font-weight: 900;
    margin: 0 0 20px 8px;
}

.sidebar-title {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    margin: 20px 12px 8px;
    text-transform: uppercase;
}

.sidebar a {
    display: block;
    color: #cbd5e1;
    padding: 11px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
}
.sidebar a.active, .sidebar a:hover { background: #223047; color: #fff; }

.content {
    padding: 26px;
    min-width: 0;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.page-title h2 { margin: 0; font-size: 24px; letter-spacing: 0; }
.page-title p { margin: 5px 0 0; color: var(--muted); }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

h2, h3 { letter-spacing: 0; }
h3 { margin: 0 0 14px; font-size: 16px; }

label {
    display: block;
    margin: 12px 0 6px;
    color: #334155;
    font-weight: 800;
    font-size: 13px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}
textarea { min-height: 110px; resize: vertical; }

.button, button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.button:hover, button:hover { background: var(--brand-strong); }
.button-secondary { background: #334155; }
.button-danger { background: var(--danger); }
.button-ghost { background: #eef2f7; color: #172033; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.message {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 800;
}
.success { background: #dcfae6; color: var(--ok); }
.error { background: #fee4e2; color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }

.checkboxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 14px; margin-top: 8px; }
.checkboxes label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.checkboxes input, .inline-check input { width: auto; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.filters { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 12px 10px; font-size: 13px; vertical-align: middle; }
th { color: #475569; font-size: 12px; text-transform: uppercase; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef2f7;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}
.badge-ok { background: #dcfae6; color: var(--ok); }
.badge-warn { background: #fef0c7; color: var(--warning); }

@media (max-width: 980px) {
    .app-shell, .grid, .stats, .filters { display: block; }
    .sidebar { padding: 12px; }
    .sidebar a { display: inline-block; margin-right: 4px; }
    .content { padding: 16px; }
    .panel, .stat { margin-bottom: 16px; }
    .span-12, .span-8, .span-6, .span-4, .span-3 { grid-column: auto; }
    .checkboxes { grid-template-columns: 1fr; }
    .topbar { height: auto; align-items: flex-start; flex-direction: column; padding: 16px; }
}
