/* ───────────────────────────────────────────────────────────────────────────
   KAVACH v1-MVP — Analyst Console stylesheet.
   Dark, dense, legal-console aesthetic.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #0b0f17;
  --bg-elev:      #121826;
  --bg-elev-2:    #1a2030;
  --line:         #232a3d;
  --text:         #e3e8f0;
  --text-dim:     #9aa3b8;
  --text-muted:   #6b7283;
  --accent:       #6ea8ff;
  --accent-dim:   #3a64aa;
  --green:        #5ad394;
  --red:          #ff6868;
  --amber:        #f5b340;
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.45);
  --radius:       8px;
  --mono:         ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 6px;
  padding: 7px 12px;
  transition: background 80ms ease;
}
button:hover { background: var(--bg-elev-2); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost { background: transparent; }
.btn       { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #0b0f17; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 160px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(110, 168, 255, 0.15);
}

/* ───── Top bar ───── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #131a2a 0%, #0e1320 100%);
}
.brand { display: flex; align-items: center; gap: 12px; }
.shield {
  font-size: 30px; line-height: 1;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(110, 168, 255, 0.4));
}
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: 0.06em; }
.brand-text .subtitle { color: var(--text-muted); font-size: 11.5px; }

.topbar-meta { display: flex; align-items: center; gap: 10px; }
.pill {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-elev-2); color: var(--text-dim);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
}
.pill-muted { color: var(--text-muted); }
.pill-good  { color: var(--green); border-color: rgba(90, 211, 148, 0.35); background: rgba(90, 211, 148, 0.08); }
.pill-bad   { color: var(--red);   border-color: rgba(255, 104, 104, 0.45); background: rgba(255, 104, 104, 0.10); }
.pill-warn  { color: var(--amber); border-color: rgba(245, 179, 64, 0.4);   background: rgba(245, 179, 64, 0.08); }

/* ───── KPIs ───── */

.kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  padding: 14px 20px;
}
.kpi {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { color: var(--text-muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.kpi-value { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.kpi-block  { color: var(--red); }
.kpi-verify { color: var(--amber); }

/* ───── Scheduler card ───── */

.scheduler-card {
  margin: 0 20px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.scheduler-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.scheduler-head h2 { margin: 0; font-size: 13.5px; color: var(--text-dim); letter-spacing: 0.04em; text-transform: uppercase; }
.scheduler-out {
  margin: 0; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  max-height: 200px; overflow: auto; white-space: pre;
}
.actions { display: flex; gap: 6px; }

/* ───── Tabs ───── */

.tabs {
  margin: 16px 20px 0;
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tab {
  border: none; background: transparent; color: var(--text-muted);
  padding: 9px 14px; border-bottom: 2px solid transparent;
  border-radius: 0;
}
.tab:hover { color: var(--text-dim); background: transparent; }
.tab-active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { display: none; padding: 14px 20px 28px; }
.tab-panel-active { display: block; }

/* ───── Toolbar / table ───── */

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.grow { flex: 1; }
.muted { color: var(--text-muted); font-size: 12px; }

.table-wrap {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto;
}
.table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 12.5px;
}
.table th, .table td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}
.table th { color: var(--text-muted); font-weight: 500; background: var(--bg-elev-2); position: sticky; top: 0; }
.table td.num { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--bg-elev-2); }
.action-BLOCK             { color: var(--red); }
.action-VERIFY            { color: var(--amber); }
.action-BLOCK_NOW_STRICT  { color: var(--red); }
.action-SUPPLEMENTARY_BLOCK_ORDER { color: var(--red); }

.pager {
  display: flex; align-items: center; gap: 12px; padding-top: 10px;
}

/* ───── Cluster grid ───── */

.cluster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.cluster-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 80ms ease, transform 80ms ease, box-shadow 80ms ease;
}
.cluster-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.cluster-card h3 {
  margin: 0; font-size: 14.5px;
  font-family: var(--mono); letter-spacing: 0.03em;
  color: var(--text);
}
.cluster-card .cluster-stats {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 2px;
}
.cluster-card .cluster-count {
  font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--accent);
}
.cluster-card .cluster-count-label {
  color: var(--text-muted); font-size: 11.5px;
}
.cluster-card .cluster-actions {
  display: flex; gap: 4px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--text-muted);
}
.cluster-card .cluster-actions .action-chip {
  background: var(--bg); padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--line);
}
.cluster-card .cluster-actions .action-chip.block  { color: var(--red);   border-color: rgba(255,104,104,0.35); }
.cluster-card .cluster-actions .action-chip.verify { color: var(--amber); border-color: rgba(245,179,64,0.35); }
.cluster-card .cluster-cdn {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Brand tier visual hierarchy ───
   MAJOR    red border    = established operators
   ACTIVE   amber border  = real enforcement target
   EMERGING cyan border + pulsing dot = fresh CT discovery, possibly new op
   DORMANT  dim grey      = old + tiny, still monitored
*/
.cluster-card.tier-MAJOR    { border-left: 3px solid var(--red);     }
.cluster-card.tier-ACTIVE   { border-left: 3px solid var(--amber);   }
.cluster-card.tier-EMERGING {
  border-left: 3px solid #4dd2ff;
  background: linear-gradient(90deg, rgba(77, 210, 255, 0.06), var(--bg-elev) 60%);
}
.cluster-card.tier-DORMANT  {
  border-left: 3px solid #444;
  opacity: 0.72;
}
.cluster-card .tier-badge {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 3px;
  align-self: flex-start;
}
.tier-badge.tier-MAJOR    { color: var(--red);   background: rgba(255,104,104,0.10); }
.tier-badge.tier-ACTIVE   { color: var(--amber); background: rgba(245,179,64,0.10);  }
.tier-badge.tier-EMERGING {
  color: #4dd2ff; background: rgba(77,210,255,0.10);
  display: inline-flex; align-items: center; gap: 5px;
}
.tier-badge.tier-DORMANT  { color: var(--text-muted); background: rgba(255,255,255,0.04); }

/* Pulsing cyan dot — visible signal that something is fresh and worth watching */
.tier-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #4dd2ff; border-radius: 50%;
  box-shadow: 0 0 6px rgba(77, 210, 255, 0.65);
  animation: kavachPulse 1.6s ease-in-out infinite;
}
@keyframes kavachPulse {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%      { transform: scale(1.4); opacity: 0.55; }
}

/* ─── Tier filter chips in the clusters toolbar ─── */
.tier-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.tier-chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 5px 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text-muted);
  cursor: pointer; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background 80ms ease, color 80ms ease, border-color 80ms ease;
}
.tier-chip .tier-count {
  background: var(--bg-elev-2); padding: 1px 6px; border-radius: 999px;
  font-size: 10px;
}
.tier-chip:hover { color: var(--text); }
.tier-chip.active.tier-MAJOR    { border-color: var(--red);   color: var(--red);   background: rgba(255,104,104,0.08); }
.tier-chip.active.tier-ACTIVE   { border-color: var(--amber); color: var(--amber); background: rgba(245,179,64,0.08); }
.tier-chip.active.tier-EMERGING { border-color: #4dd2ff;      color: #4dd2ff;      background: rgba(77,210,255,0.08); }
.tier-chip.active.tier-DORMANT  { border-color: var(--text-muted); color: var(--text); background: var(--bg-elev-2); }

/* ─── KPI strip per tier (under "Brands" KPI) ─── */
.kpi-tier-strip {
  display: flex; gap: 6px; margin-top: 4px;
  font-family: var(--mono); font-size: 10px;
}
.kpi-tier-strip .tier-segment {
  padding: 1px 6px; border-radius: 3px;
  background: var(--bg);
}
.kpi-tier-strip .tier-MAJOR    { color: var(--red);   }
.kpi-tier-strip .tier-ACTIVE   { color: var(--amber); }
.kpi-tier-strip .tier-EMERGING { color: #4dd2ff; }
.kpi-tier-strip .tier-DORMANT  { color: var(--text-muted); }

/* ─── Saved searches strip ─── */
.saved-strip {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.saved-strip:empty { display: none; }
.saved-pin {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 4px 9px; border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.saved-pin:hover { border-color: var(--accent-dim); color: var(--text); }
.saved-pin .saved-pin-x {
  color: var(--text-muted); font-family: var(--mono); font-size: 11px;
  padding: 0 2px;
}
.saved-pin .saved-pin-x:hover { color: var(--red); }

/* ───── Runs stack ───── */

.runs-stack { display: flex; flex-direction: column; gap: 8px; }
.run-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px;
  align-items: center;
}
.run-card:hover { border-color: var(--accent-dim); }
.run-ts { font-family: var(--mono); font-size: 13px; }
.run-stat { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.run-stat strong { color: var(--text); margin-right: 4px; }
.run-block-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); margin-right: 6px;
}

/* ───── Auth user badge + admin Users panel ───── */

.user-badge { position: relative; }

.user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 4px 10px 4px 5px; border-radius: 999px;
  cursor: pointer; font-size: 12px; transition: border-color .15s ease;
}
.user-btn:hover { border-color: var(--accent); }
.user-btn img {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--line); object-fit: cover;
}
.user-btn .user-info {
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1;
}
.user-btn .user-name { font-size: 12px; color: var(--text); white-space: nowrap; }
.user-btn .user-role {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); font-family: var(--mono);
}
.user-btn .user-caret { color: var(--text-muted); font-size: 10px; }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 220px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  z-index: 8; padding: 6px 0;
}
.user-menu-head {
  padding: 8px 14px 10px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.user-menu-item {
  display: block; padding: 8px 14px; font-size: 12.5px;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.user-menu-item:hover { background: rgba(255,255,255,.05); color: var(--accent); }

/* Tint the whole UI subtly in viewer mode + hide mutation controls. */
body.viewer-mode .user-role { color: #ffc66b; }
body.viewer-mode [data-admin-only] { display: none !important; }
body.viewer-mode #user-menu-users { display: none !important; }

/* Users admin drawer */
.users-table {
  width: 100%; border-collapse: collapse; font-family: var(--mono);
  font-size: 12.5px; margin-top: 12px;
}
.users-table th, .users-table td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.users-table th {
  font-size: 10.5px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.05em; font-weight: 500;
}
.users-table .urole {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
}
.users-table .urole.admin  { background: rgba(56,139,253,.18); color: #79b8ff; border: 1px solid rgba(56,139,253,.4); }
.users-table .urole.viewer { background: rgba(127,127,127,.18); color: var(--text-muted); border: 1px solid var(--line); }
.users-table .uactive  { color: #5ddc7e; }
.users-table .uactive.no { color: #ff8a96; }
.users-table .uacts { display: flex; gap: 4px; justify-content: flex-end; }
.users-table .uacts .btn { padding: 2px 8px; font-size: 11px; }

.users-form {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 8px; margin-top: 10px;
}
.users-form .input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; min-width: 240px;
}
.users-form select { padding-right: 24px; }
.users-form .grow { flex: 1; }

/* ───── Live Operations Centre (LE-grade triage surface) ───── */

.ops {
  display: flex; flex-direction: column; gap: 12px;
  font-size: 13px; max-height: calc(100vh - 64px); overflow: hidden;
}
.ops-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ops-head h2 { margin: 0; font-size: 16px; color: var(--text); }
.ops-head .sub { color: var(--text-muted); font-size: 12px; }
.ops-head .actions { display: flex; gap: 6px; margin-left: auto; }

/* Top stat strip */
.ops-stats {
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.ops-stat {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.ops-stat .label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ops-stat .value { font-family: var(--mono); font-size: 18px; color: var(--text); }
.ops-stat.good   .value { color: #5ddc7e; }
.ops-stat.warn   .value { color: #ffc66b; }
.ops-stat.bad    .value { color: #ff8a96; }
.ops-stat.accent .value { color: var(--accent); }
.ops-stat .delta { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

/* Sub-summary chip row (top brands / asns / new alive) */
.ops-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 6px 0; border-top: 1px dashed var(--line);
}
.ops-chip-section { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ops-chip-section .label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px;
}
.ops-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; font-family: var(--mono);
  cursor: pointer; transition: background .12s ease, border-color .12s ease;
}
.ops-chip:hover { background: rgba(255,255,255,.04); border-color: var(--accent); }
.ops-chip .n { color: var(--accent); font-weight: 600; }
.ops-chip.active { background: rgba(56,139,253,.22); border-color: var(--accent); color: var(--text); }

/* Filter row */
.ops-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 0;
}
.ops-filters .input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px; min-width: 140px;
}
.ops-filters select.input { padding-right: 24px; }
.ops-filters .grow { flex: 1; }
.ops-filters .summary { color: var(--text-muted); font-size: 11.5px; }

/* Triage row table */
.ops-table {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); overflow: auto;
  flex: 1; min-height: 240px; max-height: 56vh;
}
.ops-row {
  display: grid;
  grid-template-columns: 28px 1.7fr 1.1fr 100px 90px 90px 140px 38px 110px;
  gap: 8px; align-items: center;
  padding: 6px 10px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px;
  cursor: pointer; transition: background .1s ease;
}
.ops-row:hover    { background: rgba(255,255,255,.04); }
.ops-row.expanded { background: rgba(56,139,253,.06); }
.ops-row .sel input { cursor: pointer; }
.ops-row .h-host    { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ops-row .h-host a  { color: inherit; text-decoration: none; }
.ops-row .h-host a:hover { color: var(--accent); text-decoration: underline; }
.ops-row .h-brand   { color: var(--text-muted); }
.ops-row .h-brand .peers { color: var(--accent); font-size: 11px; margin-left: 4px; }
.ops-row .h-asn     { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.ops-row .h-cdn     { color: var(--text-muted); font-size: 11.5px; }
.ops-row .h-resp    { color: var(--text-muted); text-align: right; }
.ops-row .h-live    { color: var(--text-muted); font-size: 11.5px; }
.ops-row .h-danger  {
  width: 24px; height: 24px; border-radius: 50%; text-align: center; line-height: 24px;
  background: var(--bg-elev); border: 1px solid var(--line);
  font-weight: 600; font-size: 12px;
}
.ops-row .h-danger.d-7, .ops-row .h-danger.d-8, .ops-row .h-danger.d-9, .ops-row .h-danger.d-10
  { background: rgba(220,53,69,.20); color: #ff8a96; border-color: rgba(220,53,69,.55); }
.ops-row .h-danger.d-5, .ops-row .h-danger.d-6
  { background: rgba(245,158,11,.22); color: #ffc66b; border-color: rgba(245,158,11,.55); }
.ops-row .h-danger.d-3, .ops-row .h-danger.d-4
  { background: rgba(56,139,253,.18); color: #79b8ff; border-color: rgba(56,139,253,.45); }
.ops-row .h-act     { display: flex; gap: 4px; justify-content: flex-end; }
.ops-row .h-act .btn { padding: 2px 7px; font-size: 11px; }
.ops-row .pill {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; font-family: var(--mono);
}
.ops-row .pill.flag { background: rgba(220,53,69,.22); color: #ff8a96; border: 1px solid rgba(220,53,69,.5); margin-left: 6px; }
.ops-row .pill.cdn  { background: rgba(127,127,127,.18); color: var(--text-muted); border: 1px solid var(--line); }

/* Header strip — small column titles */
.ops-row.head {
  background: var(--bg-elev); cursor: default; font-size: 10.5px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  position: sticky; top: 0; z-index: 1;
}
.ops-row.head:hover { background: var(--bg-elev); }
.ops-row.head .h-danger { background: transparent; border: none; }

/* Expanded dossier */
.ops-dossier {
  background: rgba(56,139,253,.04); padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
@media (max-width: 980px) { .ops-dossier { grid-template-columns: 1fr; } }
.ops-doss-section h4 {
  margin: 0 0 6px; font-size: 12px; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.ops-doss-row { display: flex; gap: 8px; padding: 1px 0; }
.ops-doss-row .label { color: var(--text-muted); min-width: 110px; }
.ops-doss-row .val   { color: var(--text); word-break: break-all; }
.ops-doss-recs { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ops-doss-recs .rec {
  display: flex; gap: 8px; align-items: center; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-elev);
}
.ops-doss-recs .rec .prio {
  padding: 1px 7px; border-radius: 4px; font-size: 10.5px; text-transform: uppercase;
}
.ops-doss-recs .rec .prio.high { background: rgba(220,53,69,.20); color: #ff8a96; }
.ops-doss-recs .rec .prio.med  { background: rgba(245,158,11,.22); color: #ffc66b; }
.ops-doss-recs .rec .prio.low  { background: rgba(127,127,127,.18); color: var(--text-muted); }
.ops-doss-recs .rec .title { flex: 1; }
.ops-doss-recs .rec .btn { padding: 3px 8px; font-size: 11px; }

.ops-doss-acts {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.ops-doss-acts .btn { padding: 4px 10px; font-size: 12px; }

/* Footer / bulk actions bar */
.ops-bulk {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border-top: 1px solid var(--line); background: var(--bg-elev); border-radius: 8px;
}
.ops-bulk .count { font-family: var(--mono); color: var(--accent); }
.ops-bulk .grow  { flex: 1; }

/* Pager */
.ops-pager { padding: 6px 0; display: flex; gap: 12px; justify-content: center; align-items: center; }

/* Toasts variants (reusing) */
.toast-good { border-color: rgba(46,160,67,.5); }

/* ───── APK inventory ───── */

.apk-inv {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px 14px;
  margin: 10px 0 18px;
}
.apk-inv .toolbar { padding: 0; margin-bottom: 8px; }

.apk-inv-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin: 8px 0 10px;
}
.apk-inv-stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.apk-inv-stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.apk-inv-stat .value { font-family: var(--mono); font-size: 18px; color: var(--text); }
.apk-inv-stat.accent .value { color: var(--accent); }
.apk-inv-stat.good   .value { color: #5ddc7e; }
.apk-inv-stat.warn   .value { color: #ffc66b; }

.apk-inv-filters {
  display: flex; align-items: center; gap: 8px; margin: 8px 0;
  flex-wrap: wrap;
}
.apk-inv-filters .input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px; min-width: 160px;
}

.apk-inv-table {
  border: 1px solid var(--line); border-radius: var(--radius);
  max-height: 56vh; overflow: auto; background: var(--bg);
}
.apk-inv-row {
  display: grid;
  grid-template-columns: 60px 200px 160px 1fr 140px 110px 90px;
  gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px;
  transition: background .12s ease;
}
.apk-inv-row:hover    { background: rgba(255,255,255,.025); }
.apk-inv-row:last-child { border-bottom: none; }
.apk-inv-row .seq     { color: var(--text-muted); text-align: right; }
.apk-inv-row .brand   { color: var(--text); font-weight: 600; }
.apk-inv-row .host    { color: var(--text-muted); }
.apk-inv-row .url     { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apk-inv-row .url a   { color: var(--accent); text-decoration: none; }
.apk-inv-row .url a:hover { text-decoration: underline; }
.apk-inv-row .status  { font-size: 11.5px; }
.apk-inv-row .fp-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-family: var(--mono); text-align: center;
}
.apk-inv-row .fp-pill.has  { background: rgba(46,160,67,.22);  color: #5ddc7e;  border: 1px solid rgba(46,160,67,.5); }
.apk-inv-row .fp-pill.none { background: rgba(127,127,127,.18); color: var(--text-muted); border: 1px solid var(--line); }
.apk-inv-row .fp-pill.err  { background: rgba(220,53,69,.22);  color: #ff8a96;  border: 1px solid rgba(220,53,69,.55); }
.apk-inv-row .action .btn { padding: 3px 9px; font-size: 11.5px; }

.apk-inv-row .status-publicly_downloadable { color: #5ddc7e; }
.apk-inv-row .status-downloaded            { color: #79b8ff; }
.apk-inv-row .status-cf_challenge_or_failed{ color: #ffc66b; }
.apk-inv-row .status-unknown               { color: var(--text-muted); }

.apk-inv-detail {
  background: rgba(255,255,255,.02); padding: 10px 18px 14px 76px;
  border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px;
  line-height: 1.6;
}
.apk-inv-detail .label { display: inline-block; min-width: 140px; color: var(--text-muted); }
.apk-inv-detail pre {
  margin: 6px 0 0; padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 240px; overflow: auto;
}

.apk-inv-pager { padding: 10px 0 0; justify-content: center; }

.apk-divider {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 10px;
  color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em;
}
.apk-divider span { white-space: nowrap; }
.apk-divider::before, .apk-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ───── Chain panel (legacy renderer) ───── */

.chain-out {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; font-family: var(--mono); font-size: 12.5px;
  max-height: 70vh; overflow: auto; line-height: 1.7;
}
.chain-event { display: grid; grid-template-columns: 180px 200px auto 130px; gap: 12px; padding: 2px 0; }
.chain-ts { color: var(--text-muted); }
.chain-kind { color: var(--accent); }
.chain-subj { color: var(--text-dim); }
.chain-hash { color: var(--text-muted); }

/* ───── Chain of custody v2 — integrity dashboard ───── */

.chain-dash {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 10px 0 14px;
}
@media (max-width: 1080px) { .chain-dash { grid-template-columns: 1fr; } }

.chain-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
}
.chain-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.chain-card-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.chain-card-pill {
  padding: 2px 10px; border-radius: 999px; font-size: 11.5px;
  font-family: var(--mono); background: rgba(127,127,127,.18);
  color: var(--text-muted); border: 1px solid var(--line);
}
.chain-card-pill.ok   { background: rgba(46,160,67,.18);  color: #5ddc7e;  border-color: rgba(46,160,67,.45); }
.chain-card-pill.bad  { background: rgba(220,53,69,.20);  color: #ff8a96;  border-color: rgba(220,53,69,.55); }
.chain-card-pill.warn { background: rgba(245,158,11,.20); color: #ffc66b;  border-color: rgba(245,158,11,.55); }
.chain-card-pill.info { background: rgba(56,139,253,.18); color: #79b8ff;  border-color: rgba(56,139,253,.45); }

.chain-stat { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.chain-stat-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 1px 0;
}
.chain-stat-row .mono { color: var(--text); }

.chain-card-foot { line-height: 1.4; border-top: 1px dashed var(--line); padding-top: 8px; }
.chain-card-foot a { color: var(--accent); text-decoration: none; }
.chain-card-foot a:hover { text-decoration: underline; }

/* Red banner for tamper alerts */
.chain-tamper {
  border: 1px solid rgba(220,53,69,.6); background: rgba(220,53,69,.12);
  color: #ffb3bb; padding: 12px 14px; border-radius: var(--radius);
  margin: 0 0 12px; font-family: var(--mono); font-size: 12.5px;
}
.chain-tamper h4 { margin: 0 0 6px; color: #ff8a96; font-size: 13px; }

/* Verify report */
.chain-verify-report {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px;
  font-family: var(--mono); font-size: 12.5px;
}
.chain-verify-report.ok   { border-color: rgba(46,160,67,.45); }
.chain-verify-report.bad  { border-color: rgba(220,53,69,.55); background: rgba(220,53,69,.08); }
.chain-verify-report h4   { margin: 0 0 8px; font-size: 13px; }
.chain-verify-fail {
  background: rgba(220,53,69,.10); border-left: 2px solid rgba(220,53,69,.6);
  padding: 6px 10px; margin: 6px 0; border-radius: 4px;
}

/* Filters bar */
.chain-filters {
  display: flex; align-items: center; gap: 8px; margin: 8px 0;
  flex-wrap: wrap;
}
.chain-filters .input {
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px; min-width: 160px;
}
.chain-filters .input:focus { outline: 1px solid var(--accent); }

/* Event stream */
.chain-stream {
  display: flex; flex-direction: column; gap: 0;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 0;
  max-height: 60vh; overflow: auto;
}
.chain-row {
  display: grid;
  grid-template-columns: 60px 170px 200px 1fr auto;
  gap: 12px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px;
  cursor: pointer; transition: background .12s ease;
}
.chain-row:hover    { background: rgba(255,255,255,.03); }
.chain-row:last-child { border-bottom: none; }
.chain-row.broken   { background: rgba(220,53,69,.10); }
.chain-row-seq      { color: var(--text-muted); text-align: right; }
.chain-row-ts       { color: var(--text-muted); }
.chain-row-kind     { color: var(--accent); }
.chain-row-subject  { color: var(--text-dim); word-break: break-all; }
.chain-row-hash     { color: var(--text-muted); white-space: nowrap; }
.chain-row-hash .link-glyph { color: var(--text-dim); opacity: .6; }

.chain-row-detail {
  background: rgba(255,255,255,.02); padding: 10px 18px 14px 76px;
  border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px;
  line-height: 1.6;
}
.chain-row-detail .row-label { color: var(--text-muted); display: inline-block; min-width: 100px; }
.chain-row-detail pre {
  margin: 6px 0 0; padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 280px; overflow: auto;
}

/* Pager */
.chain-pager {
  display: flex; align-items: center; gap: 14px; padding: 8px 4px;
  justify-content: center;
}

/* Anchors history */
.chain-anchors-details { margin-top: 14px; }
.chain-anchors-details summary {
  cursor: pointer; user-select: none; padding: 6px 0; color: var(--text);
  font-size: 13px; font-weight: 600;
}
.chain-anchor-table {
  width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px;
  margin-top: 8px;
}
.chain-anchor-table th, .chain-anchor-table td {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line);
}
.chain-anchor-table th { color: var(--text-muted); font-weight: 500; }
.chain-anchor-table .status-attested { color: #5ddc7e; }
.chain-anchor-table .status-pending  { color: #ffc66b; }
.chain-anchor-table .status-local    { color: var(--text-muted); }

/* ───── Drawer ───── */

.drawer-scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 5;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(640px, 95vw);
  background: var(--bg-elev); border-left: 1px solid var(--line);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.55);
  transform: translateX(100%); transition: transform 200ms ease, width 200ms ease;
  z-index: 6; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer.drawer-wide { width: min(1280px, 96vw); }
.drawer-scrim.open { display: block; }
/* Prevent the underlying page from scrolling while drawer is open. */
body.drawer-locked { overflow: hidden; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 14px; }
.drawer-body { padding: 16px; overflow: auto; }
.drawer-body dl {
  display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px;
  margin: 0; font-family: var(--mono); font-size: 12.5px;
}
.drawer-body dt { color: var(--text-muted); }
.drawer-body dd { margin: 0; word-break: break-all; }
.drawer-section {
  margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px;
}
.drawer-section h4 { margin: 0 0 8px 0; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.drawer-receipt {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font-family: var(--mono); font-size: 11.5px;
  word-break: break-all; color: var(--green);
}

/* ───── Footer ───── */

.footer {
  margin-top: 20px; padding: 14px 20px; border-top: 1px solid var(--line);
  color: var(--text-muted); font-size: 11.5px;
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .scheduler-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ─────────────────────────────────────────────────────────────────────
   AI v2 additions: briefing card, command bar, toasts, diff tab,
   letter modal, notes panel.
   ───────────────────────────────────────────────────────────────────── */

/* ───── Command-bar trigger pill in the topbar ───── */
.cmd-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 6px 10px 6px 12px; border-radius: 8px;
  min-width: 340px;
  cursor: pointer;
  transition: border-color 100ms ease, background 100ms ease;
}
.cmd-trigger:hover { border-color: var(--accent-dim); color: var(--text); }
.cmd-trigger-icon { color: var(--accent); font-weight: 600; }
.cmd-trigger-text { flex: 1; font-size: 12.5px; }
.cmd-trigger-key {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .cmd-trigger { min-width: 200px; }
  .cmd-trigger-text { display: none; }
}

/* ───── Briefing card (A2) ───── */
.briefing-card {
  margin: 12px 20px 0;
  background: linear-gradient(135deg, #131c2d 0%, #161d2d 80%);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.briefing-card::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
}
.briefing-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.briefing-head h2 {
  margin: 0; font-size: 12px; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.briefing-text {
  margin: 4px 0 8px; font-size: 14px; line-height: 1.55;
  color: var(--text);
}
.briefing-stats {
  display: flex; gap: 8px 22px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-muted);
  margin-top: 4px;
}
.briefing-stats > div {
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.briefing-stats strong { color: var(--text); margin-right: 2px; }

/* ───── Command-bar overlay (C1) ───── */
.cmd-overlay {
  position: fixed; inset: 0;
  background: rgba(7, 10, 17, 0.65);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 50;
  align-items: flex-start; justify-content: center;
  padding-top: 11vh;
}
.cmd-overlay.open { display: flex; }
.cmd-panel {
  width: min(700px, 92vw);
  background: var(--bg-elev);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(110,168,255,0.15);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 70vh;
}
.cmd-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
#cmd-input {
  flex: 1;
  font-size: 16px;
  background: transparent; color: var(--text);
  border: none; outline: none;
  padding: 4px 0;
}
.cmd-mode {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-dim); color: var(--text);
  padding: 3px 8px; border-radius: 999px;
}
.cmd-mode.nl { background: #6f5dc0; }
.cmd-results {
  flex: 1; overflow: auto;
  padding: 6px 0;
}
.cmd-result-item {
  padding: 9px 14px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; border-left: 3px solid transparent;
}
.cmd-result-item.active {
  background: var(--bg-elev-2);
  border-left-color: var(--accent);
}
.cmd-result-icon {
  width: 22px; text-align: center; color: var(--accent);
  font-family: var(--mono);
}
.cmd-result-text { flex: 1; }
.cmd-result-title { font-size: 13.5px; }
.cmd-result-sub   { color: var(--text-muted); font-size: 11.5px; font-family: var(--mono); }
.cmd-result-action { color: var(--text-muted); font-size: 11px; font-family: var(--mono); }
.cmd-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; border-top: 1px solid var(--line);
  background: var(--bg);
}
.cmd-hint { color: var(--text-muted); font-size: 10.5px; }
.cmd-hint kbd {
  font-family: var(--mono); font-size: 10px;
  background: var(--bg-elev); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 3px;
}
.cmd-result-empty {
  padding: 14px; color: var(--text-muted); font-size: 12px; text-align: center;
}

/* ───── NL query result table (inside command bar drawer) ───── */
.nl-result {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px;
}
.nl-result-meta { color: var(--text-muted); margin-bottom: 6px; }
.nl-result-sql {
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  padding: 6px 10px; color: var(--green);
  white-space: pre-wrap;
}
.nl-result-table {
  margin-top: 8px; max-height: 280px; overflow: auto;
  border: 1px solid var(--line); border-radius: 5px;
}
.nl-result-table table { width: 100%; border-collapse: collapse; }
.nl-result-table th, .nl-result-table td {
  text-align: left; padding: 5px 9px;
  border-bottom: 1px solid var(--line); font-size: 11.5px;
}
.nl-result-table th { background: var(--bg-elev-2); position: sticky; top: 0; }

/* ───── Diff tab (C4) ───── */
.diff-label {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 12px;
}
.diff-section {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px; margin-bottom: 12px;
}
.diff-section h3 {
  margin: 0 0 8px; font-size: 13px; color: var(--text-dim);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.diff-grid {
  display: grid; grid-template-columns: minmax(200px, 2fr) 110px minmax(120px, 1fr) 180px;
  font-family: var(--mono); font-size: 12px;
  gap: 2px 12px;
  overflow-x: auto;
}
.diff-grid .row { display: contents; cursor: pointer; }
.diff-grid .row > div {
  padding: 5px 6px; border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diff-grid .row:hover > div { background: var(--bg-elev-2); }

/* ───── Letters tab ───── */
.letter-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 12px; margin-bottom: 8px;
  cursor: pointer;
}
.letter-card:hover { border-color: var(--accent-dim); }
.letter-meta { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.letter-ref  { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.letter-subject { color: var(--text-dim); font-size: 12.5px; }

/* ───── Toasts (C7) ───── */
.toasts {
  position: fixed; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 70;
  max-width: 380px;
}
.toast {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: toastIn 200ms ease;
  font-size: 12.5px;
}
.toast.toast-warn { border-left-color: var(--amber); }
.toast.toast-bad  { border-left-color: var(--red); }
.toast .toast-kind { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.toast .toast-text { color: var(--text); }
.toast .toast-sub  { color: var(--text-muted); font-family: var(--mono); font-size: 10.5px; }
@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ───── Drawer additions: notes + letter actions ───── */
.notes-panel { margin-top: 14px; }
.notes-list .note {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 6px;
}
.note-meta {
  color: var(--text-muted); font-size: 10.5px; font-family: var(--mono);
  margin-bottom: 4px;
}
.note-text { font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; }
.note-input-row {
  display: flex; gap: 6px; margin-top: 8px;
}
.note-input-row input { flex: 1; }
.letter-actions {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px;
}
.letter-actions select { min-width: 200px; }

/* ───── LLM-stub helper bar ───── */
.llm-stub-hint {
  background: rgba(245, 179, 64, 0.08);
  border: 1px solid rgba(245, 179, 64, 0.35);
  color: var(--amber);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  margin: 8px 0;
}

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 — Graph tab (C2)
   ════════════════════════════════════════════════════════════════════════ */

.graph-canvas {
  width: 100%;
  height: 640px;
  background: radial-gradient(ellipse at center, #0e1422 0%, #07090f 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  margin-top: 12px;
}
.graph-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.graph-canvas canvas:active { cursor: grabbing; }
.graph-tooltip {
  position: absolute;
  background: rgba(18, 24, 38, 0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
  z-index: 10;
  box-shadow: var(--shadow);
  max-width: 280px;
}
.graph-tooltip .lbl { font-weight: 600; color: var(--accent); }
.graph-tooltip .kv  { color: var(--text-dim); margin-top: 3px; }

.graph-legend {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px 14px;
  font-size: 11.5px; color: var(--text-dim);
  margin-top: 10px;
}
.graph-legend .legend-dot {
  width: 10px; height: 10px; display: inline-block;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.graph-legend .legend-sep { color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 — Predict tab (B1 · B2)
   ════════════════════════════════════════════════════════════════════════ */

.predict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .predict-grid { grid-template-columns: 1fr; }
}
.predict-col h3 {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.03em;
  font-size: 15px;
}
.predict-col .small { font-size: 11px; }
.pred-out, .anom-out {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  max-height: 560px;
  overflow-y: auto;
}
.pred-row, .anom-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.pred-row:last-child, .anom-row:last-child { border-bottom: none; }
.pred-row .rank, .anom-row .rank {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: right;
}
.pred-row .name {
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
}
.pred-row .score {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.anom-row .brand {
  font-family: var(--mono);
  color: var(--text);
}
.anom-row .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.anom-section-head {
  background: var(--bg-elev-2);
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 — A8 stylometric panel (in cluster drawer)
   ════════════════════════════════════════════════════════════════════════ */

.stylo-panel {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.stylo-panel h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.stylo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
}
.stylo-row:last-child { border-bottom: none; }
.stylo-row .why {
  color: var(--text-dim); font-size: 10.5px; margin-top: 2px;
  font-family: var(--mono);
}
.stylo-row .score-badge {
  font-family: var(--mono);
  background: rgba(110, 168, 255, 0.12);
  color: var(--accent);
  padding: 1px 6px; border-radius: 3px; font-size: 10.5px;
  align-self: start;
}

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 — D1 evidence-pack actions (in drawer)
   ════════════════════════════════════════════════════════════════════════ */

.pack-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.pack-status { color: var(--text-dim); font-size: 11px; }

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 batch 3 — Timeline heatmap (C3) · UPI tab (D5) · Precedent panel (A9)
   ════════════════════════════════════════════════════════════════════════ */

#timeline-stack {
  margin-top: 12px;
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 720px; overflow-y: auto;
  padding-right: 4px;
}
.timeline-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  gap: 8px; align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  cursor: pointer;
  transition: background 0.15s;
}
.timeline-row:hover { background: var(--bg-elev-2); }
.timeline-row .label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.timeline-row .heatstrip {
  display: flex; gap: 2px;
  height: 18px;
  overflow-x: auto;
}
.timeline-row .heat-cell { flex: 0 0 9px; height: 100%; border-radius: 1.5px; }
.timeline-row .total {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-align: right;
}
.heat-cell { display: inline-block; width: 12px; height: 12px; margin: 0 2px;
             vertical-align: middle; border-radius: 2px; }
.heat-0 { background: #1a2030; }
.heat-1 { background: #234a78; }
.heat-2 { background: #3a7ec2; }
.heat-3 { background: #5aa1ff; }
.heat-4 { background: #ff5a86; }
.timeline-legend {
  display: flex; align-items: center; gap: 4px;
  margin-top: 8px; padding: 4px 6px;
}

/* UPI tab */
.upi-empty { padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.upi-result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.upi-result-card h4 {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--mono);
}
.upi-result-card .meta { color: var(--text-dim); font-size: 11px; }
.upi-host-list {
  margin-top: 6px; font-family: var(--mono); font-size: 11px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.upi-host-list span {
  background: var(--bg-elev-2);
  padding: 1px 6px; border-radius: 3px;
  cursor: pointer;
}
.upi-host-list span:hover { color: var(--accent); }

/* A9 — precedent citation panel */
.precedent-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.precedent-panel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.precedent-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.precedent-item:last-child { border-bottom: none; }
.precedent-item .title {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
.precedent-item .citation {
  font-family: var(--mono);
  color: var(--text-dim);
  font-size: 10.5px;
  margin: 1px 0 3px;
}
.precedent-item .summary {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.4;
}
.precedent-tag {
  display: inline-block;
  background: rgba(110, 168, 255, 0.12);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--mono);
  margin: 0 4px 2px 0;
}
.precedent-unverified {
  background: rgba(255, 104, 104, 0.12);
  color: var(--red);
}

/* ════════════════════════════════════════════════════════════════════
   Phase 2 batch 4 — Cohorts (B4), Cost (B5), APKs (D4), Federation (D3)
   ════════════════════════════════════════════════════════════════════ */

/* — Cohorts — */
.cohort-card { border-left: 3px solid #a4d8ff; }
.cohort-overlap { margin: 4px 0 8px 0; }
.cohort-members { display: flex; flex-wrap: wrap; gap: 6px; }
.cohort-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(110, 168, 255, 0.08);
  border: 1px solid rgba(110, 168, 255, 0.18);
  color: var(--accent);
  padding: 3px 9px;
  border-radius: 14px;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: background-color .12s ease;
}
.cohort-chip:hover { background: rgba(110, 168, 255, 0.20); }
.cohort-chip .muted { color: var(--text-dim); font-size: 10px; }

/* — Cost — */
.cost-band {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cost-LOW       { background: rgba(124, 222, 124, 0.15); color: #7cde7c; }
.cost-MEDIUM    { background: rgba(255, 200, 96, 0.15);  color: #ffc860; }
.cost-HIGH      { background: rgba(255, 153, 96, 0.18);  color: #ff9960; }
.cost-VERY-HIGH { background: rgba(255, 104, 104, 0.20); color: var(--red); }
.cost-breakdown td { vertical-align: top; }
.cost-breakdown .delta-add { color: var(--red); font-family: var(--mono); }
.cost-breakdown .delta-sub { color: #7cde7c;    font-family: var(--mono); }
.cost-panel {
  margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 12px;
}
.cost-head {
  display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px;
}
.cost-head .kpi {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}
.row-link { cursor: pointer; }
.row-link:hover { background: rgba(255,255,255,.025); }

/* — APKs — */
.apk-card { border-left: 3px solid #ff9b6e; }
.apk-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.apk-meta { font-family: var(--mono); margin: 2px 0; }
.chip-warn {
  background: rgba(255, 153, 96, 0.18);
  color: #ff9960;
  border-color: rgba(255, 153, 96, 0.28);
}

/* — Federation — */
.fed-card { border-left: 3px solid #c69bff; }


/* ════════════════════════════════════════════════════════════════════
   LIVE TICKER — header strip showing in-the-wild liveness counts
   ════════════════════════════════════════════════════════════════════ */

.live-ticker {
  margin: 8px 0 14px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background:
    radial-gradient(circle at 15% 50%, rgba(124, 222, 124, 0.06), transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 104, 104, 0.045), transparent 40%),
    rgba(255, 255, 255, 0.015);
  overflow: hidden;
}
.lt-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.lt-cell {
  flex: 1 1 0;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: 0;
}
.lt-cell:hover { background: rgba(255, 255, 255, 0.025); }
.lt-cell:last-child { border-right: none; cursor: default; }
.lt-cell:last-child:hover { background: transparent; }

.lt-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: auto;
  white-space: nowrap;
}
.lt-num {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
  min-width: 60px;
  text-align: right;
}
.lt-delta {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding-left: 4px;
}
#lt-delta-alive { color: #7cde7c; }
#lt-delta-died  { color: var(--red); }

.lt-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.lt-dot-live {
  background: #7cde7c;
  box-shadow: 0 0 8px rgba(124, 222, 124, 0.55);
  animation: lt-heartbeat 2.2s ease-in-out infinite;
}
.lt-dot-dead {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 104, 104, 0.4);
}
.lt-dot-unreach {
  background: #ffaa55;
  box-shadow: 0 0 6px rgba(255, 170, 85, 0.35);
}
.lt-dot-unknown {
  background: #555;
  opacity: 0.6;
}

@keyframes lt-heartbeat {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.85; }
}

.lt-live    .lt-num { color: #7cde7c; }
.lt-dead    .lt-num { color: var(--red); }
.lt-unreach .lt-num { color: #ffaa55; }
.lt-unknown .lt-num { color: var(--text-dim); }

.lt-pulse-burst {
  animation: lt-burst 1.1s ease-out;
}
@keyframes lt-burst {
  0%   { background: rgba(124, 222, 124, 0.20); }
  100% { background: transparent; }
}

.lt-spark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  min-width: 140px;
}
.lt-spark-label {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.lt-spark-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .lt-row { flex-wrap: wrap; }
  .lt-cell { flex: 1 1 50%; border-bottom: 1px solid rgba(255,255,255,.05); }
  .lt-num { font-size: 22px; }
}

