/* Same palette and type as adose_home/public/index.html (the public site), so this operations
   tool reads as part of the same product rather than a bolted-on generic admin panel. Dense and
   information-forward rather than marketing-spacious: tighter paddings, small type scale, real
   tables — this is a tool an operator uses many times a day. */
:root {
  --bg: #f6fbfb;
  --surface: #ffffff;
  --surface-2: #eef7f6;
  --ink: #134e4a;
  --text: #1e293b;
  --muted: #475569;
  --line: #d6ebe8;
  --accent: #0e7490;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --warn: #92600a;
  --warn-bg: #fdf3d9;
  --ok: #166534;
  --ok-bg: #e6f4ea;
  --display: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-xs: 12.5px; --t-sm: 13.5px; --t-base: 15px; --t-md: 17px; --t-lg: 21px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1517; --surface: #102124; --surface-2: #142a2d; --ink: #e3f4f1; --text: #d9e4e8;
    --muted: #9db2b7; --line: #1f363a; --accent: #5fd4e8;
    --danger: #ff8a80; --danger-bg: #3a1616; --warn: #f2c14e; --warn-bg: #3a2f0f; --ok: #7bdb9d; --ok-bg: #113321;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1517; --surface: #102124; --surface-2: #142a2d; --ink: #e3f4f1; --text: #d9e4e8;
  --muted: #9db2b7; --line: #1f363a; --accent: #5fd4e8;
  --danger: #ff8a80; --danger-bg: #3a1616; --warn: #f2c14e; --warn-bg: #3a2f0f; --ok: #7bdb9d; --ok-bg: #113321;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-base)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
h1, h2, h3 { font-family: var(--display); color: var(--ink); letter-spacing: -0.01em; margin: 0; }
code { font: 400 0.92em ui-monospace, "SF Mono", Menlo, monospace; }

.shell { max-width: 1180px; margin: 0 auto; padding-inline: 18px; }

.topbar { display: flex; align-items: center; gap: 18px; padding-block: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand svg { width: 20px; height: 20px; }
.brand svg path { fill: var(--accent); }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs a { color: var(--muted); text-decoration: none; font-size: var(--t-sm); font-weight: 500; padding: 7px 11px; border-radius: 8px; }
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a.active { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.whoami { color: var(--muted); font-size: var(--t-xs); }
.theme { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--muted); }
.theme svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .i-sun { display: none; }
.is-dark .theme .i-sun { display: block; }
.is-dark .theme .i-moon { display: none; }

.page { padding-block: 22px 60px; }
.view-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.view-header h1 { font-size: var(--t-lg); }
.view-header .hint { color: var(--muted); font-size: var(--t-sm); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid-cols { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ink); }
.stat .label { color: var(--muted); font-size: var(--t-xs); }
.stat .n.muted { color: var(--muted); font-size: var(--t-sm); font-weight: 500; }

table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.table-wrap table { min-width: 560px; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 16px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: var(--t-xs); color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
textarea { resize: vertical; min-height: 60px; }
.field-wide { flex: 1; min-width: 200px; }

button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04262b; font-weight: 600; }
button.primary:hover { filter: brightness(0.95); }
button.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); font-weight: 600; }
button.danger:hover { filter: brightness(0.95); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.section-title { font-size: var(--t-md); font-weight: 600; color: var(--ink); margin: 0 0 10px; font-family: var(--display); }
.muted { color: var(--muted); }
.small { font-size: var(--t-xs); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; }

.notice { border-radius: 10px; padding: 10px 14px; font-size: var(--t-sm); margin-bottom: 14px; }
.notice-error { background: var(--danger-bg); color: var(--danger); }
.notice-ok { background: var(--ok-bg); color: var(--ok); }

.dialog-backdrop { position: fixed; inset: 0; background: rgba(5, 15, 16, 0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.dialog { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); max-width: 480px; width: 100%; padding: 20px; }
.dialog h2 { font-size: var(--t-md); margin-bottom: 8px; }
.dialog p { color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.dialog .btn-row { margin-top: 16px; justify-content: flex-end; }
.dialog input { width: 100%; margin-top: 8px; }

.breadcrumb { font-size: var(--t-sm); color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .topbar { gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .table-wrap table { min-width: 0; }
  th, td { padding: 8px 8px; }
  .dialog { padding: 16px; }
}
