:root {
    color-scheme: dark;
    --bg: #0b1220;
    --side: #0f172a;
    --card: #141d33;
    --line: #25314d;
    --text: #e6ebf5;
    --muted: #929db7;
    --accent: #3b6cf6;
    --green: #22c55e;
    --yellow: #eab308;
    --red: #f43f5e;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: #9ab2ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.sidebar { position: sticky; top: 0; display: flex; flex: 0 0 250px; flex-direction: column; width: 250px; height: 100vh; padding: 22px 12px; background: var(--side); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b, .brand small { display: block; }
.brand b { letter-spacing: .06em; }
.brand small, .muted, .topbar p { color: var(--muted); }
.logo { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #4f7bff, #2a54d6); font-size: 20px; }
.nav-label { padding: 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.sidebar nav { flex: 1; overflow: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; margin-bottom: 3px; padding: 10px 12px; border-left: 3px solid transparent; border-radius: 9px; color: var(--muted); }
.sidebar nav a:hover, .sidebar nav a.active { background: #202e4c; color: var(--text); text-decoration: none; }
.sidebar nav a.active { border-left-color: var(--accent); font-weight: 600; }
.sidebar nav i { width: 18px; font-style: normal; text-align: center; }
.sidebar-foot { padding: 14px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--green); }
.main { flex: 1; min-width: 0; padding: 28px 32px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 2px 0 0; }
.top-action { margin-left: auto; }
.menu-button { display: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.card { margin-bottom: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.card h2 { margin: 0 0 14px; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats .card { display: grid; gap: 5px; }
.stats span { color: var(--muted); }
.stats strong { font-size: 28px; }
.green-text { color: var(--green); }
.yellow-text { color: var(--yellow); }
.section-heading { display: flex; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin-bottom: 2px; }
.section-heading p { margin: 0 0 14px; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 14px; border: 0; border-radius: 9px; background: var(--accent); color: white; font: inherit; font-weight: 600; cursor: pointer; }
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button.secondary { border: 1px solid var(--line); background: transparent; color: var(--text); }
.button.danger { border: 1px solid #f43f5e66; background: #f43f5e1a; color: #fb7185; }
.button.small { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 10px; }
.export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
input, select { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--bg); color: var(--text); font: inherit; }
input:focus, select:focus { border-color: var(--accent); }
.toolbar input { width: min(100%, 360px); }
.form-card { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.form-grid.compact { max-width: 700px; }
.form-actions, .check-list { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; grid-column: 1 / -1; }
.check-list { gap: 18px; }
.check-list label, .inline-check { display: flex !important; align-items: center; gap: 8px !important; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions form { margin: 0; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.green { background: #22c55e22; color: var(--green); }
.badge.red { background: #f43f5e22; color: var(--red); }
.badge.muted-badge { background: #26334e; color: var(--muted); }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.notice { margin-bottom: 16px; padding: 12px 15px; border: 1px solid #22c55e55; border-radius: 9px; background: #22c55e18; }
.notice.error { border-color: #f43f5e66; background: #f43f5e18; }
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 440px); padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 24px 70px #0002; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; letter-spacing: .06em; }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card > p { margin: 6px 0 20px; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.admin-session { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.admin-session form { margin: 0; }
.grid-two { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-two .card { margin-bottom: 0; }

@media (prefers-color-scheme: light) {
    :root { color-scheme: light; --bg: #f1f4fa; --side: #fff; --card: #fff; --line: #e2e8f3; --text: #0f172a; --muted: #64718d; }
    .sidebar nav a:hover, .sidebar nav a.active { background: #e4ebfd; }
    .badge.muted-badge { background: #eef1f7; }
}
@media (max-width: 1000px) {
    .sidebar { flex-basis: 220px; width: 220px; }
    .main { padding: 22px 20px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    body { display: block; }
    .sidebar { position: fixed; z-index: 20; top: 0; bottom: 0; left: -280px; width: 270px; max-width: 82vw; height: 100dvh; transition: left .2s ease; }
    .sidebar.open { left: 0; box-shadow: 0 0 40px #0009; }
    .backdrop { position: fixed; z-index: 15; inset: 0; display: none; background: #0009; }
    .sidebar.open ~ .backdrop { display: block; }
    .main { padding: 0 14px 28px; }
    .topbar { position: sticky; z-index: 10; top: 0; margin: 0 -14px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
    .topbar h1 { font-size: 19px; }
    .topbar p { font-size: 12px; }
    .menu-button { display: block; min-width: 42px; min-height: 42px; }
    .top-action { display: none; }
    .card { padding: 15px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions, .check-list { grid-column: auto; }
    .table-wrap { overflow: visible; }
    table, thead, tbody, tr, td { display: block; width: 100%; }
    thead { display: none; }
    table tr { margin-bottom: 12px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
    table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
    table td::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
    table td.empty { display: block; text-align: center; }
    table td.empty::before { display: none; }
    .actions { justify-content: flex-end; }
    .toolbar input { width: 100%; }
}
@media (max-width: 380px) {
    .stats { grid-template-columns: 1fr; }
}
