/* ============================================================
   OPS CONSOLE — denser mode, same tokens
   ============================================================ */

.console { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - var(--header-h) - 32px); min-width: 0; }
@media (max-width: 899px) { .console { grid-template-columns: minmax(0, 1fr); } }

.console__nav {
  min-width: 0;
  border-inline-end: 1px solid var(--rule);
  background: var(--paper-3);
  padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
}
@media (max-width: 899px) {
  .console__nav {
    position: static; flex-direction: row; overflow-x: auto;
    border-inline-end: 0; border-block-end: 1px solid var(--rule);
    max-height: none; min-width: 0; scrollbar-width: none;
  }
  .console__nav::-webkit-scrollbar { display: none; }
  .console__i { flex: none; }
}
.console__label {
  font-size: var(--t-2xs); font-weight: 700; letter-spacing: var(--ls-caps);
  text-transform: uppercase; color: var(--ink-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}
@media (max-width: 899px) { .console__label { display: none; } }
.console__i {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  font-size: var(--t-sm); color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: all var(--dur-1) var(--ease-out);
}
.console__i svg { width: 16px; height: 16px; flex: none; }
.console__i:hover { background: var(--paper-2); color: var(--ink); }
.console__i[aria-current="page"] { background: var(--ink); color: var(--ink-inv); font-weight: 600; }
.console__n {
  margin-inline-start: auto; font-family: var(--font-mono); font-size: 10px;
  background: var(--signal); color: var(--signal-ink);
  padding: 1px 5px; border-radius: var(--r-pill); font-weight: 700;
}
.console__i[aria-current="page"] .console__n { background: var(--signal); }

.console__main { padding: var(--sp-5) var(--gutter) var(--sp-8); min-width: 0; }
.console-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-block-end: var(--sp-5); }
.console-head h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.console-head p { font-size: var(--t-sm); color: var(--ink-2); max-width: 62ch; margin-block-start: var(--sp-2); }

/* ---- KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--sp-3); }
.kpi { border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--sp-4); background: var(--paper-2); }
.kpi__l { font-size: var(--t-2xs); letter-spacing: var(--ls-caps-sm); text-transform: uppercase; color: var(--ink-3); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.kpi__l svg { width: 12px; height: 12px; }
.kpi__v { display: block; font-family: var(--font-display); font-size: 2rem; letter-spacing: -0.03em; line-height: 1.05; margin-block: var(--sp-2) 3px; }
.kpi__d { display: block; font-size: var(--t-xs); color: var(--ink-3); line-height: 1.45; }
.kpi__d b { font-weight: 600; }
.kpi--ok .kpi__v { color: var(--ok); }
.kpi--warn .kpi__v { color: var(--warn); }
.kpi--bad .kpi__v { color: var(--bad); }

/* ---- JSON viewer ---- */
.json {
  min-width: 0;
  font-family: var(--font-mono); font-size: var(--t-2xs); line-height: 1.65;
  background: var(--paper-3); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: var(--sp-4); overflow: auto; max-height: 460px; white-space: pre;
  direction: ltr;
}
.json .k { color: var(--info); }
.json .s { color: var(--ok); }
.json .n { color: var(--signal-2); }
.json .b { color: var(--gold); }
.json .p { color: var(--ink-3); }
.json mark { background: var(--warn-tint); color: inherit; padding: 0 2px; border-radius: 2px; outline: 1px solid var(--warn); }
:root[data-theme="dark"] .json .n { color: var(--signal); }

/* ---- field map ---- */
.fieldmap { width: 100%; border-collapse: collapse; font-size: var(--t-xs); }
.fieldmap th {
  text-align: start; font-size: var(--t-2xs); letter-spacing: var(--ls-caps-sm);
  text-transform: uppercase; color: var(--ink-3); background: var(--paper-3);
  padding: var(--sp-3); border-block-end: 1px solid var(--rule); white-space: nowrap;
}
.fieldmap td { padding: var(--sp-3); border-block-end: 1px solid var(--rule); vertical-align: top; }
.fieldmap tr[data-risk="high"] { background: var(--warn-tint); }
.fieldmap tr[data-risk="high"] td { border-block-end-color: color-mix(in oklab, var(--warn) 30%, transparent); }
:root[data-theme="dark"] .fieldmap tr[data-risk="high"] { color: var(--ink); }
.fieldmap .fm-src, .fieldmap .fm-dst { font-family: var(--font-mono); word-break: break-all; direction: ltr; }
.fieldmap .fm-dst { color: var(--brand-2); font-weight: 500; }
.fieldmap .fm-val { color: var(--ink-2); max-width: 300px; word-break: break-word; }
.xform {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: var(--ls-caps-sm); text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-xs); white-space: nowrap;
}
.xform--direct { background: var(--paper-4); color: var(--ink-3); }
.xform--cast   { background: var(--info-tint); color: var(--info); }
.xform--flat   { background: var(--warn-tint); color: var(--warn); }
.xform--child  { background: var(--brand-tint); color: var(--brand); }
.xform--drop   { background: var(--bad-tint); color: var(--bad); }
:root[data-theme="dark"] .xform--child { color: var(--brand-2); }

/* ---- match score ---- */
.score { display: flex; align-items: center; gap: var(--sp-3); }
.score__bar { width: 84px; height: 6px; background: var(--paper-4); border-radius: 3px; overflow: hidden; flex: none; }
.score__fill { height: 100%; border-radius: 3px; }
.score__n { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 700; }
.score[data-band="auto"]   .score__fill { background: var(--ok); }
.score[data-band="review"] .score__fill { background: var(--warn); }
.score[data-band="new"]    .score__fill { background: var(--info); }
.score[data-band="auto"]   .score__n { color: var(--ok); }
.score[data-band="review"] .score__n { color: var(--warn); }
.score[data-band="new"]    .score__n { color: var(--info); }

/* ---- side-by-side compare ---- */
.compare { display: grid; grid-template-columns: 148px minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; font-size: var(--t-xs); }
@media (max-width: 767px) { .compare { grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr); } }
.compare > * { padding: var(--sp-3); border-block-end: 1px solid var(--rule); min-width: 0; }
.compare__h { background: var(--paper-3); font-weight: 700; font-size: var(--t-2xs); letter-spacing: var(--ls-caps-sm); text-transform: uppercase; color: var(--ink-3); }
.compare__k { background: var(--paper-3); font-weight: 600; color: var(--ink-2); }
.compare__v { font-family: var(--font-mono); word-break: break-word; direction: ltr; }
.compare__v[data-diff="true"] { background: var(--warn-tint); }
:root[data-theme="dark"] .compare__v[data-diff="true"] { color: var(--ink); }
.compare > *:nth-last-child(-n+3) { border-block-end: 0; }

/* ---- budget meter ---- */
.meter { display: flex; flex-direction: column; gap: var(--sp-2); }
.meter__track { height: 26px; background: var(--paper-4); border-radius: var(--r-sm); overflow: hidden; display: flex; }
.meter__seg { height: 100%; transition: width var(--dur-4) var(--ease-out); position: relative; }
.meter__seg[data-tier="essentials"] { background: var(--brand-3); }
.meter__seg[data-tier="pro"]        { background: var(--brand); }
.meter__seg[data-tier="enterprise"] { background: var(--signal); }
.meter__legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--t-xs); }
.meter__key { display: inline-flex; align-items: center; gap: 6px; }
.meter__dot { width: 9px; height: 9px; border-radius: 2px; }

/* ---- toggle ---- */
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--t-sm); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 21px; border-radius: var(--r-pill); flex: none;
  background: var(--rule-2); position: relative;
  transition: background var(--dur-2) var(--ease-out);
}
.switch__track::after {
  content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--paper-2);
  transition: transform var(--dur-2) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(17px); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-17px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---- schedule rows ---- */
.sched { display: grid; grid-template-columns: minmax(0, 1fr) 118px 118px 92px auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-block-end: 1px solid var(--rule); font-size: var(--t-sm); }
.sched:last-child { border: 0; }
@media (max-width: 899px) { .sched { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.sched__t { font-weight: 600; display: block; }
.sched__d { font-size: var(--t-xs); color: var(--ink-3); display: block; margin-block-start: 2px; line-height: 1.4; }

/* ---- taxonomy tree ---- */
.tree { font-size: var(--t-sm); }
.tree__cat { border: 1px solid var(--rule); border-radius: var(--r-md); margin-block-end: var(--sp-3); overflow: hidden; background: var(--paper-2); }
.tree__cath { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--paper-3); cursor: pointer; }
.tree__cath h3 { font-size: var(--t-sm); font-weight: 600; }
.tree__sub { display: grid; grid-template-columns: minmax(0, 1fr) 200px 90px auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-block-start: 1px solid var(--rule); }
@media (max-width: 767px) { .tree__sub { grid-template-columns: minmax(0, 1fr) auto; } }
.tree__gt { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--ink-3); direction: ltr; }
.tree__cat[data-open="false"] .tree__sub { display: none; }

/* ---- run log ---- */
.log { min-width: 0; font-family: var(--font-mono); font-size: var(--t-2xs); line-height: 1.8; background: var(--paper-3); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: var(--sp-4); max-height: 300px; overflow: auto; direction: ltr; }
.log__t { color: var(--ink-3); }
.log__ok { color: var(--ok); }
.log__warn { color: var(--warn); }
.log__bad { color: var(--bad); }
.log__info { color: var(--info); }

/* ---- queue + detail split ---- */
.split-queue { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 1023px) { .split-queue { grid-template-columns: minmax(0, 1fr); } }
