/* OCB Ops Center — token block + shell.
 *
 * The look is the OCB public website's LIGHT theme (ocb-website src/styles: tokens.css
 * [data-theme="light"], public.css): a soft blue-grey page with faint ambient glows, white
 * cards on hairline borders with soft blue shadows, 16px corners, pill buttons on the
 * blue-to-violet accent gradient, and a tight, heavy wordmark. Light only, by decision of
 * the owner (2026-10-20): an operations tool reads in daylight, and following the OS into
 * dark mode made it a different product from the website it belongs to.
 *
 * The variable NAMES --bg … --info, --radius, --gap are fixed by CLAUDE.md and must not
 * change; the ocguard-ops section below inherits them. The --ocb-* names are added, not
 * substituted. Every text pair is WCAG AA (>= 4.5:1), measured: the accent gradient is a
 * shade darker than the website's (#4d7cff -> #8b5cf6 puts white text at 3.6:1).
 */
:root {
  --bg:     #eef1f8;   /* --ocb-bg (light) */
  --panel:  #ffffff;   /* --ocb-product-card (light) */
  --line:   #dfe3ee;   /* --ocb-hair (light), solid */
  --fg:     #1c2740;   /* --ocb-text (light) */
  --muted:  #56607a;   /* --ocb-text-body (light) */
  --ok:     #1c7c4a;
  --warn:   #875700;
  --bad:    #b3261e;
  --info:   #3461d1;   /* --ocb-ic-blue (light), darkened to 4.9:1 on --bg */
  --radius: 12px;
  --gap: 16px;

  --ocb-strong:   #16203a;                                   /* --ocb-text-strong (light) */
  --ocb-accent:   linear-gradient(135deg, #3461d1, #6d3fd8); /* white text 5.6 / 6.3:1 */
  --ocb-tint:     #e8eefc;                                   /* active / hover wash */
  --ocb-shadow:   0 12px 32px rgba(40, 60, 120, .08);        /* --ocb-shadow-card, softened */
  --ocb-shadow-h: 0 18px 42px rgba(40, 60, 120, .14);
  --ocb-ambient:  radial-gradient(80% 50% at 78% 8%, rgba(120,150,255,.18), transparent 60%),
                  radial-gradient(70% 45% at 12% 4%, rgba(170,140,255,.12), transparent 60%);
  --ocb-card-r:   16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--fg);
  background: var(--ocb-ambient), var(--bg); background-attachment: fixed;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--info); text-underline-offset: 2px; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* ---- sidebar: white, hairline, the website's wordmark, pill-shaped active item ---- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand {
  font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--ocb-strong);
  padding: 0 10px; margin-bottom: 20px;
}
.side nav a {
  display: block; padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: #3c4660; text-decoration: none; font-size: 14.5px; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.side nav a:hover { background: var(--bg); color: var(--ocb-strong); }
.side nav a[aria-current="page"] {
  background: var(--ocb-tint); color: #2d54b8; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--info);
}
.side .who {
  margin-top: 20px; padding: 16px 10px 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}

main { padding: 32px 36px; max-width: 1180px; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ocb-strong); margin: 0 0 20px; }
h2 { font-size: 17px; font-weight: 650; color: var(--ocb-strong); margin: 28px 0 10px; }

/* ---- surfaces: the website's white card ---- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--ocb-card-r);
  padding: 20px 22px; margin-bottom: var(--gap); box-shadow: var(--ocb-shadow);
}
/* Paragraph margins inside a card are spacing between siblings, not padding at the edges. */
.card > :first-child, .panel > :first-child { margin-top: 0; }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.kpi .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ocb-strong); }
.kpi .l { color: var(--muted); font-size: 13px; }

/* ---- forms ---- */
label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d3d9e6; border-radius: 10px;
  background: var(--panel); color: var(--fg); font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--info); box-shadow: 0 0 0 3px rgba(52, 97, 209, .18);
}

/* ---- buttons: the website's pills ---- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: 999px;
  background: var(--ocb-accent); color: #fff; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; box-shadow: 0 8px 22px rgba(52, 97, 209, .28);
  transition: transform .15s ease, box-shadow .2s ease, filter .15s ease;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(52, 97, 209, .36); filter: brightness(1.05); }
button.secondary {
  background: var(--panel); color: var(--ocb-strong); border-color: #d3d9e6; box-shadow: none;
}
button.secondary:hover { background: var(--bg); box-shadow: none; }
button.danger { background: var(--bad); color: #fff; box-shadow: 0 8px 22px rgba(179, 38, 30, .22); }

/* ---- notes, pills ---- */
.note { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: var(--gap); background: var(--panel); }
.note.err  { border-color: #f1c7c2; background: #fbecea; color: var(--bad); }
.note.ok   { border-color: #bfe0cc; background: #e9f5ee; color: var(--ok); }
.note.warn { border-color: #ecd9ae; background: #fbf3e3; color: var(--warn); }
.muted { color: var(--muted); }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.secret { font-size: 18px; letter-spacing: .06em; padding: 12px; background: var(--bg); border: 1px dashed #c9d0df; border-radius: 12px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover td { background: #f7f9fd; }

/* ---- sign-in: one white card on the ambient page ---- */
.auth {
  max-width: 400px; margin: 10vh auto; padding: 28px 28px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--ocb-shadow-h);
}
.auth h1 { font-size: 24px; }
.auth button { width: 100%; margin-top: 16px; padding: 12px 18px; }

/* responsive: tables collapse to cards */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  main { padding: 20px 16px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px; background: var(--panel); }
  td { border: 0; padding: 5px 6px; }
  td::before { content: attr(data-l) ": "; color: var(--muted); }
}


/* ---------------------------------------------------------------------------
 * ocguard-ops layout classes, merged in and re-pointed at the token block above.
 *
 * The Security section is ocguard_ops::router rendered inside this shell, so its
 * markup lands on this page. Upstream ships its own style.css with its own :root
 * palette (Cloudflare-ish oranges and blues) plus a .cf/.side/.nav fleet sidebar;
 * none of that is served here — CLAUDE.md: "the Security module's style.css is
 * replaced by the token block, keep its layout classes". Hard-coded hexes from
 * upstream are replaced with color-mix() over the tokens so light and dark both work.
 * Class names must stay byte-identical to ocguard-ops' markup.
 * --------------------------------------------------------------------------- */

/* tab strip (embedded mode replaces the fleet sub-nav with these) */
.tabs { display: flex; gap: 4px; margin: 0 0 var(--gap); border-bottom: 1px solid var(--line); }
.tabs .tab {
  padding: 8px 14px; color: var(--muted); font-size: 14px; text-decoration: none;
  border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.tabs .tab:hover { color: var(--fg); }
.tabs .tab.active { background: var(--panel); border-color: var(--line); color: var(--fg); font-weight: 600; }

/* titlebar / panels */
.titlebar { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.sub { color: var(--muted); font-size: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--ocb-card-r); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--ocb-shadow); }
.ph { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 12px; }
.ph b { font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* KPI tiles — note: ocguard-ops uses .kpi .l/.v, the console dashboard uses .kpi .l/.n */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--ocb-card-r); box-shadow: var(--ocb-shadow); padding: 14px 16px 6px; min-height: 92px; position: relative; overflow: hidden; }
.kpi .l { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 26px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi.ok .v { color: var(--ok); } .kpi.warn .v { color: var(--warn); } .kpi.bad .v { color: var(--bad); }
.delta { font-size: 12px; font-weight: 500; vertical-align: middle; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.delta.flat, .delta.none { color: var(--muted); }

/* charts */
.spark { width: 100%; height: 40px; display: block; margin-top: 6px; }
.spark .line { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .area { opacity: .12; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .ylab, .chart .xlab { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.chart .area { opacity: .10; }
.legend-inline { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.legend-inline i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.legend-inline b { color: var(--fg); }

/* data tables */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { color: var(--muted); font-weight: 500; font-size: 12px; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }

/* bar tables */
table.bars { width: 100%; border-collapse: collapse; font-size: 13px; }
table.bars td { padding: 4px 6px; }
table.bars .k { width: 38%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
table.bars .b { width: 40%; }
table.bars .v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.bars .p { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.track { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.track.wide { height: 12px; margin-top: 6px; }
.fill { height: 100%; border-radius: 4px; }

/* live strip */
.live { display: grid; grid-template-columns: 140px 110px 110px 1fr 1fr; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 14px; }
.live .lv { display: flex; align-items: center; gap: 8px; }
.live .lk b { font-size: 20px; display: block; font-variant-numeric: tabular-nums; }
.live .lk span { color: var(--muted); font-size: 11px; }
.live .ls .spark { height: 36px; margin: 0; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px color-mix(in srgb, var(--ok) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 0%, transparent); }
}

/* donut + uptime */
.donut { display: flex; gap: 16px; align-items: center; }
.donut .dtot { font-size: 18px; font-weight: 600; fill: var(--fg); }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.legend li { display: flex; gap: 8px; align-items: center; margin: 3px 0; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend b { margin-left: auto; padding-left: 12px; }
.uptime { display: grid; grid-template-columns: repeat(96, 1fr); gap: 2px; height: 28px; }
.uptime i { border-radius: 2px; background: var(--line); }
.uptime i.up { background: var(--ok); }
.uptime i.down { background: var(--bad); }

/* status dots, tags, chips, flashes */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); } .dot.none { background: var(--line); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag.ok       { background: color-mix(in srgb, var(--ok) 14%, transparent);   color: var(--ok);   border-color: transparent; }
.tag.warn,
.tag.throttle { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-color: transparent; }
.tag.bad,
.tag.ban      { background: color-mix(in srgb, var(--bad) 14%, transparent);  color: var(--bad);  border-color: transparent; }
.tag.captcha  { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); border-color: transparent; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.ranges { display: flex; gap: 6px; margin: 0 0 14px; }
.chip { padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 13px; text-decoration: none; }
.chip.active { background: var(--ocb-accent); color: #fff; border-color: transparent; }
.flash { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; }

/* ocguard-ops buttons: it uses .btn where the console shell uses <button> */
/* Text on --info is var(--panel), not #fff: white on the dark-mode --info is 2.5:1. */
.btn { font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 999px; border: 1px solid transparent; background: var(--ocb-accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; color: var(--info); border-color: var(--line); }
.btn.sm { padding: 2px 8px; font-size: 12px; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline .spacer { flex: 1; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* A row linked to from elsewhere (a ticket's "View decision"): tint it so the eye lands
   on it immediately rather than scanning a table for a prefix. */
table.grid tr.focus > td {
  background: color-mix(in srgb, var(--info) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--info);
}
