/* ============================================================
   Revvyn — Canonical Component Kit
   ONE styled kit, built ONLY from tokens.css + os-tokens.css
   variables. This is ground truth: every screen imports this
   file and uses these classes. Do not fork, duplicate, or
   reinvent a component locally — extend this file instead.

   Import order everywhere:
     1. tokens.css        (brand tokens + 3 themes)
     2. os-tokens.css      (console elevations + 2 functional colours)
     3. components.css     (this file)

   STRICT RULES (enforced by LINT.md):
   - No colour anywhere except --os-pos (settled/allow) and
     --os-neg (blocked/danger/kill). Everything else is ink.
   - No gold, no gradients, no glow, no drop shadows beyond a
     single soft ambient (see .elevated).
   - Radii: 2px controls, 8-10px cards, nothing rounder.
   - Type: Space Grotesk (display), Space Mono (ALL data/labels,
     tabular-nums), Instrument Serif italic (marketing accent only).
   ============================================================ */

* { box-sizing: border-box; }

body.rev-scope {
  background: var(--os-bg, var(--bg));
  color: var(--os-fg, var(--fg));
  font-family: var(--os-disp, var(--font-display));
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout shells ---------- */
.rev-shell { display: flex; min-height: 100vh; }
.rev-side {
  width: 228px; flex: 0 0 228px; border-right: 1px solid var(--os-hair);
  background: var(--os-panel-2); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: width .2s ease, flex-basis .2s ease;
}
.rev-side::-webkit-scrollbar { width: 0; }
.rev-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.rev-topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 28px;
  border-bottom: 1px solid var(--os-hair); position: sticky; top: 0;
  background: color-mix(in srgb, var(--os-bg) 86%, transparent);
  backdrop-filter: blur(8px); z-index: 5;
}
.rev-content { padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Brand lockup ---------- */
.rev-brand { display: flex; align-items: center; gap: 11px; }
.rev-brand svg { width: 26px; height: 26px; color: var(--os-fg); }
.rev-brand .wm { font-weight: 600; font-size: 18px; letter-spacing: -0.03em; }
.rev-brand .wm .br { color: var(--os-muted); font-weight: 300; }
/* mark, inline — bare outline, never boxed */
.rev-mark-svg-source {
  /* <svg viewBox="0 0 100 100" fill="none" stroke="currentColor" stroke-width="7"
        stroke-linecap="square" stroke-linejoin="miter">
      <path d="M26 22 L16 22 L16 78 L26 78"/>
      <path d="M74 22 L84 22 L84 78 L74 78"/>
      <path d="M36 34 L52 50 L36 66"/>
      <path d="M52 34 L68 50 L52 66"/>
    </svg> */
}

/* ---------- Nav ---------- */
.rev-navgroup { padding: 10px 12px 2px; }
.rev-navgroup .lbl {
  font-family: var(--os-mono); font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--os-faint); padding: 6px 8px;
}
.rev-nav {
  display: flex; align-items: center; gap: 9px; padding: 6.5px 9px;
  border-radius: var(--os-radius-ctrl); color: var(--os-muted); font-size: 13px;
  text-decoration: none; /* nav links are never underlined — the active item is marked by .rev-nav.on::before.
                            Was missing here (unlike the React nav's .item), so static pages fell back to the
                            browser-default underline (surfaced on /partner/board-pack). */
  transition: background .12s, color .12s; position: relative; cursor: pointer;
}
.rev-nav svg { width: 14px; height: 14px; flex: 0 0 14px; opacity: .85; }
/* ops-dialect nav icon: one monochrome geometric glyph, ink-only (text presentation, never emoji) */
.rev-nav-ico { flex: 0 0 18px; width: 18px; text-align: center; font-size: 13px; line-height: 1; color: var(--os-faint); font-variant-emoji: text; }
.rev-nav:hover .rev-nav-ico { color: var(--os-fg); }
.rev-nav.on .rev-nav-ico { color: var(--os-fg); }
.rev-nav:hover { background: color-mix(in srgb, var(--os-fg) 4.5%, transparent); color: var(--os-fg); }
.rev-nav.on { color: var(--os-fg); background: color-mix(in srgb, var(--os-fg) 6%, transparent); }
.rev-nav.on::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; background: var(--os-fg); border-radius: 2px;
}
.rev-nav .ct { margin-left: auto; font-family: var(--os-mono); font-size: 10px; color: var(--os-faint); }

/* ---------- Collapsible sidebar (☰) ---------- */
/* Icons-only at 52px, ported from the ops pattern. State shared via the ONE `revvyn_sidebar_collapsed`
   localStorage key across ops + static/partner/sidebar.js + the React <PartnerNav>, so a collapse persists
   across React<->static navigation. Native title= on each .rev-nav names the icon when collapsed. */
.rev-sb-toggle {
  position: absolute; top: 16px; right: 12px; z-index: 2;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--os-hair); border-radius: var(--os-radius-ctrl);
  background: transparent; color: var(--os-muted); font-size: 13px; line-height: 1;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.rev-sb-toggle:hover { color: var(--os-fg); border-color: var(--os-fg); }
.rev-side-collapsed { width: 52px; flex-basis: 52px; }
.rev-side-collapsed .rev-brand .wm,
.rev-side-collapsed .rev-navgroup .lbl,
.rev-side-collapsed .rev-nav-lbl,
.rev-side-collapsed .rev-side-foot { display: none; }
.rev-side-collapsed .rev-brand { justify-content: center; padding: 18px 4px 12px !important; }
.rev-side-collapsed .rev-sb-toggle { position: static; top: auto; right: auto; margin: 16px auto 6px; }
.rev-side-collapsed .rev-navgroup { padding: 10px 6px 2px; }
.rev-side-collapsed .rev-nav { justify-content: center; gap: 0; padding: 6.5px 0; }

/* ---------- Buttons ---------- */
.rev-btn {
  font-family: var(--os-mono); font-size: 12px; letter-spacing: .02em;
  border: 1px solid var(--os-fg); background: transparent; color: var(--os-fg);
  padding: 9px 16px; border-radius: var(--os-radius-ctrl); cursor: pointer;
  transition: background .15s, color .15s;
}
.rev-btn:hover { background: var(--os-fg); color: var(--os-bg); }
.rev-btn.ghost { border-color: var(--os-hair); color: var(--os-muted); }
.rev-btn.ghost:hover { color: var(--os-fg); border-color: var(--os-fg); background: transparent; }
.rev-btn.danger { border-color: color-mix(in srgb, var(--os-neg) 45%, transparent); color: var(--os-neg); }
.rev-btn.danger:hover { background: var(--os-neg); color: var(--os-bg); border-color: var(--os-neg); }
.rev-btn.affirm { border-color: color-mix(in srgb, var(--os-pos) 45%, transparent); color: var(--os-pos); }
.rev-btn.affirm:hover { background: var(--os-pos); color: var(--os-bg); border-color: var(--os-pos); }
.rev-btn:disabled { opacity: .4; cursor: not-allowed; }
.rev-btn:disabled:hover { background: transparent; color: var(--os-fg); }

/* ---------- Segmented control ---------- */
.rev-seg { display: flex; gap: 2px; background: var(--os-panel); border: 1px solid var(--os-hair); border-radius: var(--os-radius-ctrl); padding: 2px; width: fit-content; }
.rev-seg button {
  font-family: var(--os-mono); font-size: 11px; color: var(--os-muted); background: transparent;
  border: 0; padding: 5px 11px; border-radius: 3px; letter-spacing: .04em; cursor: pointer;
}
.rev-seg button.on { background: color-mix(in srgb, var(--os-fg) 10%, transparent); color: var(--os-fg); }

/* ---------- Pills / tags (status vocabulary) ---------- */
.rev-pill {
  font-family: var(--os-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 4px; border: 1px solid var(--os-hair); color: var(--os-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.rev-pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rev-pill.pos { color: var(--os-pos); border-color: color-mix(in srgb, var(--os-pos) 30%, transparent); }
.rev-pill.neg { color: var(--os-neg); border-color: color-mix(in srgb, var(--os-neg) 40%, transparent); }

.rev-tag { font-family: var(--os-mono); font-size: 9.5px; letter-spacing: .08em; padding: 3px 7px; border-radius: 3px; text-transform: uppercase; display: inline-block; }
.rev-tag.allow, .rev-tag.pos { color: var(--os-pos); background: color-mix(in srgb, var(--os-pos) 10%, transparent); }
.rev-tag.block, .rev-tag.neg { color: var(--os-neg); background: color-mix(in srgb, var(--os-neg) 10%, transparent); }
.rev-tag.esc, .rev-tag.neutral { color: var(--os-fg); background: color-mix(in srgb, var(--os-fg) 7%, transparent); } /* escalate/pending/review/active — NEVER coloured */

/* ---------- Panels / cards ---------- */
.rev-panel { border: 1px solid var(--os-hair); border-radius: var(--os-radius-card); background: var(--os-panel); }
.rev-panel.elevated { box-shadow: 0 12px 32px rgba(0,0,0,.28); } /* the ONE permitted soft ambient shadow */
.rev-ph { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--os-hair); }
.rev-ph .t { font-family: var(--os-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--os-muted); }
.rev-ph .badge { font-family: var(--os-mono); font-size: 10px; color: var(--os-faint); }
.rev-pb { padding: 16px; }

/* ---------- KPI strip ---------- */
.rev-kpis { display: grid; border: 1px solid var(--os-hair); border-radius: var(--os-radius-card); overflow: hidden; background: var(--os-panel); }
.rev-kpi { padding: 16px 18px; border-right: 1px solid var(--os-hair); }
.rev-kpi:last-child { border-right: 0; }
.rev-kpi .v { font-family: var(--os-mono); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.rev-kpi .k { font-family: var(--os-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--os-muted); margin-top: 9px; }
.rev-kpi.pos .v { color: var(--os-pos); }
.rev-kpi.neg .v { color: var(--os-neg); }

/* ---------- Tables ---------- */
.rev-table { width: 100%; border-collapse: collapse; }
.rev-table th {
  font-family: var(--os-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--os-faint); text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--os-hair); font-weight: 400;
}
.rev-table td { padding: 12px 16px; border-bottom: 1px solid var(--os-hair-2); font-size: 13px; }
.rev-table tr:last-child td { border-bottom: 0; }
.rev-table tbody tr:hover { background: color-mix(in srgb, var(--os-fg) 2%, transparent); }
.rev-mono { font-family: var(--os-mono); font-variant-numeric: tabular-nums; }

/* ---------- Forms (the missing exemplar class) ---------- */
.rev-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.rev-field label {
  font-family: var(--os-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--os-muted);
}
.rev-field .hint { font-family: var(--os-mono); font-size: 10.5px; color: var(--os-faint); margin-top: 2px; }
.rev-input, .rev-select, .rev-textarea {
  font-family: var(--os-disp); font-size: 13.5px; color: var(--os-fg);
  background: var(--os-panel-2); border: 1px solid var(--os-hair); border-radius: var(--os-radius-ctrl);
  padding: 10px 12px; outline: none; transition: border-color .15s; width: 100%;
}
.rev-input:focus, .rev-select:focus, .rev-textarea:focus { border-color: var(--os-fg); }
.rev-input::placeholder, .rev-textarea::placeholder { color: var(--os-faint); }
.rev-mono-input { font-family: var(--os-mono); }
.rev-textarea { resize: vertical; min-height: 84px; font-family: var(--os-mono); }
.rev-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386837A' stroke-width='2'%3E%3Cpath d='M8 10l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }

/* toggle switch — used instead of colour to show on/off */
.rev-toggle { position: relative; width: 38px; height: 22px; border-radius: 11px; border: 1px solid var(--os-hair); background: var(--os-panel-2); cursor: pointer; flex: 0 0 38px; }
.rev-toggle .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--os-muted); transition: transform .15s, background .15s; }
.rev-toggle.on { border-color: var(--os-fg); }
.rev-toggle.on .knob { transform: translateX(16px); background: var(--os-fg); }

/* radio row — for allow/escalate/block policy actions, monochrome only */
.rev-radiorow { display: flex; gap: 8px; }
.rev-radiorow button { flex: 1; font-family: var(--os-mono); font-size: 11.5px; letter-spacing: .04em; padding: 9px 0; border: 1px solid var(--os-hair); background: transparent; color: var(--os-muted); border-radius: var(--os-radius-ctrl); cursor: pointer; text-transform: uppercase; }
.rev-radiorow button.on { color: var(--os-fg); border-color: var(--os-fg); background: color-mix(in srgb, var(--os-fg) 6%, transparent); }

.rev-formrow { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rev-formactions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--os-hair); margin-top: 4px; }

/* ---------- Empty states (first-class, not an afterthought) ---------- */
.rev-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; gap: 10px; text-align: center; }
.rev-empty svg { width: 40px; height: 40px; color: var(--os-faint); }
.rev-empty .t1 { font-size: 14.5px; color: var(--os-fg); font-weight: 600; }
.rev-empty .t2 { font-family: var(--os-mono); font-size: 12px; color: var(--os-muted); max-width: 360px; line-height: 1.6; }

/* ---------- Kicker / labels ---------- */
.rev-kicker { font-family: var(--os-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--os-muted); }
.rev-seclbl { font-family: var(--os-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--os-muted); margin: 6px 0 4px; }
