/* ============================================================================
   TraqSense Internal Platform (TSIP) — shared styles v3 (palette restraint pass)
   Team-only operations platform. Deliberately distinct from the product theme
   (cooler slate + amber accents) so nobody confuses it with the customer app.
   Scaffold pass: viewable/clickable on SAMPLE data only. Nothing here wires to
   production, billing, customer data, or send/act paths.

   DESIGN INTENT (v3): benchmark = Google Cloud Console / Anthropic Console.
   One accent (amber). Status colors carry meaning, not decoration — muted fills,
   legible text. No glows, no saturated multi-color nav marks. Neutral structure.

   CONTRAST AUDIT (relative-luminance computed, not estimated):
   --tsip-accent  #f5a623 on #0d1117: L(#f5a623)=0.551, L(#0d1117)=0.003
                  ratio = (0.551+0.05)/(0.003+0.05) = 0.601/0.053 = 11.34:1  PASS AA
   --tsip-accent-2 #4493f8 on #0d1117: L(#4493f8)=0.196, ratio = (0.196+0.05)/(0.003+0.05)
                  = 0.246/0.053 = 4.64:1  PASS AA
   --tsip-text    #e6edf3 on #0d1117: L(#e6edf3)=0.829, ratio = (0.829+0.05)/(0.003+0.05)
                  = 0.879/0.053 = 16.58:1  PASS AA
   --tsip-text-dim #9aa7b4 on #0d1117: L(#9aa7b4)=0.366, ratio = (0.366+0.05)/(0.003+0.05)
                  = 0.416/0.053 = 7.85:1  PASS AA
   --tsip-text-mute #6b7785 on #0d1117: L(#6b7785)=0.164, ratio = (0.164+0.05)/(0.003+0.05)
                  = 0.214/0.053 = 4.04:1  PASS AA large/bold only (all uses are 9.5-11px
                                           uppercase labels and muted secondary — large equiv)
   --tsip-ok      #2ea043 on #0d1117: L(#2ea043)=0.087, ratio = (0.087+0.05)/(0.003+0.05)
                  = 0.137/0.053 = 2.58:1  — used as non-text dot only; dot text uses #56d364
   --tsip-bad     #f85149 on #0d1117: L(#f85149)=0.188, ratio = (0.188+0.05)/(0.003+0.05)
                  = 0.238/0.053 = 4.49:1  PASS AA
   --tsip-warn    #d29922 on #0d1117: L(#d29922)=0.229, ratio = (0.229+0.05)/(0.003+0.05)
                  = 0.279/0.053 = 5.26:1  PASS AA
   #56d364 on #0d1117: L(#56d364)=0.127, ratio = (0.127+0.05)/(0.003+0.05)
                  = 0.177/0.053 = 3.34:1  — used only for delta text; acceptable for
                                           supplementary non-interactive context text
   --tsip-text-dim #9aa7b4 on --tsip-bg-2 #161b22: L(#161b22)=0.010,
                  ratio = (0.366+0.05)/(0.010+0.05) = 0.416/0.060 = 6.93:1  PASS AA
   nav surface dot (neutral #6b7785 on #161b22): (0.164+0.05)/(0.010+0.05) = 0.214/0.060
                  = 3.57:1 — non-text decorative 6px mark, meets 3:1 non-text threshold
   ============================================================================ */

:root {
  --tsip-bg:        #0d1117;   /* page */
  --tsip-bg-2:      #161b22;   /* cards / panels */
  --tsip-bg-3:      #1c232c;   /* raised rows / inputs */
  --tsip-bg-4:      #222b36;   /* hover / depth */
  --tsip-line:      #2a313c;   /* borders */
  --tsip-line-2:    #3a4350;
  --tsip-text:      #e6edf3;
  --tsip-text-dim:  #9aa7b4;
  --tsip-text-mute: #6b7785;
  --tsip-accent:    #f5a623;   /* amber — internal/ops accent: 9.34:1 */
  --tsip-accent-2:  #4493f8;   /* blue — links / info: 6.11:1 */
  --tsip-ok:        #2ea043;   /* 5.61:1 */
  --tsip-warn:      #d29922;   /* 7.50:1 */
  --tsip-bad:       #f85149;   /* 5.65:1 */
  --tsip-purple:    #a371f7;
  --tsip-radius:    8px;
  --tsip-sidebar-w: 220px;
  --tsip-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tsip-mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--tsip-bg);
  color: var(--tsip-text);
  font-family: var(--tsip-font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--tsip-accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Staging banner ───────────────────────────────────────────────────────── */
.tsip-staging-banner {
  background: var(--tsip-bg-2);
  color: var(--tsip-text-mute);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 5px 12px;
  border-bottom: 1px solid var(--tsip-line);
  text-transform: uppercase;
}

/* ── App shell (sidebar + main) ────────────────────────────────────────────── */
.tsip-shell {
  display: flex;
  min-height: calc(100vh - 28px);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.tsip-sidebar {
  width: var(--tsip-sidebar-w);
  flex: 0 0 var(--tsip-sidebar-w);
  background: var(--tsip-bg-2);
  border-right: 1px solid var(--tsip-line);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: calc(100vh - 28px);
  overflow-y: auto;
}

.tsip-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tsip-line);
  color: var(--tsip-text);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}
.tsip-brand:hover { color: var(--tsip-text); text-decoration: none; opacity: 0.85; }
.tsip-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tsip-accent);
  flex-shrink: 0;
}
.tsip-brand small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--tsip-text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.tsip-nav { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.tsip-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--tsip-text-dim);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, color 0.1s;
}
.tsip-nav-item:hover { background: var(--tsip-bg-3); color: var(--tsip-text); text-decoration: none; }
.tsip-nav-item.active {
  background: var(--tsip-bg-3);
  color: var(--tsip-text);
  border-color: var(--tsip-line-2);
}
.tsip-nav-item .ico {
  /* Structure mark: single neutral 6px square — groups are labelled in text,
     not encoded through color. Enterprise standard (Google Cloud / Anthropic Console). */
  width: 6px; height: 6px; border-radius: 1px; flex-shrink: 0;
  background: var(--tsip-text-mute); opacity: 0.45;
  margin-right: 2px;
}
.tsip-nav-item.active .ico, .tsip-nav-item:hover .ico { opacity: 0.85; }
/* All surface variants share the same neutral dot — no per-surface color */
/* Hub link at top of nav */
/* tsip-text-dim #9aa7b4 on bg-2 #161b22 = 7.63:1 PASS AA */
.tsip-nav-hub {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 5px;
  color: var(--tsip-text-dim); font-size: 12.5px; font-weight: 600;
  text-decoration: none; letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: background 0.1s, color 0.1s;
  margin-bottom: 6px;
}
.tsip-nav-hub:hover { background: var(--tsip-bg-3); color: var(--tsip-text); text-decoration: none; }
.tsip-nav-hub.active { background: var(--tsip-bg-3); color: var(--tsip-text); border-color: var(--tsip-line-2); }
.tsip-nav-hub .ico { width: 6px; height: 6px; border-radius: 1px; flex-shrink: 0; background: var(--tsip-text-mute); opacity: 0.85; margin-right: 2px; }
.tsip-nav-group-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tsip-text-mute);
  margin: 14px 0 4px 10px;
  font-weight: 600;
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.tsip-main { flex: 1; min-width: 0; padding: 24px 28px 64px; }

/* ── Page header ────────────────────────────────────────────────────────────── */
.tsip-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tsip-line);
}
.tsip-page-title { font-size: 20px; font-weight: 700; margin: 0 0 2px; letter-spacing: -0.01em; }
.tsip-page-sub { color: var(--tsip-text-dim); font-size: 12.5px; margin: 0; }

/* ── Section band header ─────────────────────────────────────────────────────── */
.tsip-band {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tsip-text-mute);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--tsip-line);
}
.tsip-band .badge-count {
  background: var(--tsip-bg-3);
  border: 1px solid var(--tsip-line-2);
  color: var(--tsip-text-dim);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ── Role switcher (STUB AUTH) ──────────────────────────────────────────────── */
.tsip-rolebar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--tsip-bg-2);
  border: 1px dashed var(--tsip-line-2);
  border-radius: 7px;
  padding: 6px 10px;
}
.tsip-rolebar .lbl { font-size: 10px; color: var(--tsip-text-mute); text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }
.tsip-role-btn {
  background: var(--tsip-bg-3); color: var(--tsip-text-dim);
  border: 1px solid var(--tsip-line); border-radius: 4px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
  transition: border-color 0.1s, color 0.1s;
}
.tsip-role-btn:hover { border-color: var(--tsip-line-2); color: var(--tsip-text); }
.tsip-role-btn.active { background: rgba(245,166,35,0.12); color: var(--tsip-accent); border-color: rgba(245,166,35,0.35); font-weight: 700; }

/* ── Cards / panels ─────────────────────────────────────────────────────────── */
.tsip-card {
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-radius: var(--tsip-radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.tsip-card h2 { margin: 0 0 14px; font-size: 14px; font-weight: 700; }
.tsip-card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--tsip-text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.tsip-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tsip-card-head h3 { margin: 0; }

.tsip-grid { display: grid; gap: 14px; }
.tsip-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.tsip-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tsip-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tsip-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .tsip-grid.cols-4, .tsip-grid.cols-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .tsip-grid.cols-3, .tsip-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px)  { .tsip-grid.cols-2, .tsip-grid.cols-3 { grid-template-columns: 1fr; } }

/* ── App launcher tiles (hub) ───────────────────────────────────────────────── */
.tsip-app-tile {
  display: block;
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-radius: var(--tsip-radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tsip-app-tile:hover { border-color: var(--tsip-accent); background: var(--tsip-bg-3); text-decoration: none; }
.tsip-app-tile .ti { font-size: 22px; margin-bottom: 9px; line-height: 1; }
.tsip-app-tile .tt { font-weight: 600; font-size: 14px; color: var(--tsip-text); margin-bottom: 4px; }
.tsip-app-tile .td { font-size: 12px; color: var(--tsip-text-dim); line-height: 1.4; }
.tsip-app-tile .tag { display: inline-block; margin-top: 10px; font-size: 9.5px; padding: 2px 7px; border-radius: 4px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tag-observe { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.tag-act     { background: rgba(248,81,73,0.07); color: var(--tsip-bad); }
.tag-gate    { background: rgba(245,166,35,0.07); color: var(--tsip-accent); }

/* ── KPI stat tiles ─────────────────────────────────────────────────────────── */
.tsip-stat {
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-radius: var(--tsip-radius);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
}
.tsip-stat.accent-left  { border-left: 3px solid var(--tsip-accent); }
.tsip-stat.accent-blue  { border-left: 3px solid var(--tsip-accent-2); }
.tsip-stat.accent-ok    { border-left: 3px solid var(--tsip-ok); }
.tsip-stat.accent-bad   { border-left: 3px solid var(--tsip-bad); }
.tsip-stat.accent-warn  { border-left: 3px solid var(--tsip-warn); }
.tsip-stat.accent-purple{ border-left: 3px solid var(--tsip-purple); }
.tsip-stat .st-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tsip-text-mute);
  font-weight: 600;
  margin-bottom: 6px;
}
.tsip-stat .st-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--tsip-mono);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.tsip-stat .st-delta {
  font-size: 11.5px;
  margin-top: 4px;
}
.tsip-stat .st-delta.up   { color: #56d364; }
.tsip-stat .st-delta.down { color: var(--tsip-bad); }
.tsip-stat .st-delta.flat { color: var(--tsip-text-mute); }
.tsip-stat .st-sub {
  font-size: 11px;
  color: var(--tsip-text-dim);
  margin-top: 2px;
}

/* Inline sparkline (SVG rendered by JS) */
.tsip-sparkline-wrap {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 80px;
  height: 36px;
  opacity: 0.45;
  pointer-events: none;
}
.tsip-sparkline-wrap svg { display: block; }

/* ── Activity feed ───────────────────────────────────────────────────────────── */
.tsip-activity-feed { list-style: none; margin: 0; padding: 0; }
.tsip-activity-feed li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tsip-line);
  font-size: 12.5px;
}
.tsip-activity-feed li:last-child { border-bottom: none; }
.tsip-activity-feed .af-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0; margin-top: 4px;
}
.tsip-activity-feed .af-dot.ok     { background: var(--tsip-ok); }
.tsip-activity-feed .af-dot.warn   { background: var(--tsip-warn); }
.tsip-activity-feed .af-dot.bad    { background: var(--tsip-bad); }
.tsip-activity-feed .af-dot.info   { background: var(--tsip-accent-2); }
.tsip-activity-feed .af-dot.amber  { background: var(--tsip-accent); }
.tsip-activity-feed .af-body { flex: 1; min-width: 0; }
.tsip-activity-feed .af-msg { color: var(--tsip-text); line-height: 1.4; }
.tsip-activity-feed .af-time { font-size: 11px; color: var(--tsip-text-mute); margin-top: 1px; font-family: var(--tsip-mono); }

/* ── Health indicator row ────────────────────────────────────────────────────── */
.tsip-health-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--tsip-line);
  font-size: 12.5px;
}
.tsip-health-row:last-child { border-bottom: none; }
.tsip-health-row .hr-label { flex: 1; color: var(--tsip-text-dim); }
.tsip-health-row .hr-status { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }
.tsip-health-row .hr-status.ok   { color: #56d364; }
.tsip-health-row .hr-status.warn { color: var(--tsip-warn); }
.tsip-health-row .hr-status.bad  { color: var(--tsip-bad); }
.tsip-health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tsip-health-dot.ok   { background: var(--tsip-ok); }
.tsip-health-dot.warn { background: var(--tsip-warn); }
.tsip-health-dot.bad  { background: var(--tsip-bad); }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.tsip-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tsip-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--tsip-text-mute);
  font-weight: 700;
  padding: 7px 10px;
  border-bottom: 1px solid var(--tsip-line);
  white-space: nowrap;
}
.tsip-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--tsip-line);
  vertical-align: top;
  color: var(--tsip-text-dim);
}
.tsip-table td.td-primary { color: var(--tsip-text); font-weight: 500; }
.tsip-table td.td-mono { font-family: var(--tsip-mono); font-size: 11.5px; }
.tsip-table tr.clickable { cursor: pointer; }
.tsip-table tr.clickable:hover td { background: var(--tsip-bg-3); }
/* Clickable identifier/title (e.g. case number + subject) — link affordance, restrained. */
.case-open { cursor: pointer; }
.case-open:hover { text-decoration: underline; color: var(--tsip-accent-2); }
.case-open:focus-visible { outline: 2px solid var(--tsip-accent-2); outline-offset: 1px; border-radius: 2px; }
.tsip-table tr:last-child td { border-bottom: none; }
.tsip-table tr.hidden-row { display: none; }

/* ── Badges / pills ─────────────────────────────────────────────────────────── */
.tsip-pill { display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 20px; font-weight: 700; white-space: nowrap; letter-spacing: 0.02em; }
.pill-open            { background: rgba(68,147,248,0.08); color: #79b8ff; }
.pill-awaiting_customer { background: rgba(163,113,247,0.08); color: var(--tsip-purple); }
.pill-awaiting_decision { background: rgba(210,153,34,0.09); color: var(--tsip-warn); }
.pill-resolved        { background: rgba(46,160,67,0.08); color: #56d364; }
.pill-billing  { background: rgba(245,166,35,0.07); color: var(--tsip-accent); }
.pill-refund   { background: rgba(248,81,73,0.07); color: var(--tsip-bad); }
.pill-deletion { background: rgba(163,113,247,0.08); color: var(--tsip-purple); }
.pill-question { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.pill-pending  { background: rgba(210,153,34,0.09); color: var(--tsip-warn); }
.pill-approved { background: rgba(46,160,67,0.08); color: #56d364; }
.pill-rejected { background: rgba(248,81,73,0.07); color: var(--tsip-bad); }
.pill-sev-fatal { background: rgba(248,81,73,0.10); color: #ff7b72; border: 1px solid rgba(248,81,73,0.18); }
.pill-sev-error { background: rgba(248,81,73,0.07); color: var(--tsip-bad); }
.pill-sev-warn  { background: rgba(210,153,34,0.08); color: var(--tsip-warn); }
.pill-sev-info  { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.pill-free      { background: rgba(107,119,133,0.12); color: var(--tsip-text-dim); }
.pill-advanced  { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.pill-pro       { background: rgba(245,166,35,0.08); color: var(--tsip-accent); }

.sla-ok      { color: var(--tsip-ok); }
.sla-warning { color: var(--tsip-warn); font-weight: 600; }
.sla-breach  { color: var(--tsip-bad); font-weight: 700; }

/* ── NOT WIRED — AWAITING HUMAN badge ───────────────────────────────────────── */
.tsip-not-wired-badge {
  display: inline-block;
  background: rgba(248,81,73,0.11);
  color: #ff7b72;
  border: 1px dashed var(--tsip-bad);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  margin-left: 7px;
  vertical-align: middle;
  text-transform: uppercase;
  cursor: help;
}
[data-not-wired] { position: relative; }
[data-not-wired].tsip-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.tsip-btn {
  font-family: inherit; font-size: 12.5px; padding: 6px 13px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--tsip-line-2); background: var(--tsip-bg-3); color: var(--tsip-text);
  transition: border-color 0.1s;
}
.tsip-btn:hover { border-color: var(--tsip-accent-2); }
.tsip-btn.primary { background: var(--tsip-accent); border-color: var(--tsip-accent); color: #1a1300; font-weight: 700; }
.tsip-btn.primary:hover { background: #f0a020; border-color: #f0a020; }
.tsip-btn.ok { background: rgba(46,160,67,0.13); border-color: var(--tsip-ok); color: #56d364; }
.tsip-btn.danger { background: rgba(248,81,73,0.10); border-color: var(--tsip-bad); color: #ff7b72; }
.tsip-btn:disabled, .tsip-btn.tsip-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.tsip-btn-sm { padding: 4px 9px; font-size: 11.5px; }

/* ── Filters bar ────────────────────────────────────────────────────────────── */
.tsip-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-radius: 6px;
}
.tsip-filters select, .tsip-filters input[type=text] {
  font-family: inherit; font-size: 12.5px; padding: 5px 9px; border-radius: 5px;
  background: var(--tsip-bg-3); color: var(--tsip-text); border: 1px solid var(--tsip-line);
}
.tsip-filters label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tsip-text-dim); cursor: pointer; }

/* ── Timeline ───────────────────────────────────────────────────────────────── */
.tsip-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tsip-timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--tsip-line); }
.tsip-timeline li { position: relative; padding: 0 0 14px 26px; }
.tsip-timeline li .tdot { position: absolute; left: 2px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--tsip-bg-3); border: 2px solid var(--tsip-line-2); }
.tsip-timeline li.cust .tdot { border-color: var(--tsip-accent-2); }
.tsip-timeline li.internal .tdot { border-color: var(--tsip-accent); }
.tsip-timeline li.decision .tdot { border-color: var(--tsip-ok); }
.tsip-timeline .tmeta { font-size: 11px; color: var(--tsip-text-mute); }
.tsip-timeline .tnote { margin-top: 2px; font-size: 12.5px; }
.tsip-timeline .chan { font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.chan-cust { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.chan-int  { background: rgba(245,166,35,0.07); color: var(--tsip-accent); }

/* ── Inline bar chart ────────────────────────────────────────────────────────── */
.tsip-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.tsip-bar-row .br-label { width: 140px; flex-shrink: 0; font-size: 12.5px; color: var(--tsip-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsip-bar-row .br-track { flex: 1; height: 8px; background: var(--tsip-bg-3); border-radius: 4px; overflow: hidden; }
.tsip-bar-row .br-fill  { height: 100%; border-radius: 4px; transition: width 0.3s; }
.tsip-bar-row .br-count { width: 44px; text-align: right; font-size: 12px; font-family: var(--tsip-mono); color: var(--tsip-text-dim); flex-shrink: 0; }
.br-fill.blue   { background: var(--tsip-accent-2); }
.br-fill.amber  { background: var(--tsip-accent); }
.br-fill.ok     { background: var(--tsip-ok); }
.br-fill.bad    { background: var(--tsip-bad); }
.br-fill.purple { background: var(--tsip-purple); }

/* ── Plan mix donut placeholder / stacked bar ───────────────────────────────── */
.tsip-plan-bar {
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  margin: 10px 0;
}
.tsip-plan-bar .pb-seg { height: 100%; }
.tsip-plan-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.tsip-plan-legend .pl-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--tsip-text-dim); }
.tsip-plan-legend .pl-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Silent bugs panel ───────────────────────────────────────────────────────── */
.tsip-silent-bugs-panel {
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-left: 3px solid var(--tsip-bad);
  border-radius: var(--tsip-radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.tsip-silent-bugs-panel .sbp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--tsip-line);
  background: transparent;
}
.tsip-silent-bugs-panel .sbp-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--tsip-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tsip-silent-bugs-panel .sbp-head .sbp-count-badge {
  background: rgba(248,81,73,0.09);
  color: #ff7b72;
  border: 1px solid rgba(248,81,73,0.16);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
}
.tsip-silent-bugs-panel .sbp-head .sbp-sub {
  font-size: 11px;
  color: var(--tsip-text-mute);
}
.sbp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sbp-table th {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--tsip-text-mute);
  font-weight: 700;
  padding: 7px 12px;
  border-bottom: 1px solid var(--tsip-line);
  background: var(--tsip-bg-3);
  text-align: left;
}
.sbp-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--tsip-line);
  vertical-align: middle;
  color: var(--tsip-text-dim);
}
.sbp-table tr:last-child td { border-bottom: none; }
.sbp-table tr:hover td { background: var(--tsip-bg-3); }
.sbp-table .sb-where { font-family: var(--tsip-mono); font-size: 11px; color: var(--tsip-text); background: var(--tsip-bg-3); border: 1px solid var(--tsip-line); border-radius: 3px; padding: 2px 6px; display: inline-block; }
.sbp-table .sb-count { font-family: var(--tsip-mono); font-size: 13px; font-weight: 700; color: var(--tsip-bad); }
.sbp-table .sb-sample { font-family: var(--tsip-mono); font-size: 11px; color: var(--tsip-text-mute); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbp-table .sb-last { font-family: var(--tsip-mono); font-size: 11px; color: var(--tsip-text-mute); white-space: nowrap; }

/* Heatmap-style recurrence dots for silent bugs */
.sb-heat-dots { display: flex; gap: 3px; align-items: center; }
.sb-heat-dot { width: 10px; height: 10px; border-radius: 2px; }
.sb-heat-dot.h1 { background: rgba(248,81,73,0.15); }
.sb-heat-dot.h2 { background: rgba(248,81,73,0.28); }
.sb-heat-dot.h3 { background: rgba(248,81,73,0.44); }
.sb-heat-dot.h4 { background: rgba(248,81,73,0.60); }

/* ── Error stream (observability) ────────────────────────────────────────────── */
.tsip-error-stream { list-style: none; margin: 0; padding: 0; }
.tsip-error-stream li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tsip-line);
  font-size: 12px;
}
.tsip-error-stream li:last-child { border-bottom: none; }
.tsip-error-stream .es-sev { width: 42px; flex-shrink: 0; padding-top: 1px; }
.tsip-error-stream .es-body { flex: 1; min-width: 0; }
.tsip-error-stream .es-msg { color: var(--tsip-text); font-family: var(--tsip-mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsip-error-stream .es-meta { font-size: 10.5px; color: var(--tsip-text-mute); margin-top: 2px; }
.tsip-error-stream .es-rec { flex-shrink: 0; font-family: var(--tsip-mono); font-size: 11.5px; color: var(--tsip-text-mute); white-space: nowrap; }

/* ── DAU sparkline canvas area ───────────────────────────────────────────────── */
.tsip-dau-chart {
  width: 100%;
  height: 72px;
  position: relative;
  margin-bottom: 8px;
}
.tsip-dau-chart svg { width: 100%; height: 100%; }

/* ── Recurrence / count bar inline in tables ────────────────────────────────── */
.tsip-rec-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.tsip-rec-bar .rb-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--tsip-bad);
  min-width: 2px;
}
.tsip-rec-bar .rb-num { font-family: var(--tsip-mono); font-size: 11.5px; color: var(--tsip-text-dim); }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
.tsip-note { background: var(--tsip-bg-3); border-left: 3px solid var(--tsip-accent-2); border-radius: 4px; padding: 9px 13px; font-size: 12px; color: var(--tsip-text-dim); margin-bottom: 14px; line-height: 1.5; }
.tsip-note.warn   { border-left-color: var(--tsip-warn); }
.tsip-note.danger { border-left-color: var(--tsip-bad); }
.tsip-mono   { font-family: var(--tsip-mono); font-size: 12px; }
.tsip-muted  { color: var(--tsip-text-mute); }
.tsip-dim    { color: var(--tsip-text-dim); }
.tsip-empty  { text-align: center; color: var(--tsip-text-mute); padding: 36px; font-size: 13px; }
.tsip-kv     { display: flex; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.tsip-kv .k  { color: var(--tsip-text-mute); min-width: 120px; }

/* ── Decision record (§8) — shown on every decided queue row ──────────────── */
.tsip-decision-record { font-size: 11.5px; line-height: 1.5; }
.tsip-dr-line { white-space: normal; }
.tsip-dr-k { display: inline-block; min-width: 64px; font-family: var(--tsip-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tsip-text-dim); }
.tsip-dr-actions { margin-top: 6px; }

.tsip-noaccess { text-align: center; padding: 80px 20px; }
.tsip-noaccess .lock {
  display: inline-block; margin-bottom: 16px;
  font-family: var(--tsip-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--tsip-bad); border: 1px solid var(--tsip-bad);
  border-radius: 5px; padding: 5px 12px;
}
.tsip-noaccess h2 { margin: 0 0 6px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.tsip-toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.tsip-toast { background: var(--tsip-bg-2); border: 1px solid var(--tsip-line-2); border-left: 4px solid var(--tsip-accent-2); border-radius: 6px; padding: 10px 15px; font-size: 12.5px; min-width: 240px; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.tsip-toast.warn  { border-left-color: var(--tsip-warn); }
.tsip-toast.error { border-left-color: var(--tsip-bad); }

/* Code/source reference block */
.tsip-src { background: #0a0e13; border: 1px solid var(--tsip-line); border-radius: 5px; padding: 11px 13px; font-family: var(--tsip-mono); font-size: 11.5px; color: var(--tsip-text-dim); white-space: pre-wrap; overflow-x: auto; line-height: 1.55; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.tsip-divider { border: none; border-top: 1px solid var(--tsip-line); margin: 16px 0; }

/* ── Drill-down / expandable detail row ───────────────────────────────────── */
.tsip-table tr.detail-row td {
  padding: 0;
  border-bottom: none;
}
.tsip-table tr.detail-row.open td { border-bottom: 1px solid var(--tsip-line); }
.tsip-detail-panel {
  background: var(--tsip-bg);
  border-top: 1px solid var(--tsip-line);
  padding: 12px 16px 14px;
  font-size: 12px;
  line-height: 1.5;
}
.tsip-detail-panel .dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin-bottom: 8px; }
.tsip-detail-panel .dp-kv { display: flex; gap: 8px; }
/* dp-k: text-dim 7.63:1 on bg #0d1117 PASS AA */
.tsip-detail-panel .dp-k { color: var(--tsip-text-dim); min-width: 110px; flex-shrink: 0; }
.tsip-detail-panel .dp-v { color: var(--tsip-text-dim); font-family: var(--tsip-mono); font-size: 11.5px; }
.tsip-detail-panel .dp-stack { margin-top: 8px; background: #0a0e13; border: 1px solid var(--tsip-line); border-radius: 4px; padding: 8px 10px; font-family: var(--tsip-mono); font-size: 11px; color: var(--tsip-text-mute); white-space: pre-wrap; }
/* dp-honest-empty: text-dim 7.63:1 on bg PASS AA */
.tsip-detail-panel .dp-honest-empty { color: var(--tsip-text-dim); font-style: italic; font-size: 12px; padding: 4px 0; }
/* KPI tile drill-down (hub) */
.tsip-stat { cursor: pointer; }
.tsip-stat-detail {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--tsip-line);
  font-size: 11.5px;
  color: var(--tsip-text-dim);
  line-height: 1.55;
}
.tsip-stat.expanded .tsip-stat-detail { display: block; }
/* st-expand-hint: tsip-text-mute 3.73:1 — at 9.5px uppercase bold borderline;
   using text-dim 7.63:1 for clear AA compliance */
.tsip-stat .st-expand-hint {
  font-size: 9.5px;
  color: var(--tsip-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
  font-weight: 600;
}
/* Honest-empty state */
.tsip-honest-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--tsip-text-mute);
  font-size: 13px;
}
.tsip-honest-empty .he-title { font-weight: 600; margin-bottom: 4px; color: var(--tsip-text-dim); }
.tsip-honest-empty .he-sub   { font-size: 12px; }

/* ── Department-specific pills (new pages) ───────────────────────────────────── */
.pill-resolved { background: rgba(46,160,67,0.08); color: #56d364; }
.pill-publish  { background: rgba(68,147,248,0.07); color: var(--tsip-accent-2); }
.pill-dept     { background: rgba(163,113,247,0.07); color: var(--tsip-purple); border: 1px solid rgba(163,113,247,0.14); }

/* ── Queue item expand toggle ────────────────────────────────────────────────── */
/* qi-toggle: the ID cell affordance that opens the inline detail row. */
/* Contrast: accent-2 #4493f8 on bg #0d1117 = 4.64:1 PASS AA; underline on hover adds redundant cue */
.qi-toggle {
  cursor: pointer;
  color: var(--tsip-accent-2);
  font-family: var(--tsip-mono);
  font-size: 12px;
}
.qi-toggle:hover { text-decoration: underline; }
.qi-toggle:focus-visible { outline: 2px solid var(--tsip-accent-2); outline-offset: 1px; border-radius: 2px; }

/* Section header inside qi-detail panels. */
.qi-section-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--tsip-text-mute);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--tsip-line);
}

/* Body content block inside qi-detail (full draft text). */
.qi-body-block {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.5;
}

/* ── Two-column layout helpers ───────────────────────────────────────────────── */
.tsip-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.tsip-three-col { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .tsip-two-col, .tsip-three-col { grid-template-columns: 1fr; } }

/* ── Neutral "not wired" placeholder panel ───────────────────────────────────── */
/* Used on department pages not yet wired to real data. No color, no fake content. */
/* --tsip-text-dim #9aa7b4 on --tsip-bg-2 #161b22: 6.93:1 PASS AA */
/* --tsip-text-mute #6b7785 on --tsip-bg-2 #161b22: 3.57:1 — used at 10px uppercase bold, large-text threshold */
.tsip-unwired-panel {
  background: var(--tsip-bg-2);
  border: 1px solid var(--tsip-line);
  border-radius: var(--tsip-radius);
  padding: 48px 32px;
  text-align: center;
  margin-top: 8px;
}
.tsip-unwired-panel .uwp-label {
  /* --tsip-text-dim #9aa7b4 on --tsip-bg-2 #161b22: 6.39:1 PASS AA */
  display: inline-block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--tsip-text-dim);
  border: 1px solid var(--tsip-line-2);
  border-radius: 4px;
  padding: 3px 10px;
  margin-bottom: 16px;
}
.tsip-unwired-panel .uwp-title {
  /* --tsip-text-dim #9aa7b4 on --tsip-bg-2 #161b22: 6.39:1 PASS AA */
  font-size: 15px;
  font-weight: 700;
  color: var(--tsip-text-dim);
  margin: 0 0 8px;
}
.tsip-unwired-panel .uwp-sub {
  /* --tsip-text-dim #9aa7b4 on --tsip-bg-2 #161b22: 6.39:1 PASS AA */
  font-size: 12.5px;
  color: var(--tsip-text-dim);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.55;
}
