/* ==========================================================================
   OpsPulse Live — ServiceDesk (CSM) + OpsPulse (decision engine)
   --------------------------------------------------------------------------
   Both apps are mounted as components, so every layout rule is written against
   the app's OWN width via container queries — not the viewport. That is what
   lets the same code render full-screen standalone and side-by-side in the
   split "Live Ops Floor" without a second stylesheet.
   ========================================================================== */

.op-root, .sd-root { container-type: inline-size; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
/* The toolbar is a fixed band, never a flex child that grows. Stating it here
   means a host page's own `> *` sizing rule can't stretch it. */
.op-root > .lv-top, .sd-root > .lv-top { flex: 0 0 auto; }

/* ── Shared chrome ───────────────────────────────────────────────────────── */
.lv-top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 24, .82); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.lv-top .lv-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; font-size: .98rem; }
.lv-top .lv-brand .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.lv-top .lv-brand .dot svg { width: 16px; height: 16px; }
.lv-spacer { margin-left: auto; }

.lv-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.lv-nav button {
  background: transparent; border: 1px solid transparent; color: var(--text-soft);
  font: inherit; font-size: .84rem; font-weight: 500; padding: 6px 11px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 7px; transition: background .15s, color .15s;
}
.lv-nav button svg { width: 15px; height: 15px; }
.lv-nav button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.lv-nav button.on { background: rgba(52,211,153,.12); color: var(--emerald); border-color: rgba(52,211,153,.2); }
.lv-nav .badge { font-size: .68rem; font-weight: 700; background: rgba(251,113,133,.2); color: var(--danger); padding: 0 6px; border-radius: 20px; }

.lv-live { display: flex; align-items: center; gap: 7px; font-size: .74rem; color: var(--text-dim); white-space: nowrap; }
.lv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.55); animation: lvpulse 2s infinite; flex: none; }
.lv-dot.off { background: var(--text-dim); animation: none; box-shadow: none; }
@keyframes lvpulse { 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

.lv-btn {
  background: rgba(255,255,255,.05); border: 1px solid var(--line-strong); color: var(--text-soft);
  font: inherit; font-size: .78rem; font-weight: 600; padding: 5px 11px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, border-color .15s;
}
.lv-btn:hover { background: rgba(255,255,255,.09); color: var(--text); }
.lv-btn.primary { background: var(--grad); color: #04120c; border-color: transparent; }
.lv-btn.primary:hover { filter: brightness(1.08); }
.lv-btn svg { width: 14px; height: 14px; }
.lv-btn:disabled { opacity: .45; cursor: not-allowed; }

.lv-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 20px 60px; min-height: 0; }
.lv-view[hidden] { display: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 14px; }
.panel-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015);
}
.panel-hd h3 { margin: 0; font-size: .92rem; letter-spacing: -.01em; }
.panel-hd .hint { color: var(--text-dim); font-size: .76rem; margin-left: auto; }
.panel-bd { padding: 16px; }
.panel-bd.tight { padding: 0; }

.muted { color: var(--text-dim); }
.soft { color: var(--text-soft); }
.tnum { font-variant-numeric: tabular-nums; }

/* ── Hero: the 9am answer ────────────────────────────────────────────────── */
.op-hero {
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
  background: linear-gradient(135deg, rgba(34,211,238,.09), rgba(52,211,153,.05) 45%, transparent 75%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.op-hero h2 { margin: 0 0 4px; font-size: 1.32rem; letter-spacing: -.025em; line-height: 1.25; }
.op-hero .when { color: var(--text-dim); font-size: .8rem; }
.op-hero .lede { color: var(--text-soft); font-size: .88rem; margin: 8px 0 0; max-width: 62ch; }
.op-gauge { display: flex; align-items: center; gap: 14px; }
.op-gauge .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.op-gauge .delta { font-size: .82rem; font-weight: 700; margin-top: 3px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--text-dim); }

/* ── Top-3 risk cards ────────────────────────────────────────────────────── */
.top3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.risk-card {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm); padding: 14px 15px; cursor: pointer; position: relative;
  transition: border-color .16s, transform .16s, background .16s; display: flex; flex-direction: column; gap: 9px;
}
.risk-card:hover { background: var(--panel-2); border-color: var(--line-strong); transform: translateY(-2px); }
.risk-card.sev-med { border-left-color: var(--warn); }
.risk-card.sev-low { border-left-color: var(--info); }
.risk-card .rank { position: absolute; top: 12px; right: 13px; font-size: .68rem; font-weight: 800; color: var(--text-dim); letter-spacing: .08em; }
.risk-card h4 { margin: 0; font-size: .96rem; letter-spacing: -.015em; padding-right: 28px; line-height: 1.3; }
.risk-card .metric { font-size: .78rem; font-weight: 700; color: var(--warn); font-variant-numeric: tabular-nums; }
.risk-card dl { margin: 0; display: grid; gap: 7px; }
.risk-card dt { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 1px; }
.risk-card dd { margin: 0; font-size: .8rem; color: var(--text-soft); line-height: 1.45; }
.risk-card .money { font-size: .92rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.risk-card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.conf { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--text-dim); white-space: nowrap; }
.conf .bar { width: 46px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; flex: none; }
.conf .bar i { display: block; height: 100%; border-radius: 3px; background: var(--grad); }
.conf b { color: var(--text-soft); font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line-strong); color: var(--text-dim); white-space: nowrap;
}
.chip.hi { background: rgba(208,59,59,.14); border-color: rgba(208,59,59,.3); color: #ff9c9c; }
.chip.md { background: rgba(250,178,25,.13); border-color: rgba(250,178,25,.28); color: #ffd27a; }
.chip.ok { background: rgba(12,163,12,.14); border-color: rgba(12,163,12,.3); color: #7ee07e; }
.chip.info { background: rgba(57,135,229,.14); border-color: rgba(57,135,229,.3); color: #9ec5f4; }
.chip.held { background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.32); color: #c4b5fd; }

/* ── KPI strip ───────────────────────────────────────────────────────────── */
.kpi-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; cursor: pointer; transition: background .15s, border-color .15s; min-width: 0;
}
.kpi:hover { background: var(--panel-2); border-color: var(--line-strong); }
.kpi .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.kpi .v { font-size: 1.34rem; font-weight: 800; letter-spacing: -.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: .72rem; font-weight: 600; }
.kpi .viz-spark { width: 100%; height: 26px; margin-top: 4px; opacity: .85; }

/* ── Two-column content ─────────────────────────────────────────────────── */
.cols2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
.cols2 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── Briefing ───────────────────────────────────────────────────────────── */
.brief-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.brief-lines li { display: flex; gap: 10px; font-size: .87rem; color: var(--text-soft); line-height: 1.55; }
.brief-lines li::before { content: ""; width: 3px; border-radius: 2px; background: var(--grad); flex: none; }
.opps { display: grid; gap: 9px; }
.opp {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
  transition: background .15s, border-color .15s; background: rgba(12,163,12,.05); border-left: 3px solid var(--ok);
}
.opp:hover { background: rgba(12,163,12,.1); border-color: rgba(12,163,12,.3); }
.opp .t { font-size: .83rem; font-weight: 700; }
.opp .s { font-size: .76rem; color: var(--text-dim); margin-top: 2px; line-height: 1.45; }

/* ── Decision feed ──────────────────────────────────────────────────────── */
.feed-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { background: transparent; border: 0; color: var(--text-dim); font: inherit; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: rgba(255,255,255,.09); color: var(--text); }
.lv-search { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px; flex: 1; min-width: 150px; }
.lv-search input { background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: .82rem; width: 100%; }
.lv-search svg { width: 14px; height: 14px; flex: none; color: var(--text-dim); }

.feed { display: grid; gap: 9px; }
.feed-row {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; transition: background .15s, border-color .15s;
}
.feed-row:hover, .feed-row.on { background: var(--panel-2); border-color: var(--line-strong); }
.feed-row .sev { text-align: center; }
.feed-row .sev b { display: block; font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.feed-row .sev small { font-size: .58rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); }
.feed-row .ttl { font-size: .9rem; font-weight: 700; letter-spacing: -.01em; }
.feed-row .sub { font-size: .78rem; color: var(--text-dim); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.feed-row .right { text-align: right; }
.feed-row .right .m { font-size: .88rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.feed-row .right .h { font-size: .7rem; color: var(--text-dim); }

/* ── Insight explorer (the four questions) ──────────────────────────────── */
.q-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qbox { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; background: rgba(255,255,255,.015); }
.qbox h5 { margin: 0 0 6px; font-size: .66rem; text-transform: uppercase; letter-spacing: .11em; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.qbox p { margin: 0; font-size: .85rem; line-height: 1.55; color: var(--text-soft); }
.qbox .big { font-size: 1.22rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.evidence { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.evidence li { display: flex; gap: 8px; align-items: flex-start; font-size: .79rem; color: var(--text-soft); line-height: 1.45; }
.evidence .mark { width: 15px; height: 15px; border-radius: 4px; display: grid; place-items: center; flex: none; margin-top: 1px; font-size: 10px; font-weight: 800; }
.evidence .mark.y { background: rgba(12,163,12,.2); color: #7ee07e; }
.evidence .mark.n { background: rgba(255,255,255,.07); color: var(--text-dim); }
.evidence .det { color: var(--text-dim); }

.math { background: rgba(0,0,0,.28); border: 1px dashed var(--line-strong); border-radius: 9px; padding: 10px 12px; margin-top: 10px; }
.math .f { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: var(--cyan); word-break: break-word; }
.math ul { margin: 8px 0 0; padding-left: 16px; display: grid; gap: 3px; }
.math li { font-size: .76rem; color: var(--text-dim); line-height: 1.45; }
.math .caveat { margin-top: 8px; font-size: .75rem; color: var(--warn); line-height: 1.45; }

.steps { counter-reset: s; list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; }
.steps li { counter-increment: s; display: flex; gap: 9px; font-size: .81rem; color: var(--text-soft); line-height: 1.45; }
.steps li::before {
  content: counter(s); flex: none; width: 18px; height: 18px; border-radius: 5px; margin-top: 1px;
  background: rgba(255,255,255,.07); color: var(--text-dim); font-size: .66rem; font-weight: 800;
  display: grid; place-items: center;
}
.act-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Risk radar ─────────────────────────────────────────────────────────── */
.radar-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: center; }
.viz-radar { width: 100%; max-width: 320px; height: auto; }
.dim-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dim-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; cursor: pointer; transition: background .15s, border-color .15s; background: var(--panel); }
.dim-card:hover { background: var(--panel-2); border-color: var(--line-strong); }
.dim-card .top { display: flex; align-items: baseline; gap: 8px; }
.dim-card h4 { margin: 0; font-size: .9rem; }
.dim-card .score { margin-left: auto; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dim-card .hint { font-size: .76rem; color: var(--text-dim); margin: 4px 0 10px; line-height: 1.4; }
.drv { display: grid; gap: 7px; }
.drv-row { display: grid; grid-template-columns: 1fr 76px 54px; gap: 8px; align-items: center; font-size: .77rem; }
.drv-row .n { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drv-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.drv-meter { height: 5px; border-radius: 3px; background: rgba(255,255,255,.09); overflow: hidden; }
.drv-meter i { display: block; height: 100%; border-radius: 3px; }

/* ── Copilot ────────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; height: min(620px, 74vh); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.msg { display: grid; gap: 6px; max-width: 92%; }
.msg.me { justify-self: end; }
.msg .who { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.msg .bubble { background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; padding: 11px 14px; font-size: .87rem; line-height: 1.6; color: var(--text-soft); }
.msg.me .bubble { background: rgba(52,211,153,.11); border-color: rgba(52,211,153,.22); color: var(--text); }
.msg .bubble strong { color: var(--text); }
.msg .bubble ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 5px; }
.msg .bubble .src { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: .73rem; color: var(--text-dim); }
.msg .acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 2px; }
.chat-ask { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-ask input { flex: 1; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--text); font: inherit; font-size: .86rem; outline: 0; }
.chat-ask input:focus { border-color: rgba(52,211,153,.4); }
.suggest { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px 12px; }
.suggest button { background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--text-soft); font: inherit; font-size: .77rem; padding: 5px 10px; border-radius: 20px; cursor: pointer; }
.suggest button:hover { background: rgba(255,255,255,.08); color: var(--text); }

/* ── Data upload ────────────────────────────────────────────────────────── */
.drop {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 30px 20px; text-align: center;
  transition: border-color .16s, background .16s; cursor: pointer; background: rgba(255,255,255,.012);
}
.drop.hot { border-color: var(--emerald); background: rgba(52,211,153,.07); }
.drop h4 { margin: 10px 0 4px; font-size: 1rem; }
.drop p { margin: 0; color: var(--text-dim); font-size: .82rem; }
.drop svg { width: 34px; height: 34px; color: var(--text-dim); }
.src-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.src-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; background: rgba(255,255,255,.015); }
.src-card .t { font-size: .84rem; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.src-card .c { font-size: 1.2rem; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; }
.src-card .s { font-size: .74rem; color: var(--text-dim); margin-top: 2px; }
.map-table { width: 100%; border-collapse: collapse; font-size: .78rem; margin-top: 10px; }
.map-table th, .map-table td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line); }
.map-table th { color: var(--text-dim); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.map-table code { color: var(--cyan); font-size: .76rem; }

/* ── Ticker ─────────────────────────────────────────────────────────────── */
.ticker { display: grid; gap: 1px; max-height: 320px; overflow-y: auto; }
.tick-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 9px; align-items: center; padding: 7px 10px; border-radius: 7px; font-size: .78rem; animation: slidein .35s ease; }
.tick-row:hover { background: rgba(255,255,255,.035); }
.tick-row .ic { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex: none; font-size: 9px; font-weight: 800; }
.tick-row .tx { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tick-row .tm { color: var(--text-dim); font-size: .7rem; white-space: nowrap; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ic.t { background: rgba(57,135,229,.2); color: #9ec5f4; }
.ic.r { background: rgba(12,163,12,.2); color: #7ee07e; }
.ic.e { background: rgba(208,59,59,.2); color: #ff9c9c; }
.ic.n { background: rgba(213,81,129,.2); color: #f0a9c2; }
.ic.q { background: rgba(201,133,0,.22); color: #ffd27a; }
.ic.u { background: rgba(139,92,246,.2); color: #c4b5fd; }

/* ── ServiceDesk ────────────────────────────────────────────────────────── */
.sd-root { background: #0a0f1c; }
/* `grid-template-rows: minmax(0,1fr)` plus min-height:0 on the items is what
   lets the inner scrollers actually scroll: grid items default to
   min-height:auto, so without this the table refuses to shrink below its full
   10,000-row height and pushes the whole layout out of the viewport. */
.sd-layout { display: grid; grid-template-columns: 198px 1fr; grid-template-rows: minmax(0, 1fr); flex: 1; min-height: 0; }
.sd-side, .sd-main { min-height: 0; }
.sd-side { border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sd-side .lbl { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); padding: 12px 9px 5px; white-space: nowrap; }
.sd-side button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text-soft); font: inherit; font-size: .82rem;
  padding: 7px 9px; border-radius: 7px; cursor: pointer; min-width: 0;
}
/* Sizing these is not optional. An unconstrained inline SVG in a flex row
   takes its intrinsic size, which rendered the rail icons enormous and forced
   every label onto two or three lines. */
.sd-side button svg { width: 16px; height: 16px; flex: none; }
.sd-side button .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-side button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sd-side button.on { background: rgba(57,135,229,.14); color: #9ec5f4; }
.sd-side button .n { flex: none; font-size: .7rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sd-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.sd-tools { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
/* overflow-x matters in the split view: the pane is narrower than the table,
   and without it the right-hand columns are silently clipped rather than
   reachable. min-width keeps the columns from crushing into each other. */
.sd-scroll { flex: 1; overflow-y: auto; overflow-x: auto; min-height: 0; }
.sd-scroll .sd-table { min-width: 560px; }

.sd-table { width: 100%; border-collapse: collapse; font-size: .79rem; }
.sd-table th {
  position: sticky; top: 0; z-index: 2; background: #0d1424; text-align: left; padding: 8px 12px;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
/* Kept tight on purpose: a queue is scanned, not read. Loosening these by a
   few pixels costs two visible tickets per screen. */
.sd-table td { padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: top; line-height: 1.4; }
.sd-table tr { cursor: pointer; }
.sd-table tbody tr:hover { background: rgba(255,255,255,.035); }
.sd-table tr.fresh { animation: flashrow 2.4s ease; }
@keyframes flashrow { 0% { background: rgba(52,211,153,.18); } 100% { background: transparent; } }
.sd-table .id { font-family: ui-monospace, Menlo, monospace; font-size: .73rem; color: var(--text-dim); white-space: nowrap; }
.sd-table .subj { color: var(--text); font-weight: 500; display: block; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-table .co { color: var(--text-dim); font-size: .72rem; display: block; line-height: 1.35; }
/* Relative ages must never wrap — "0s ago" on two lines makes every row in the
   queue taller than it needs to be. */
.sd-table .nw { white-space: nowrap; }
.pill { display: inline-block; font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.pill.Critical { background: rgba(208,59,59,.2); color: #ff9c9c; }
.pill.High { background: rgba(236,131,90,.2); color: #f5b394; }
.pill.Medium { background: rgba(250,178,25,.16); color: #ffd27a; }
.pill.Low { background: rgba(255,255,255,.07); color: var(--text-dim); }
.pill.Open { background: rgba(57,135,229,.18); color: #9ec5f4; }
.pill.Resolved, .pill.Closed { background: rgba(12,163,12,.16); color: #7ee07e; }
.pill.Pending { background: rgba(201,133,0,.18); color: #ffd27a; }
.pill.P1 { background: rgba(208,59,59,.22); color: #ff9c9c; }
.pill.P2 { background: rgba(236,131,90,.2); color: #f5b394; }
.pill.P3 { background: rgba(255,255,255,.07); color: var(--text-dim); }
.warnflag { color: var(--danger); font-weight: 700; }

.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--text-dim); }
.pager .lv-btn { padding: 3px 9px; font-size: .74rem; }

.sd-detail { border-top: 1px solid var(--line); background: var(--panel); padding: 14px 16px; max-height: 46%; overflow-y: auto; flex: none; }
.sd-detail h4 { margin: 0 0 2px; font-size: .95rem; }
.sd-detail .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.sd-detail .desc { font-size: .84rem; color: var(--text-soft); line-height: 1.6; background: rgba(255,255,255,.025); border-left: 2px solid var(--line-strong); padding: 9px 12px; border-radius: 0 8px 8px 0; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.kv > div { background: rgba(255,255,255,.02); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kv dt { font-size: .63rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); }
.kv dd { margin: 3px 0 0; font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Drill-down modal ───────────────────────────────────────────────────── */
.drill { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 22px; }
.drill[hidden] { display: none; }
.drill .scrim { position: absolute; inset: 0; background: rgba(3,6,14,.78); backdrop-filter: blur(4px); }
.drill-panel {
  position: relative; width: min(1080px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow);
}
.drill-hd { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: rgba(14,20,37,.97); backdrop-filter: blur(8px); }
.drill-hd h3 { margin: 0; font-size: 1.06rem; letter-spacing: -.02em; }
.drill-hd p { margin: 3px 0 0; font-size: .8rem; color: var(--text-dim); max-width: 78ch; line-height: 1.5; }
.drill-x { margin-left: auto; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--text-soft); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1; flex: none; }
.drill-x:hover { background: rgba(255,255,255,.12); color: var(--text); }
.drill-bd { padding: 18px 20px 26px; display: grid; gap: 16px; }
.drill-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.drill-kpis > div { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.drill-kpis .k { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); }
.drill-kpis .v { font-size: 1.28rem; font-weight: 800; margin-top: 3px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drill-kpis .s { font-size: .72rem; color: var(--text-dim); margin-top: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > * { min-width: 0; }

.dtable { width: 100%; border-collapse: collapse; font-size: .78rem; }
.dtable th { text-align: left; padding: 7px 10px; color: var(--text-dim); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.dtable td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.04); }
.dtable tbody tr:hover { background: rgba(255,255,255,.03); }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.viz { margin: 0; background: rgba(255,255,255,.015); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; min-width: 0; }
.viz-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }
.viz-title { font-size: .86rem; font-weight: 700; letter-spacing: -.01em; }
.viz-sub { font-size: .74rem; color: var(--text-dim); }
.viz-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px; }
.viz-key { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-soft); }
.viz-key i { width: 9px; height: 9px; border-radius: 2.5px; flex: none; }
.viz-body { margin-top: 4px; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-note { margin: 8px 0 0; font-size: .74rem; color: var(--text-dim); line-height: 1.45; }
.viz-table-btn { margin-top: 8px; background: transparent; border: 0; color: var(--text-dim); font: inherit; font-size: .73rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.viz-table-btn:hover { color: var(--text-soft); }
.viz-table { margin-top: 8px; max-height: 220px; overflow: auto; }
.viz-table table { width: 100%; border-collapse: collapse; font-size: .74rem; }
.viz-table th { position: sticky; top: 0; background: var(--panel-2); text-align: left; padding: 5px 8px; color: var(--text-dim); font-weight: 600; }
.viz-table td { padding: 5px 8px; border-top: 1px solid rgba(255,255,255,.05); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.viz-tip {
  position: fixed; z-index: 999; pointer-events: none; background: #131b30; border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 8px 11px; font-size: .77rem; color: var(--text); box-shadow: 0 12px 32px -10px rgba(0,0,0,.8); max-width: 280px;
}
.viz-tip strong { display: block; margin-bottom: 5px; font-size: .8rem; }
.viz-tip .tk { display: flex; align-items: center; gap: 7px; color: var(--text-soft); margin-top: 3px; }
.viz-tip .tk i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.viz-tip .tk b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.viz-tip .tk-total { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 8px; justify-items: end; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--emerald);
  border-radius: 10px; padding: 9px 13px; font-size: .82rem; box-shadow: var(--shadow); animation: slidein .3s ease; max-width: 330px;
}
.toast b { display: block; font-size: .8rem; }
.toast small { color: var(--text-dim); font-size: .74rem; }

/* ── Empty / loading ────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 34px 20px; color: var(--text-dim); font-size: .85rem; }
.empty svg { width: 30px; height: 30px; opacity: .5; margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════════════════════════
   Container queries — the app reflows on ITS OWN width, so the split view
   works without a separate stylesheet.
   ══════════════════════════════════════════════════════════════════════════ */
@container (max-width: 1080px) {
  .top3 { grid-template-columns: 1fr 1fr; }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .radar-wrap { grid-template-columns: 260px 1fr; }
  .drill-kpis { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: repeat(2, 1fr); }
}
@container (max-width: 820px) {
  .cols2 { grid-template-columns: 1fr; }
  .top3 { grid-template-columns: 1fr; }
  .q-grid { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .dim-grid { grid-template-columns: 1fr; }
  .radar-wrap { grid-template-columns: 1fr; justify-items: center; }
  .src-grid { grid-template-columns: 1fr; }
  /* Side-by-side: the rail must still fit "SLA breached" plus its count on one
     line, so it gets slightly tighter type rather than an ellipsis. */
  .sd-layout { grid-template-columns: 174px 1fr; }
  .sd-side button { font-size: .77rem; padding: 6px 8px; gap: 7px; }
  .sd-side button .n { font-size: .67rem; }
  .sd-table .c-md { display: none; }
  /* Subject is the widest cell; without trimming it here the table still
     overruns the pane even after two columns are dropped. */
  .sd-table .subj { max-width: 24ch; }
  .sd-table td, .sd-table th { padding-left: 9px; padding-right: 9px; }
  .lv-body { padding: 14px 13px 50px; }
  .lv-top { padding: 10px 13px; }
  .op-hero { grid-template-columns: 1fr; }
  .op-hero h2 { font-size: 1.1rem; }
}
@container (max-width: 560px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .sd-layout { grid-template-columns: 1fr; }
  .sd-side { display: none; }
  .sd-table .c-sm { display: none; }
  .drill-kpis { grid-template-columns: 1fr 1fr; }
}
