/* Styles for the command-center screens (triage, analyses, operations,
   assistant, home strip). Uses the tokens defined in index.html. */

.top-nav { overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.top-nav button { white-space: nowrap; }
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px;
  background: var(--amber); color: var(--ink); font-size: 0.7rem; line-height: 18px; text-align: center; font-weight: 700;
}
.nav-badge[data-tone="crit"] { background: var(--red); color: var(--tile-ink); }
.nav-badge[data-tone="ok"] { background: var(--green-bright); color: var(--tile-ink); }

/* ---- shared bits ---- */
.cc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cc-head h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; }
.cc-head .cc-sub { color: var(--ink-dim); font-size: 0.82rem; flex: 1; min-width: 200px; }
.cc-card { background: var(--bg-alt); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; }
.cc-card h3 { font-family: var(--font-display); font-size: 0.95rem; margin: 0 0 2px; }
.cc-card .cc-note { font-size: 0.78rem; color: var(--ink-dim); margin-bottom: 10px; }
.cc-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cc-grow { flex: 1; min-width: 0; }
.cc-muted { color: var(--ink-dim); }
.cc-empty { padding: 18px 0; color: var(--ink-dim); font-size: 0.88rem; font-style: italic; }
.cc-loading { padding: 24px 0; text-align: center; color: var(--ink-dim); }
.cc-error { background: #F6E1DC; border: 1px solid var(--red); border-radius: 10px; padding: 10px 14px; color: var(--ink); font-size: 0.85rem; margin-bottom: 12px; }
.cc-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; background: rgba(23,35,28,0.08); color: var(--ink-dim); }
.cc-pill.good, .cc-pill.ok { background: rgba(47,107,79,0.16); color: var(--green); }
.cc-pill.bad, .cc-pill.crit, .cc-pill.failing { background: rgba(178,67,47,0.16); color: var(--red); }
.cc-pill.warn, .cc-pill.late { background: rgba(224,160,48,0.22); color: #8A5F10; }
.cc-pill.info, .cc-pill.unknown { background: rgba(23,35,28,0.08); color: var(--ink-dim); }
.cc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.cc-table th { text-align: left; font-weight: 600; color: var(--ink-dim); font-size: 0.74rem; padding: 6px 8px; }
.cc-table td { padding: 7px 8px; border-top: 1px solid var(--rule); vertical-align: top; }
.cc-table td.num, .cc-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cc-tabs { display: flex; gap: 6px; flex-wrap: wrap; background: var(--bg-alt); border-radius: 10px; padding: 4px; width: fit-content; max-width: 100%; margin-bottom: 14px; }
.cc-tabs button { background: transparent; color: var(--ink-dim); padding: 6px 12px; border-radius: 8px; }
.cc-tabs button.active { background: var(--green); color: var(--tile-ink); }
.cc-bars { display: flex; flex-direction: column; gap: 6px; }
.cc-spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.cc-spark i { flex: 1; background: var(--green-bright); border-radius: 2px 2px 0 0; min-height: 2px; }
.cc-spark i.empty { background: rgba(23,35,28,0.12); }
.cc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
select.cc-select, input.cc-input, textarea.cc-input {
  font-family: var(--font-body); font-size: 0.85rem; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg-alt); color: var(--ink);
}
textarea.cc-input { width: 100%; resize: vertical; }

/* ---- home command strip ---- */
.command-strip { margin-bottom: 18px; }
.cmd-card { background: var(--tile-bg); color: var(--tile-ink); border-radius: 12px; padding: 14px 18px; cursor: pointer; }
.cmd-card:hover { background: var(--tile-bg-2); }
.cmd-card .cmd-title { font-family: var(--font-display); font-size: 0.8rem; color: var(--tile-ink-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.cmd-card .cmd-main { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin: 2px 0; }
.cmd-card .cmd-sub { font-size: 0.8rem; color: var(--tile-ink-dim); }
.cmd-card.warn .cmd-main { color: #F3C469; }
.cmd-card.crit .cmd-main { color: #F29A89; }

/* ---- triage ---- */
.tri-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tri-stat { background: var(--bg-alt); border-radius: 12px; padding: 10px 16px; min-width: 130px; }
.tri-stat b { font-family: var(--font-display); font-size: 1.5rem; display: block; }
.tri-stat span { font-size: 0.78rem; color: var(--ink-dim); }
.tri-group { background: var(--bg-alt); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.tri-group > header { position: static; height: auto; background: transparent; color: var(--ink); padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tri-group > header h3 { font-family: var(--font-display); font-size: 1rem; margin: 0; flex: 1; min-width: 160px; }
.tri-group > header .cc-sub { font-size: 0.78rem; color: var(--ink-dim); width: 100%; order: 3; }
.tri-card { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--rule); align-items: start; }
.tri-card input[type=checkbox] { margin-top: 5px; width: 16px; height: 16px; }
.tri-name { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; }
.tri-meta { font-size: 0.8rem; color: var(--ink-dim); margin-top: 2px; word-break: break-word; }
.tri-meta a { color: var(--green); }
.tri-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tri-chip { font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: rgba(23,35,28,0.08); color: var(--ink-dim); }
.tri-chip.good { background: rgba(47,107,79,0.14); color: var(--green); }
.tri-chip.bad { background: rgba(178,67,47,0.14); color: var(--red); }
.tri-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.tri-prob { font-size: 0.74rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.tri-more { font-size: 0.78rem; color: var(--green); cursor: pointer; background: none; padding: 0; text-decoration: underline; }
.tri-why { margin-top: 8px; font-size: 0.78rem; background: rgba(23,35,28,0.04); border-radius: 8px; padding: 8px 10px; }
.tri-why div { display: flex; gap: 8px; }
.tri-why .d { width: 42px; text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tri-backtest { font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 12px; }
.tri-backtest strong { color: var(--ink); }
@media (max-width: 700px) {
  .tri-card { grid-template-columns: 22px 1fr; }
  .tri-actions { grid-column: 2; flex-direction: row; align-items: center; }
}

/* ---- analyses ---- */
.ana-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.ana-flag { border-top: 1px solid var(--rule); padding: 12px 0; }
.ana-flag:first-child { border-top: none; }
.ana-flag .ana-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ana-flag .ana-photos img { height: 120px; border-radius: 8px; border: 1px solid var(--rule); cursor: zoom-in; }
.ana-json { background: rgba(23,35,28,0.05); border-radius: 8px; padding: 8px 10px; font-size: 0.74rem; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* ---- operations ---- */
.ops-job { display: grid; grid-template-columns: 16px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--rule); }
.ops-job:first-of-type { border-top: none; }
.ops-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-dim); }
.ops-dot.ok { background: var(--green-bright); }
.ops-dot.late { background: var(--amber); }
.ops-dot.failing { background: var(--red); }
.ops-check { padding: 10px 0; border-top: 1px solid var(--rule); }
.ops-check:first-of-type { border-top: none; }
.ops-sample { font-size: 0.76rem; color: var(--ink-dim); margin-top: 4px; }

/* ---- assistant ---- */
.as-wrap { display: flex; flex-direction: column; gap: 12px; }
.as-log { background: var(--bg-alt); border-radius: 12px; padding: 16px; min-height: 320px; max-height: calc(100vh - 340px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.as-msg { max-width: 92%; font-size: 0.9rem; line-height: 1.55; word-break: break-word; }
.as-msg.user { white-space: pre-wrap; }
.as-msg.bot pre { margin: 6px 0; }
.as-msg.bot table { margin: 6px 0; }
.as-msg.user { align-self: flex-end; background: var(--green); color: var(--tile-ink); padding: 8px 14px; border-radius: 14px 14px 4px 14px; }
.as-msg.bot { align-self: flex-start; }
.as-msg.bot code { background: rgba(23,35,28,0.07); padding: 1px 5px; border-radius: 4px; font-size: 0.82rem; }
.as-tool { align-self: flex-start; background: rgba(23,35,28,0.05); border-left: 3px solid var(--green-bright); border-radius: 0 8px 8px 0; padding: 6px 10px; font-size: 0.76rem; color: var(--ink-dim); max-width: 92%; }
.as-tool summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.as-tool pre { margin: 6px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.72rem; }
.as-form { display: flex; gap: 8px; align-items: flex-end; }
.as-form textarea { flex: 1; min-height: 46px; max-height: 160px; }
.as-suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.as-suggest button { background: var(--bg-alt); color: var(--ink); border: 1px solid var(--rule); font-weight: 500; font-size: 0.78rem; }
.as-thinking { color: var(--ink-dim); font-style: italic; font-size: 0.85rem; }
