:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --text: #15171c; --muted: #5b6370;
  --border: #dde1e7; --accent: #2f5bea; --accent-text: #ffffff; --accent-soft: #e8eeff;
  --ok: #067647; --ok-soft: #e3f6ec; --warn: #a15c07; --warn-soft: #fdf1dc; --err: #b42318; --err-soft: #fdecea;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014; --surface: #171a20; --surface-2: #1f232b; --text: #eceef2; --muted: #9aa2ad;
    --border: #2a2f38; --accent: #7b96ff; --accent-text: #0e1014; --accent-soft: #1e2640;
    --ok: #6ce9a6; --ok-soft: #12291e; --warn: #fdb022; --warn-soft: #2e2410; --err: #ff8a80; --err-soft: #331816;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.code-area { min-height: 340px; font-size: 12.5px; line-height: 1.5; }
.nowrap { white-space: nowrap; word-break: normal; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 700; font-size: 16px; padding: 4px 10px 14px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.tenant { font-size: 12px; color: var(--muted); padding: 0 10px 12px; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .spacer { flex: 1; }
.content { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.two { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--muted); }

/* forms */
form.inline { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 64px; resize: vertical; }
input[type="checkbox"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.danger { background: var(--surface); color: var(--err); border-color: var(--border); }
button.small { padding: 4px 9px; font-size: 12.5px; font-weight: 500; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* badges & callouts */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.callout { border: 1px solid var(--border); border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 12px 14px; border-radius: 8px; margin: 12px 0; }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.kv { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px 12px; align-items: center; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.check.done { background: var(--ok); border-color: var(--ok); }

/* sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 420px; padding: 28px; }
.err-text { color: var(--err); min-height: 20px; margin-top: 8px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: calc(100% - 32px); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .side .spacer { display: none; }
  .content { padding: 20px 16px 40px; }
  .two { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr auto; }
  .kv .k { grid-column: 1 / -1; }
}
