/* Maskroom design system — a light "compliance console" aesthetic shared by
   the file studio (/), staging (/staging) and admin audit (/admin) pages.
   Loaded as /static/theme.css. The extension mirrors these tokens inline.

   Language: cool slate canvas, an enterprise-blue primary/accent, tinted
   semantic badges, 1px borders, soft shadows,
   Public Sans (UI) + IBM Plex Mono (data). Light by default; dark via a
   [data-theme="dark"] root or prefers-color-scheme. */

:root {
  color-scheme: light;
  /* surfaces — cool slate */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  /* text — slate */
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #7a8aa0;
  /* brand + actions — ink primary, muted steel-blue accent */
  --brand: #3a5c86;             /* muted steel blue: links, active accents */
  --brand-soft: #eef2f7;
  --primary: #1e2a3a;           /* ink navy primary action */
  --primary-hover: #111a27;
  --on-primary: #ffffff;
  --ring: rgba(58, 92, 134, .30);
  /* semantic */
  --ok: #067647;   --ok-bg: #ecfdf3;   --ok-bd: #abefc6;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-bd: #fedf89;
  --bad: #b42318;  --bad-bg: #fef3f2;  --bad-bd: #fecdca;
  --info: #35608f; --info-bg: #eef2f8; --info-bd: #cdddf0;
  /* shape + type */
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 2px 4px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 28px rgba(16,24,40,.14);
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111a2b;
  --surface-2: #16223a;
  --surface-3: #1d2b47;
  --border: #243149;
  --border-strong: #334463;
  --text: #e6ebf3;
  --text-2: #9fb0c7;
  --text-3: #6b7c96;
  --brand: #8fb0d6;
  --brand-soft: #172438;
  --primary: #e8edf4;
  --primary-hover: #ffffff;
  --on-primary: #0f1826;
  --ring: rgba(143, 176, 214, .30);
  --ok: #47c98a;   --ok-bg: #10231a;   --ok-bd: #1f5138;
  --warn: #eab04a; --warn-bg: #241d10; --warn-bd: #574320;
  --bad: #f37166;  --bad-bg: #2a1512;  --bad-bd: #5c2a24;
  --info: #8fb0d6; --info-bg: #131f30;  --info-bd: #2c4363;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 2px 8px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--brand-soft); color: var(--text); }

/* ---- brand lockup ---- */
.mr-brand { display: inline-flex; align-items: center; gap: 10px; }
.mr-logo { display: inline-block; width: 26px; height: 26px; border-radius: 7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%233b567d'/%3E%3Cstop offset='1' stop-color='%231e2e44'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='32' height='32' rx='7.5' fill='url(%23g)'/%3E%3Crect x='8' y='9.4' width='16' height='2.6' rx='1.3' fill='%23fff' opacity='.55'/%3E%3Crect x='8' y='14.4' width='16' height='3.2' rx='1.6' fill='%23fff'/%3E%3Crect x='8' y='19.8' width='10' height='2.6' rx='1.3' fill='%23fff' opacity='.55'/%3E%3C/svg%3E") center / contain no-repeat; box-shadow: var(--shadow-sm); }
.mr-brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--text); }
.mr-brand .tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

/* ---- buttons ---- */
.btn, button.primary, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary);
  font: 600 13.5px var(--sans); letter-spacing: -.006em; padding: 9px 16px; border-radius: var(--radius-sm);
  cursor: pointer; box-shadow: var(--shadow-sm); transition: background .12s, box-shadow .12s, transform .04s; white-space: nowrap;
}
.btn:hover, button.primary:hover, .btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:active, button.primary:active { transform: translateY(.5px); }
.btn:disabled, button.primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary, button.ghost, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  font: 600 13px var(--sans); padding: 8px 13px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.btn-secondary:hover, button.ghost:hover, .btn-ghost:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-secondary:disabled, button.ghost:disabled, .btn-ghost:disabled { opacity: .45; cursor: default; }

.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
  border-radius: var(--radius-sm); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---- form controls ---- */
input[type=text], input[type=password], input[type=date], select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  font: 13.5px var(--sans); padding: 8px 11px; border-radius: var(--radius-sm); width: 100%;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field { display: flex; flex-direction: column; gap: 6px; }
.label, label.top, legend { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }

/* ---- cards / panels ---- */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.card { padding: 18px 20px; }
h2.section { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
  display: flex; align-items: center; gap: 10px; }

/* ---- badges / pills ---- */
.badge, .chip { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px var(--mono);
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface-2); }
.badge .n, .chip .n { color: var(--text); font-weight: 700; }
.badge.ok, .chip.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-bd); }
.badge.warn, .chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.badge.bad, .chip.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-bd); }
.badge.info, .chip.info { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }

/* ---- data tables ---- */
.tablewrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); text-align: left;
  font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--border); }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.tile .k { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.tile .v { font: 650 27px var(--sans); letter-spacing: -.03em; color: var(--text); margin-top: 5px; font-variant-numeric: tabular-nums; }
.tile .v .unit { font-size: 13px; color: var(--text-3); font-weight: 600; }
.tile .sub { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 4px; white-space: pre-wrap; }

/* ---- misc ---- */
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
.err { color: var(--bad); font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; }
.err:empty { display: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
