/* Emplo Reputation panel. Design system: DESIGN.md (Radix Colors in OKLCH, Geist, dark first). */

:root {
  color-scheme: dark;
  --bg: oklch(17.9% 0.004 286);
  --surface: oklch(21.3% 0.004 264);
  --raised: oklch(25.2% 0.006 271);
  --line: oklch(31.2% 0.008 256);
  --line-strong: oklch(39.9% 0.012 253);
  --ink: oklch(94.9% 0.003 265);
  --muted: oklch(76.9% 0.010 258);
  --faint: oklch(53.7% 0.015 262);
  --ok: oklch(77.9% 0.165 157);   --ok-fill: oklch(64.1% 0.133 158);  --ok-tint: oklch(27.2% 0.040 162);
  --warn: oklch(86.2% 0.173 89);  --warn-fill: oklch(85.4% 0.157 84); --warn-tint: oklch(25.8% 0.044 74);
  --bad: oklch(78.0% 0.128 22);   --bad-fill: oklch(62.6% 0.193 23);  --bad-tint: oklch(25.1% 0.065 13);
  --accent: oklch(76.4% 0.126 249);
  --on-fill: oklch(99.1% 0.001 286);
  --idle: oklch(27.5% 0.007 264);
  --radius: 8px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: oklch(98.3% 0.003 286);
    --surface: oklch(99.1% 0.001 286);
    --raised: oklch(95.6% 0.004 286);
    --line: oklch(91.0% 0.007 277);
    --line-strong: oklch(85.3% 0.011 280);
    --ink: oklch(24.1% 0.010 248);
    --muted: oklch(50.2% 0.014 264);
    --faint: oklch(64.5% 0.016 278);
    --ok: oklch(54.3% 0.112 159);   --ok-fill: oklch(64.1% 0.133 158);  --ok-tint: oklch(95.8% 0.022 156);
    --warn: oklch(57.1% 0.129 64);  --warn-fill: oklch(85.4% 0.157 84); --warn-tint: oklch(97.0% 0.068 100);
    --bad: oklch(55.7% 0.197 25);   --bad-fill: oklch(62.6% 0.193 23);  --bad-tint: oklch(95.5% 0.021 14);
    --accent: oklch(55.6% 0.162 252);
    --idle: oklch(92.5% 0.006 280);
  }
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 0.9375rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header: the only surface that takes the system's colour, and only as a tint */
.band { --tint: var(--ok-tint); --tone: var(--ok); border-bottom: 1px solid var(--line); background: var(--tint);
  transition: background-color 250ms var(--ease); }
.band[data-state="warn"] { --tint: var(--warn-tint); --tone: var(--warn); }
.band[data-state="bad"] { --tint: var(--bad-tint); --tone: var(--bad); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.hero { padding: 48px 16px 40px; }
.band.slim .hero { padding: 8px 16px 20px; }
#headline { font-size: 2.25rem; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); }
/* Icons: Heroicons (MIT), inline sprite in _icons.html */
.icon { width: 16px; height: 16px; flex: none; fill: currentColor; vertical-align: -3px; }
#headline { display: flex; align-items: center; gap: 0.3em; }
.state-icon { width: 0.9em; height: 0.9em; color: var(--tone); transition: color 250ms var(--ease); }
.button .icon, nav .icon, .with-icon .icon, .offline .icon, .blocked h2 .icon { margin-right: 6px; }
.button.small .icon { width: 14px; height: 14px; margin-right: 4px; }
nav a, .linklike { display: inline-flex; align-items: center; }
nav .icon { color: var(--faint); }
nav a:hover .icon, nav a[aria-current="page"] .icon { color: var(--ink); }
.with-icon { display: inline-flex; align-items: center; }
.files .with-icon .icon { color: var(--faint); }
.pill .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.search { position: relative; display: inline-flex; align-items: center; }
.search .icon { position: absolute; left: 9px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 30px; }
.offline { display: flex; align-items: center; }
.band.slim #headline { font-size: 1.5rem; }
.checked { margin-top: 10px; color: var(--muted); font-size: 0.8125rem; }
@media (max-width: 600px) { #headline { font-size: 1.75rem; } .hero { padding: 32px 16px 28px; } }

nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav a, .linklike { color: var(--muted); font: 500 0.875rem var(--font); padding: 6px 10px; border-radius: 6px; }
nav a:hover, .linklike:hover { color: var(--ink); background: var(--raised); text-decoration: none; }
nav a[aria-current="page"] { color: var(--ink); background: var(--raised); }
.linklike { background: none; border: 0; cursor: pointer; }
nav form { margin: 0; }

/* Buttons and fields: 32 px, one vocabulary everywhere */
.button { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; font: 500 0.875rem var(--font);
  color: var(--bg); background: var(--ink); border: 1px solid var(--ink); border-radius: 6px; cursor: pointer;
  white-space: nowrap; transition: background-color 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms; }
.button:hover { opacity: 0.86; text-decoration: none; }
.button:active { opacity: 0.72; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.quiet { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button.quiet:hover { opacity: 1; background: var(--raised); }
.button.danger { color: var(--on-fill); background: var(--bad-fill); border-color: var(--bad-fill); }
.button.small { height: 28px; padding: 0 10px; font-size: 0.8125rem; }
input, select { height: 32px; font: 400 0.875rem var(--font); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 10px; min-width: 0;
  transition: border-color 150ms var(--ease); }
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }

/* Surfaces */
main.wrap { padding-top: 24px; padding-bottom: 64px; }
main.public { padding-top: 32px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 0.9375rem; font-weight: 600; }
.panel-body { padding: 16px; }
.count { color: var(--faint); font-weight: 500; margin-left: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 0.8125rem; }

/* State pill: tint 3, text 11, always with a word */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500; color: var(--ok); background: var(--ok-tint); white-space: nowrap;
  transition: color 250ms var(--ease), background-color 250ms var(--ease); }
[data-state="warn"] > .pill, .pill[data-state="warn"] { color: var(--warn); background: var(--warn-tint); }
[data-state="bad"] > .pill, .pill[data-state="bad"] { color: var(--bad); background: var(--bad-tint); }
.pill.neutral { color: var(--muted); background: var(--raised); }

/* Public: services */
.services { list-style: none; margin: 0; padding: 0; }
.service { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(210px, 1.2fr) minmax(130px, .8fr) minmax(200px, 1.3fr);
  align-items: center; gap: 8px 20px; padding: 14px 16px; border-top: 1px solid var(--line); }
.service:first-child { border-top: 0; }
.service h2 { font-size: 0.9375rem; font-weight: 500; }
.service > .pill { justify-self: start; }
.svc-seen { color: var(--faint); font-size: 0.8125rem; white-space: nowrap; }
.hours { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; height: 24px; }
.hours li { flex: 1; border-radius: 2px; background: var(--idle); transition: background-color 250ms var(--ease); }
.hours li[data-state="ok"] { background: var(--ok-fill); }
.hours li[data-state="bad"] { background: var(--bad-fill); }
.hours:hover li { opacity: 0.55; }
.hours li:hover { opacity: 1; }
.legend { display: flex; gap: 16px; justify-content: flex-end; flex-wrap: wrap; list-style: none; padding: 0;
  margin: 12px 0 0; color: var(--faint); font-size: 0.8125rem; }
.legend li::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px;
  background: var(--idle); }
.legend li[data-state="ok"]::before { background: var(--ok-fill); }
.legend li[data-state="bad"]::before { background: var(--bad-fill); }
@media (max-width: 860px) {
  .service { grid-template-columns: 1fr auto; }
  .svc-seen { grid-column: 1; }
  .hours { grid-column: 1 / -1; }
}

.offline { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius); font-weight: 500;
  color: var(--warn); background: var(--warn-tint); border: 1px solid color-mix(in oklch, var(--warn) 35%, transparent); }
.message { margin-top: 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); }
.message[data-kind="success"] { color: var(--ok); background: var(--ok-tint); border-color: color-mix(in oklch, var(--ok) 35%, transparent); }
.message[data-kind="error"] { color: var(--bad); background: var(--bad-tint); border-color: color-mix(in oklch, var(--bad) 35%, transparent); }

/* Dashboard: one strip of numbers, not a grid of hero tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 24px; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { padding: 14px 16px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: 0; }
.stat:nth-child(4n + 1) { border-left: 0; }
.stat:nth-child(-n + 4) { border-top: 0; }
.stat dt { color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.stat dd { margin: 4px 0 0; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.stat dd small { font-size: 0.8125rem; color: var(--faint); font-weight: 400; letter-spacing: 0; }
.stat .meter { height: 4px; border-radius: 2px; background: var(--idle); margin-top: 10px; overflow: hidden; }
.stat .meter span { display: block; height: 100%; background: var(--ink); transform-origin: left;
  transition: transform 250ms var(--ease); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(n) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .stat:nth-child(2n + 1) { border-left: 0; }
  .stat:nth-child(-n + 2) { border-top: 0; }
}

.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 0; } }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 16px 16px 28px; position: relative; }
.col { flex: 1; height: 100%; position: relative; }
.bar { position: absolute; inset: 0; background: var(--ok-fill); border-radius: 2px 2px 0 0; transform-origin: bottom;
  transform: scaleY(0.015); transition: transform 250ms var(--ease); }
.col:hover .bar { background: var(--ok); }
.col em { position: absolute; bottom: -20px; left: 0; font-style: normal; font-size: 0.75rem; color: var(--faint); }
.order p { color: var(--muted); margin-bottom: 12px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }

.blocked { display: flex; gap: 16px 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 16px; margin-bottom: 24px; border-radius: var(--radius); color: var(--ink); background: var(--bad-tint);
  border: 1px solid color-mix(in oklch, var(--bad) 40%, transparent); }
.blocked h2 { font-size: 0.9375rem; font-weight: 600; color: var(--bad); margin-bottom: 4px; }
.blocked p { max-width: 70ch; color: var(--muted); }
.blocked strong { color: var(--ink); font-weight: 500; }

.events { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.events li { display: grid; grid-template-columns: 72px 80px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 8px 16px; border-top: 1px solid var(--line); font-size: 0.875rem; }
.events li:first-child { border-top: 0; }
.events time { color: var(--faint); font-size: 0.8125rem; }
.events .proc { color: var(--muted); font-size: 0.8125rem; }
.events li[data-level="warning"] .msg { color: var(--warn); }
.events li[data-level="error"] .msg { color: var(--bad); }
@media (max-width: 600px) { .events li { grid-template-columns: 64px minmax(0, 1fr); } .events .proc { display: none; } }

/* Leads and files */
.table-scroll { overflow-x: auto; }
.leads { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.leads th { text-align: left; font-weight: 500; font-size: 0.8125rem; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.leads td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.leads tbody tr:last-child td { border-bottom: 0; }
.leads tbody tr:hover { background: var(--raised); }
.leads td small { display: block; color: var(--faint); font-size: 0.8125rem; }
.leads .why { color: var(--muted); min-width: 26ch; max-width: 40ch; }
.leads form { margin: 0; }
.level { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px;
  font-size: 0.8125rem; font-weight: 600; color: var(--muted); background: var(--raised); }
.level[data-level="1"] { color: var(--bg); background: var(--ink); }
.level[data-level="2"] { color: var(--ink); background: var(--line-strong); }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.files li:hover { background: var(--raised); }
.files .meta { color: var(--faint); font-size: 0.8125rem; white-space: nowrap; }
.empty { color: var(--muted); padding: 16px; }

/* Raw logs: a terminal, so monospace */
.log { background: var(--bg); color: var(--ink); font: 0.8125rem/1.6 var(--mono); padding: 12px 16px;
  height: min(68vh, 720px); overflow: auto; word-break: break-word;
  border-radius: 0 0 var(--radius) var(--radius); }
.log .line { white-space: pre-wrap; }
.log .t, .log .lv { color: var(--faint); }
.log .p, .log .id { color: var(--accent); }
.log .line[data-level="warning"] .lv, .log .line[data-level="warning"] .m { color: var(--warn); }
.log .line[data-level="error"] .lv, .log .line[data-level="error"] .m { color: var(--bad); }
.log-foot { padding: 10px 16px; border-top: 1px solid var(--line); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); display: grid; gap: 6px; padding: 24px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.login h1 { font-size: 1.25rem; font-weight: 600; margin: 20px 0 10px; letter-spacing: -0.02em; }
.login label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); margin-top: 8px; }
.login .button { margin-top: 16px; justify-content: center; }
.login .back { font-size: 0.8125rem; margin-top: 10px; color: var(--muted); }

/* Motion only on change (DESIGN.md): never layout properties */
@keyframes flash { from { background-color: var(--raised); } }
.service.changed, .stat.changed { animation: flash 900ms var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(-4px); } }
.events li.new, .log .line.new { animation: enter 220ms var(--ease), flash 1200ms var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
