:root {
  --bg: #f4f6f7; --panel: #ffffff; --ink: #1c2b2d; --muted: #6b7a7c; --line: #e3e8e9;
  --brand: #0f3d3e; --brand-2: #14595a; --accent: #d9902f; --accent-ink: #5a3a07;
  --ok: #1e7f4f; --ok-bg: #e4f4eb; --warn: #9a6200; --warn-bg: #fdf1d9; --bad: #b3261e; --bad-bg: #fbe7e5; --info: #1f5fa8; --info-bg: #e5eefa;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,61,62,.06), 0 4px 14px rgba(15,61,62,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1617; --panel: #162224; --ink: #e6efef; --muted: #8fa3a5; --line: #263638; --brand: #0b2c2d; --brand-2: #1a6f70;
    --ok-bg: #12301f; --warn-bg: #3a2c0b; --bad-bg: #3b1a17; --info-bg: #14283f; --shadow: none; --accent-ink: #f1c27a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; display: flex; flex-direction: column; margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; } h3 { font-size: .95rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Layout */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); flex: 1; }
/* Mobile-only helpers are hidden everywhere by default; the mobile media query turns them on. Without this the
   empty overlay <label> became a visible grid item on desktop and stole the first column. */
.menu-toggle, .menu-btn, .scrim { display: none; }
.side { grid-column: 1; grid-row: 1; background: var(--brand); color: #cfe3e3; contain: size; overflow: clip; }
/* The column stretches with the page; only the inner panel is sticky and scrolls on its own. */
.side-inner { position: sticky; top: 0; max-height: min(100vh, 100%); overflow-y: auto; padding: 18px 12px; }
.brand { display: block; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 10px 16px; letter-spacing: .2px; }
.brand small { display: block; font-weight: 400; color: #8fb5b5; font-size: .75rem; }
.nav a { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: #cfe3e3; padding: 9px 12px; border-radius: 9px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nav .sec { color: #7fa6a6; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 4px; }
.pill { background: var(--accent); color: #2a1a02; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 1px 8px; }
.main { grid-column: 2; grid-row: 1; min-width: 0; padding: 26px clamp(14px, 3vw, 36px) 60px; max-width: 1200px; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.env-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); padding: 6px 14px; font-size: .82rem; text-align: center; }

/* Cards & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: block; color: inherit; }
.stat:hover { text-decoration: none; border-color: var(--brand-2); }
.stat .n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--muted); font-size: .82rem; }
.stat.bad .n { color: var(--bad); } .stat.warn .n { color: var(--warn); } .stat.ok .n { color: var(--ok); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; } tbody tr:hover { background: color-mix(in srgb, var(--brand-2) 5%, transparent); }

/* Forms */
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 40%, transparent); border-color: var(--brand-2); }
input[type=checkbox] { width: auto; margin-right: 6px; }
.field { margin-bottom: 12px; } .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.err { color: var(--bad); font-size: .85rem; margin-top: 3px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: var(--brand-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; } .btn.primary:hover { background: var(--brand); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
button[disabled] { opacity: .5; cursor: not-allowed; }

/* Badges & alerts */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }
.note { background: var(--info-bg); color: var(--info); border-radius: 10px; padding: 10px 14px; font-size: .88rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: .85rem; }
.tabs a.on { background: var(--brand-2); color: #fff; border-color: var(--brand-2); text-decoration: none; }
.issues { margin: 6px 0 0; padding-left: 18px; font-size: .84rem; } .issues li.review { color: var(--bad); } .issues li.info { color: var(--muted); }
details > summary { cursor: pointer; font-weight: 600; }
.pager nav { margin-top: 14px; } .pager svg { width: 18px; height: 18px; }
.pager nav > div:first-child { display: none; } .pager nav a, .pager nav span[aria-current] > span { padding: 5px 10px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand), var(--brand-2)); }
.auth .card { width: 100%; max-width: 400px; margin: 0; }

/* Mobile: single column; the menu is an off-canvas drawer that is fully hidden (not focusable, covers nothing) when closed. */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: flex; grid-column: 1; grid-row: 1; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; background: var(--brand); color: #fff; padding: 10px 14px; font-weight: 700; }
  .menu-btn label { color: #fff; margin: 0; font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 2px 6px; }
  .main { grid-column: 1; grid-row: 2; max-width: none; }
  .side-inner { position: static; max-height: none; height: 100%; }
  .side { contain: none; overflow: visible; position: fixed; inset: 0 auto 0 0; width: min(280px, 82vw); height: 100%; z-index: 30; grid-column: auto; grid-row: auto;
          transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .menu-toggle:checked ~ .side { transform: none; visibility: visible; transition: transform .2s ease; }
  .menu-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
  .g3, .g4 { grid-template-columns: 1fr 1fr; } .g2, .form-grid { grid-template-columns: 1fr 1fr; } .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; } .main { padding-top: 16px; } th, td { padding: 8px 7px; } }@media print { .side, .menu-btn, .actions, .env-banner { display: none !important; } .shell { display: block; } .card { box-shadow: none; } }
