/* Sentinel v2 design system, extracted from the approved prototype
   (design/sentinel-v2-prototype.html). Tokens: ground #0C0B12, accent
   #6C5CE7 rationed, violet-biased neutrals. Single-theme dark. */
/* ── Tokens ── deliberately single-theme: Xybern's dark ground, violet-biased
     neutrals, purple #6C5CE7 reserved for what matters. */
  :root {
    color-scheme: dark;
    --ground: #0C0B12; --surface: #12111A; --raised: #171522; --inset: #0F0E16;
    --line: #221F2E; --line-soft: #1B1926;
    --ink: #ECEAF4; --ink-2: #9B96AE; --ink-3: #625D75;
    --accent: #6C5CE7; --accent-hi: #8A7CF0; --accent-wash: rgba(108,92,231,.09);
    --ok: #3FB37F; --ok-wash: rgba(63,179,127,.10);
    --bad: #E5484D; --bad-wash: rgba(229,72,77,.09);
    --warn: #E0A336; --warn-wash: rgba(224,163,54,.10);
    --radius: 8px;
    --font: -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  }
  * { box-sizing: border-box; margin: 0; }
  html, body { height: 100%; }
  body {
    background: var(--ground); color: var(--ink); font-family: var(--font);
    font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden;
  }
  button { font-family: inherit; font-size: inherit; cursor: pointer; }
  input { font-family: inherit; }
  button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
  }
  ::selection { background: rgba(108,92,231,.35); }

  .app { display: flex; height: 100vh; }

  /* ── Rail ── */
  .rail { width: 230px; flex-shrink: 0; border-right: 1px solid var(--line-soft);
    display: flex; flex-direction: column; padding: 18px 12px 12px; }
  .wordmark { padding: 2px 10px 0; display: flex; align-items: center; gap: 10px; }
  .wordmark .wm-logo { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    border: 1px solid var(--line); object-fit: cover; }
  .wordmark .wm { font-size: 13px; font-weight: 700; letter-spacing: .28em; }
  .wordmark .wm-sub { font-size: 9.5px; font-weight: 600; letter-spacing: .14em;
    color: var(--ink-3); text-transform: uppercase; margin-top: 1px; }
  .ws-chip { margin: 16px 4px 4px; padding: 8px 10px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; gap: 9px; }
  .ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
  .ws-chip b { font-size: 12.5px; font-weight: 600; display: block; }
  .ws-chip span { font-size: 10.5px; color: var(--ink-3); display: block; }
  .nav { flex: 1; overflow-y: auto; padding: 4px 0 8px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .nav-label { font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
    color: var(--ink-3); padding: 15px 10px 5px; }
  .nav-item { display: flex; align-items: center; width: 100%; text-align: left; padding: 5px 10px;
    border: 0; background: none; border-radius: 6px; color: var(--ink-2); font-size: 12.5px; position: relative; }
  .nav-item:hover { color: var(--ink); background: rgba(255,255,255,.03); }
  .nav-item.active { color: var(--ink); font-weight: 600; background: var(--accent-wash); }
  .nav-item.active::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
    width: 2px; border-radius: 2px; background: var(--accent); }
  .nav-badge { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--warn);
    background: var(--warn-wash); padding: 0 6px; border-radius: 8px; line-height: 17px;
    font-variant-numeric: tabular-nums; }
  .rail-user { display: flex; align-items: center; gap: 9px; padding: 9px 10px; position: relative;
    border-top: 1px solid var(--line-soft); margin-top: 6px; border-radius: 8px; cursor: pointer; }
  .rail-user:hover { background: rgba(255,255,255,.03); }
  .rail-user .ru-meta { min-width: 0; flex: 1; }
  .ru-caret { width: 14px; height: 14px; color: var(--ink-3); flex-shrink: 0; transition: transform .15s ease; }
  .rail-user.pop-open .ru-caret { transform: rotate(180deg); }
  .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--raised);
    border: 1px solid var(--line); color: var(--ink-2); font-size: 10.5px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .rail-user b { font-size: 12px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-user span { font-size: 10.5px; color: var(--ink-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* profile popover (opens upward from the footer) */
  .profile-pop { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 30;
    background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 6px;
    box-shadow: 0 16px 40px rgba(0,0,0,.55); opacity: 0; transform: translateY(6px);
    pointer-events: none; transition: opacity .14s ease, transform .14s ease; }
  .rail-user.pop-open .profile-pop { opacity: 1; transform: none; pointer-events: auto; }
  .pp-head { display: flex; align-items: center; gap: 9px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
  .pp-head b { font-size: 12.5px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
  .pp-head span { font-size: 11px; color: var(--ink-3); display: block; overflow: hidden; text-overflow: ellipsis; }
  .pp-head > div:last-child { min-width: 0; }
  .pp-item { display: block; width: 100%; text-align: inherit; text-decoration: none;
    color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 550;
    padding: 8px 10px; border-radius: 7px; background: none; border: 0; cursor: pointer; }
  .pp-item:hover { background: rgba(255,255,255,.04); color: var(--ink); }
  .pp-danger { color: var(--bad); }
  .pp-danger:hover { background: var(--bad-wash); color: var(--bad); }
  .avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
  /* edit-profile dialog */
  .pf-form { display: flex; flex-direction: column; gap: 4px; }
  .pf-pic-row { display: flex; align-items: center; gap: 14px; padding-bottom: 6px; }
  .pf-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--raised);
    border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden; }
  .pf-avatar-img { width: 100%; height: 100%; object-fit: cover; }
  .pf-avatar-txt { font-size: 18px; font-weight: 700; color: var(--ink-2); }
  .pf-pic-actions { min-width: 0; }
  .pf-pic-btns { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
  .pf-file-name { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-input { width: 100%; margin-top: 6px; background: var(--sunk, #0F0F1A); color: var(--ink);
    border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; font: inherit; font-size: 13px; }
  .pf-input:focus { outline: none; border-color: var(--accent); }
  .pf-pw { margin-top: 6px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
  .pf-pw summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); font-weight: 550; list-style: none; padding: 4px 0; }
  .pf-pw summary::-webkit-details-marker { display: none; }
  .pf-pw summary::before { content: "＋ "; color: var(--ink-3); }
  .pf-pw[open] summary::before { content: "－ "; }

  /* ── Main ── */
  .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .topbar { height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 10px;
    padding: 0 24px; border-bottom: 1px solid var(--line-soft); }
  .crumb { font-size: 13px; color: var(--ink-3); }
  .crumb b { color: var(--ink); font-weight: 600; }
  .ask-btn { margin-left: auto; display: flex; align-items: center; gap: 7px;
    color: var(--accent-hi); font-size: 12.5px; font-weight: 600; background: var(--accent-wash);
    border: 1px solid rgba(108,92,231,.3); border-radius: 7px; padding: 5px 12px; }
  .ask-btn:hover { background: rgba(108,92,231,.16); }
  .ask-spark { font-size: 13px; line-height: 1; }
  .kbd-hint { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
  .kbd { font-family: var(--mono); font-size: 10.5px; background: var(--raised);
    border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 17px; }

  .content { flex: 1; overflow-y: auto; padding: 28px 32px 64px; }
  .view { max-width: 1200px; margin: 0 auto; display: none; }
  .view.on { display: block; }
  .view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
  .view-head h1 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
  .view-head p { color: var(--ink-2); font-size: 13px; margin-top: 3px; max-width: 64ch; }
  .view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }

  .btn { border-radius: 7px; padding: 7px 14px; font-size: 12.5px; font-weight: 600;
    border: 1px solid transparent; transition: background .12s ease; }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: var(--accent-hi); }
  .btn-ghost { background: none; color: var(--ink-2); border-color: var(--line); }
  .btn-ghost:hover { color: var(--ink); border-color: #322e44; }
  .btn-quiet { background: none; color: var(--ink-2); border: 0; padding: 4px 8px; font-weight: 600; }
  .btn-quiet:hover { color: var(--ink); }
  .btn-danger { background: none; color: var(--bad); border-color: rgba(229,72,77,.35); }
  .btn-danger:hover { background: var(--bad-wash); }
  .btn-ask { background: none; color: var(--accent-hi); border-color: rgba(108,92,231,.3); }
  .btn-ask:hover { background: var(--accent-wash); }

  .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  .stack { display: grid; gap: 10px; }

  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
  .stat { padding: 16px 18px; }
  .stat .n { font-size: 26px; font-weight: 650; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums; line-height: 1.15; }
  .stat .l { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
  .stat .d { font-size: 11px; margin-top: 8px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .stat .d.up { color: var(--ok); } .stat .d.warn { color: var(--warn); }

  .chart-card { padding: 18px 20px 14px; margin-bottom: 10px; }
  .chart-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
  .chart-head h3 { font-size: 12.5px; font-weight: 650; }
  .chart-head span { font-size: 11px; color: var(--ink-3); }
  .bars { display: flex; align-items: flex-end; gap: 5px; height: 84px; }
  .bar { flex: 1; border-radius: 3px 3px 0 0; background: rgba(138,124,240,.32); min-height: 3px; }
  .bar:hover, .bar.hot { background: var(--accent-hi); }
  .bar-x { display: flex; gap: 5px; margin-top: 7px; }
  .bar-x span { flex: 1; text-align: center; font-size: 9.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .tip { position: fixed; z-index: 90; pointer-events: none; display: none; background: var(--raised);
    border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font-size: 11.5px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5); }
  .tip b { font-variant-numeric: tabular-nums; }
  .tip span { color: var(--ink-2); }

  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  @media (max-width: 900px) { .two-col, .stats { grid-template-columns: 1fr; } }

  .list-card { padding: 6px 0; }
  .list-card h3 { font-size: 12.5px; font-weight: 650; padding: 12px 18px 8px; }
  .attn { display: flex; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-soft); align-items: baseline; }
  .attn .sev { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; position: relative; top: 4px; }
  .attn p { font-size: 12.5px; }
  .attn p span { color: var(--ink-2); }
  .attn .go { margin-left: auto; flex-shrink: 0; }

  .tbl-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  th { text-align: left; font-size: 10.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
    color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
  tr:last-child td { border-bottom: 0; }
  tbody tr.rowlink { cursor: pointer; }
  tbody tr.rowlink:hover { background: rgba(255,255,255,.022); }
  .t-num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
  .t-mono { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
  .t-main b { font-weight: 600; display: block; }
  .t-main span { font-size: 11.5px; color: var(--ink-3); display: block; max-width: 300px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650;
    padding: 2px 9px; border-radius: 20px; letter-spacing: .02em; white-space: nowrap; }
  .pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .pill.ok { color: var(--ok); background: var(--ok-wash); }
  .pill.bad { color: var(--bad); background: var(--bad-wash); }
  .pill.warn { color: var(--warn); background: var(--warn-wash); }
  .pill.dim { color: var(--ink-2); background: rgba(255,255,255,.05); }
  .pill.acc { color: var(--accent-hi); background: var(--accent-wash); }

  .seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line);
    border-radius: 8px; padding: 2px; gap: 2px; }
  .seg button { border: 0; background: none; color: var(--ink-2); font-size: 12px; font-weight: 600;
    padding: 5px 12px; border-radius: 6px; }
  .seg button.on { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
  .filters { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .filters .count { color: var(--ink-3); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
  .search { background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    color: var(--ink); font-size: 12.5px; padding: 6px 12px; width: 220px; outline: none; }
  .search::placeholder { color: var(--ink-3); }
  .search:focus { border-color: rgba(108,92,231,.5); }

  .meterbar { width: 96px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden;
    display: inline-block; vertical-align: middle; }
  .meterbar i { display: block; height: 100%; border-radius: 2px; background: var(--accent-hi); }
  .meterbar.hot i { background: var(--warn); }

  /* verdict micro-indicator: aggregate number + four dimension dots.
     Full names live in the hover tooltip and the record dialog. */
  .v-cell { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
  .v-agg { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); min-width: 20px; }
  .v-dots { display: inline-flex; gap: 3px; }
  .v-dot { width: 6px; height: 6px; border-radius: 50%; }
  .v-dot.hi  { background: var(--accent-hi); }
  .v-dot.mid { background: #4A4462; }
  .v-dot.lo  { background: var(--warn); }
  .v-dot.na  { background: none; border: 1px solid var(--ink-3); width: 5px; height: 5px; }
  .tip .tt-row { display: flex; gap: 14px; justify-content: space-between; }
  .tip .tt-row b { font-variant-numeric: tabular-nums; }

  .esc { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
  .esc-top { display: flex; align-items: baseline; gap: 10px; }
  .esc-top b { font-size: 14px; font-weight: 650; }
  .esc-top .when { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .esc-foot { display: flex; align-items: center; gap: 8px; }
  .esc-foot .why { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
  .quote { border-left: 2px solid var(--accent); padding: 8px 14px; background: var(--inset);
    border-radius: 0 7px 7px 0; font-size: 12.5px; line-height: 1.6; }
  .plain { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }

  .charter-sig { display: flex; align-items: center; gap: 12px; padding: 13px 18px; margin-bottom: 10px; }
  .sig-mark { color: var(--accent-hi); font-weight: 750; font-size: 11px; letter-spacing: .12em; }
  .charter-sig p { font-size: 12.5px; color: var(--ink-2); }
  .charter-sig .t-mono { margin-left: auto; }
  .mandate { padding: 16px 20px; display: flex; gap: 16px; align-items: baseline; }
  .mandate + .mandate { border-top: 1px solid var(--line-soft); }
  .mandate .m-body { min-width: 0; flex: 1; }
  .mandate .m-text { font-size: 13.5px; font-weight: 550; line-height: 1.5; text-wrap: balance; }
  .mandate .m-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
  .mandate .m-acts { margin-top: 7px; display: flex; gap: 2px; }
  .mandate .pill { flex-shrink: 0; }

  .coverage-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
  @media (max-width: 900px) { .coverage-row { grid-template-columns: 1fr 1fr; } }
  .auth-chips { display: flex; gap: 5px; flex-wrap: wrap; }
  .chip { font-size: 10.5px; font-weight: 650; padding: 1px 8px; border-radius: 5px; white-space: nowrap; }
  .chip.a { color: var(--accent-hi); background: var(--accent-wash); }
  .chip.g { color: var(--ok); background: var(--ok-wash); }
  .chip.n { color: var(--warn); background: var(--warn-wash); }
  .chip.d { color: var(--ink-2); background: rgba(255,255,255,.05); }

  .pipe { display: flex; padding: 18px 20px; overflow-x: auto; }
  .pipe-step { flex: 1; min-width: 170px; position: relative; padding-right: 24px; }
  .pipe-step:not(:last-child)::after { content: '→'; position: absolute; right: 8px; top: 2px; color: var(--ink-3); }
  .pipe-step .k { font-size: 10.5px; font-weight: 750; letter-spacing: .1em; color: var(--accent-hi); }
  .pipe-step .t { font-size: 12.5px; font-weight: 650; margin-top: 3px; }
  .pipe-step .d { font-size: 11px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; max-width: 24ch; }

  .strip { display: flex; align-items: center; gap: 10px; padding: 11px 18px; margin-top: 10px;
    font-size: 12px; color: var(--ink-2); }
  .strip .go { margin-left: auto; }
  .codebox { background: var(--inset); border: 1px solid var(--line-soft); border-radius: 8px;
    font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); padding: 14px 16px;
    overflow-x: auto; white-space: pre; line-height: 1.7; }
  .codebox b { color: var(--accent-hi); font-weight: 500; }

  /* ── Decision record dialog (replaces the old side drawer) ── */
  .scrim { position: fixed; inset: 0; background: rgba(5,4,10,.6); backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .16s ease; z-index: 40; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .dlg { position: fixed; inset: 0; z-index: 50; display: none; align-items: center;
    justify-content: center; padding: 32px 20px; }
  .dlg.on { display: flex; }
  .dlg-box { width: 840px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 32px 96px rgba(0,0,0,.6); overflow: hidden;
    animation: dlg-in .18s cubic-bezier(.3,.8,.3,1); }
  @keyframes dlg-in { from { transform: translateY(10px) scale(.985); opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .dlg-box { animation: none; } .scrim { transition: none; } }
  .dlg-head { position: relative; padding: 22px 28px 18px; border-bottom: 1px solid var(--line-soft); }
  .dlg-head::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--edge, var(--accent)); }
  .dlg-eyebrow { font-size: 10.5px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
  .dlg-eyebrow.ok { color: var(--ok); } .dlg-eyebrow.bad { color: var(--bad); }
  .dlg-eyebrow.warn { color: var(--warn); } .dlg-eyebrow.acc { color: var(--accent-hi); }
  .dlg-title { font-size: 18px; font-weight: 650; letter-spacing: -.01em; margin-top: 6px;
    text-wrap: balance; max-width: 56ch; }
  .dlg-meta { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
  .dlg-ring { position: absolute; right: 64px; top: 20px; text-align: center; }
  .dlg-ring svg { display: block; }
  .dlg-ring .rv { font-size: 10px; color: var(--ink-3); margin-top: 2px; letter-spacing: .06em; }
  .dlg-x { position: absolute; top: 16px; right: 16px; border: 0; background: none; color: var(--ink-3);
    font-size: 15px; padding: 6px 9px; border-radius: 6px; }
  .dlg-x:hover { color: var(--ink); background: rgba(255,255,255,.05); }
  .dlg-body { flex: 1; overflow-y: auto; padding: 8px 28px 24px; }
  .dlg-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 0 32px; }
  @media (max-width: 760px) { .dlg-grid { grid-template-columns: 1fr; } .dlg-ring { display: none; } }
  .sec { padding: 16px 0 4px; }
  .sec-l { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); margin-bottom: 8px; }
  .rule-row { display: flex; gap: 10px; align-items: baseline; padding: 7px 0;
    border-top: 1px solid var(--line-soft); font-size: 12.5px; }
  .rule-row:first-of-type { border-top: 0; }
  .rule-src { margin-left: auto; font-size: 10.5px; color: var(--ink-3); flex-shrink: 0; }
  .vd { display: grid; gap: 9px; }
  .vd-row { display: grid; grid-template-columns: 112px 1fr 30px; gap: 12px; align-items: center; }
  .vd-row .lbl { font-size: 11.5px; color: var(--ink-2); }
  .vd-row .val { font-size: 11.5px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
  .meter { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
  .meter i { display: block; height: 100%; border-radius: 2px; background: var(--accent-hi); }
  .seal-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
  .seal { flex-shrink: 0; transform: rotate(-3deg); border: 1.5px solid var(--accent-hi);
    color: var(--accent-hi); font-size: 9.5px; font-weight: 800; letter-spacing: .18em;
    padding: 5px 10px; border-radius: 6px; opacity: .85; }
  .forensic { flex: 1; padding: 12px 14px; background: var(--inset); border: 1px solid var(--line-soft);
    border-radius: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
    line-height: 1.9; overflow-x: auto; white-space: nowrap; }
  .forensic b { color: var(--ink-2); font-weight: 500; }
  .dlg-foot { padding: 14px 28px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; align-items: center; }
  .dlg-foot .spacer { flex: 1; }
  .kv { display: grid; gap: 8px; font-size: 12.5px; }
  .kv div { display: flex; gap: 12px; }
  .kv span { color: var(--ink-3); min-width: 110px; }
  .kv b { font-weight: 550; }

  /* ── Ask Xybern palette ── */
  .ask { position: fixed; inset: 0; z-index: 60; display: none; justify-content: center;
    align-items: flex-start; padding: 96px 20px 20px; }
  .ask.on { display: flex; }
  .ask-box { width: 640px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column;
    background: var(--raised); border: 1px solid rgba(108,92,231,.35); border-radius: 14px;
    box-shadow: 0 32px 96px rgba(0,0,0,.65), 0 0 0 6px rgba(108,92,231,.06); overflow: hidden;
    animation: dlg-in .16s cubic-bezier(.3,.8,.3,1); }
  .ask-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft); }
  .ask-input-row .ask-spark { color: var(--accent-hi); }
  .ask-input { flex: 1; background: none; border: 0; outline: none; color: var(--ink); font-size: 14px; }
  .ask-input::placeholder { color: var(--ink-3); }
  .ask-list { padding: 8px; overflow-y: auto; }
  .ask-hint { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); padding: 8px 12px 4px; }
  .ask-item { display: block; width: 100%; text-align: left; border: 0; background: none;
    color: var(--ink-2); font-size: 13px; padding: 9px 12px; border-radius: 8px; }
  .ask-item:hover { background: var(--accent-wash); color: var(--ink); }
  .ask-answer { padding: 16px 20px 20px; border-top: 1px solid var(--line-soft); display: none; max-height: 52vh; overflow-y: auto; }
  .ask-answer.on { display: block; }
  .ask-a code { font-family: var(--mono); font-size: 11.5px; background: var(--inset); padding: 1px 5px; border-radius: 4px; color: var(--accent-hi); }
  .ask-a b { color: var(--ink); font-weight: 600; }
  .ask-q { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
  .ask-a { font-size: 13px; line-height: 1.7; color: var(--ink); max-width: 66ch; white-space: pre-line; }
  .ask-a b { color: var(--accent-hi); font-weight: 600; }
  .ask-acts { display: flex; gap: 8px; margin-top: 14px; }

  .toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 8px); z-index: 80;
    background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px;
    font-size: 12.5px; opacity: 0; transition: opacity .15s ease, transform .15s ease;
    pointer-events: none; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
  .toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ─────────────────────────────────────────────────────────────────────────
   Phase 10 · RTL (Arabic) mirroring + mobile layout
   The template sets dir="rtl" on <html> for ar_SA; these rules mirror the
   structural chrome that isn't handled by logical flow alone.
   ───────────────────────────────────────────────────────────────────────── */

/* ── RTL ── */
[dir="rtl"] .rail { border-right: none; border-left: 1px solid var(--line-soft); }
[dir="rtl"] .nav-item.active::before { left: auto; right: 0; }
[dir="rtl"] .dlg-head::before { left: auto; right: 0; }
[dir="rtl"] .dlg-x, [dir="rtl"] .panel-x { right: auto; left: 16px; }
[dir="rtl"] .dlg-ring { right: auto; left: 64px; }
[dir="rtl"] .seal { transform: rotate(3deg); }
[dir="rtl"] .pipe-step:not(:last-child)::after { content: '←'; right: auto; left: 8px; }
/* things pushed to the trailing edge with margin-left:auto need to flip */
[dir="rtl"] .nav-badge,
[dir="rtl"] .attn .go,
[dir="rtl"] .esc-top .when,
[dir="rtl"] .esc-foot .why,
[dir="rtl"] .strip .go,
[dir="rtl"] .rule-src,
[dir="rtl"] .view-head .actions,
[dir="rtl"] .charter-sig .t-mono,
[dir="rtl"] .filters .count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .kv span { margin-right: 0; }
[dir="rtl"] .search { text-align: right; }
[dir="rtl"] .codebox, [dir="rtl"] .forensic, [dir="rtl"] .t-mono { direction: ltr; text-align: left; }

/* ── Mobile ── */
.hamburger { display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); flex-shrink: 0; }
.hamburger:hover { color: var(--ink); }
.hamburger svg { width: 17px; height: 17px; }
.rail-scrim { display: none; }

@media (max-width: 820px) {
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 46; width: 250px;
    transform: translateX(-104%); transition: transform .2s ease;
    box-shadow: 24px 0 64px rgba(0,0,0,.55);
  }
  .app.rail-open .rail { transform: none; }
  [dir="rtl"] .rail { left: auto; right: 0; transform: translateX(104%); box-shadow: -24px 0 64px rgba(0,0,0,.55); }
  [dir="rtl"] .app.rail-open .rail { transform: none; }
  .rail-scrim { display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(5,4,10,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.rail-open .rail-scrim { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; }
  .kbd-hint { display: none; }
  .topbar { padding: 0 14px; gap: 8px; }
  .content { padding: 20px 15px 56px; }
  .view-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .view-head .actions { margin-left: 0; flex-wrap: wrap; }
  .stats, .coverage-row { grid-template-columns: 1fr 1fr; }
  .dlg { padding: 0; }
  .dlg-box { max-height: 100%; border-radius: 0; width: 100%; }
  .ask { padding: 64px 12px 12px; }
  .filters { flex-wrap: wrap; }
  .search { width: 100%; }
}

@media (max-width: 480px) {
  .stats, .coverage-row { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 17px; }
}
