/* SimplifyDynamics Portal — minimal style. Print-friendly + iPhone-friendly. */

:root {
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --bg: #fafaf8;
  --card: #ffffff;
  --border: #e2e2dc;
  --accent: #2c5282;
  --accent-bg: #ebf2fb;
  --error: #b03030;
  --critical: #b03030;
  --high: #c97a30;
  --normal: #4a7048;
  --low: #7a7a7a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
}

.nav { display: flex; align-items: center; gap: 0.75rem; }
.user { color: var(--muted); font-size: 0.9rem; }
.inline { display: inline; margin: 0; }

button.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
button.link:hover { text-decoration: underline; }

.container {
  max-width: 64rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.2rem; }

label {
  display: block;
  margin: 0.75rem 0;
}
label > input {
  display: block;
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

button.primary {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
button.primary:hover { background: #1f3e63; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.error { color: var(--error); margin: 0.5rem 0; }

.client-list { list-style: none; padding: 0; }
.client-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.client-list a { color: var(--accent); text-decoration: none; }

/* Run / decision tables (forward-compat for Day 3+) */
table.runs, table.decisions {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.runs th, table.runs td,
table.decisions th, table.decisions td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
table.runs th, table.decisions th {
  background: var(--accent-bg);
  font-weight: 600;
}

.severity-critical { color: var(--critical); font-weight: 600; }
.severity-high     { color: var(--high); font-weight: 600; }
.severity-normal   { color: var(--normal); }
.severity-low      { color: var(--low); }

.action-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent);
}

table.runs td.num, table.runs th.num,
table.decisions td.num, table.decisions th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.status-ok  { color: var(--normal); font-weight: 600; }
.status-bad { color: var(--error); font-weight: 600; }

code {
  background: var(--accent-bg);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

@media (max-width: 640px) {
  .container { padding: 0 0.75rem; margin: 0.75rem auto; }
  .card { padding: 1rem; }
  table.runs, table.decisions { font-size: 0.85rem; }
}

/* ============================================================================
   Run drill-in — Deep Space Blue dark surface, scoped under `.drillin`.
   Palette (per Dan 2026-05-10):
     #023047 deep-space  #219ebc blue-green  #8ecae6 sky-blue
     #fb8500 tiger-orange  #ffb703 amber-flame
   Mirrors the bot's HTML decision-log attachment so the per-run surface in the
   portal feels like the same artifact Mihran sees in his daily email.
   ============================================================================ */

.drillin {
  background: #023047;
  color: #e8f4f9;
  border-radius: 10px;
  padding: 4px 22px 24px;
  margin: 0 0 1rem;
  border: 1px solid rgba(142, 202, 230, 0.18);
  font-size: 14px;
  line-height: 1.5;
}

.drillin a { color: #ffb703; text-decoration: none; }
.drillin a:hover { color: #fb8500; text-decoration: underline; }

.drillin .banner { padding: 22px 4px 18px; }
.drillin .back-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 12px;
}
.drillin .back-row .muted { color: #8ecae6; }
.drillin .eyebrow {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #8ecae6; font-weight: 700;
}
.drillin h1 {
  font-size: 26px; font-weight: 700; margin: 4px 0 4px;
  line-height: 1.2; color: #ffffff; letter-spacing: -0.01em;
}
.drillin .meta { font-size: 13px; color: #8ecae6; }
.drillin .meta strong { color: #ffffff; font-weight: 700; }
.drillin .meta .ok { color: #8ecae6; }
.drillin .meta .bad { color: #fb8500; }

.drillin .stat-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin-bottom: 18px;
}
.drillin .stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(142, 202, 230, 0.18);
  border-radius: 10px; padding: 14px 16px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.drillin .stat-card:hover {
  transform: translateY(-1px); border-color: #8ecae6;
  background: rgba(142, 202, 230, 0.06);
}
.drillin .stat-card.active {
  border-color: #fb8500; background: rgba(251, 133, 0, 0.08);
}
.drillin .stat-label {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 4px;
}
.drillin .stat-value {
  font-size: 28px; font-weight: 700; color: #ffffff; line-height: 1;
}

.drillin .aux {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(142, 202, 230, 0.18);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 18px;
}
.drillin .aux h2 {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #8ecae6; margin: 0 0 6px; font-weight: 700;
}
.drillin .aux .row {
  display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start;
}
.drillin .aux .col { flex: 1 1 0; min-width: 0; }
.drillin .chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0;
  background: rgba(33, 158, 188, 0.18); color: #e8f4f9;
  border: 1px solid rgba(142, 202, 230, 0.25);
}
.drillin .chip.role strong { color: #ffffff; }
.drillin .aux ul {
  margin: 4px 0 0; padding-left: 16px; columns: 2; column-gap: 16px;
  font-size: 13px; color: #cbe1ec;
}
.drillin .aux li { break-inside: avoid; margin: 1px 0; }
.drillin .muted { color: #8ecae6; font-size: 12px; }

.drillin .filter-row {
  display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
}
.drillin #filter-box {
  flex: 1; padding: 10px 14px;
  border: 1px solid rgba(142, 202, 230, 0.3); border-radius: 8px;
  font-size: 14px; background: rgba(255, 255, 255, 0.06); color: #ffffff;
  font-family: inherit;
}
.drillin #filter-box::placeholder { color: #8ecae6; opacity: 0.7; }
.drillin #filter-box:focus {
  outline: none; border-color: #ffb703;
  box-shadow: 0 0 0 3px rgba(255, 183, 3, 0.18);
}
.drillin .filter-row .hint { color: #8ecae6; font-size: 12px; opacity: 0.8; }

.drillin .table-wrap {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(142, 202, 230, 0.18);
  border-radius: 10px; overflow: auto;
}
.drillin table#decisions { width: 100%; border-collapse: collapse; }
.drillin thead th {
  background: rgba(2, 48, 71, 0.85);
  text-align: left; padding: 11px 12px; font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #8ecae6; cursor: pointer; user-select: none;
  border-bottom: 1px solid rgba(142, 202, 230, 0.18); font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
.drillin thead th.num { text-align: right; }
.drillin thead th:hover { background: rgba(33, 158, 188, 0.22); color: #ffffff; }
.drillin thead th[data-sort-dir="asc"]::after  { content: " ▲"; color: #ffb703; font-size: 10px; }
.drillin thead th[data-sort-dir="desc"]::after { content: " ▼"; color: #ffb703; font-size: 10px; }
.drillin tbody td {
  padding: 10px 12px; vertical-align: top;
  border-bottom: 1px solid rgba(142, 202, 230, 0.08);
  font-size: 13px; color: #e8f4f9;
}
.drillin tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.drillin tbody tr:last-child td { border-bottom: none; }
.drillin tbody tr:hover { background: rgba(142, 202, 230, 0.05); }
.drillin tbody tr.top-of-list { background: rgba(251, 133, 0, 0.08); }
.drillin tbody tr.top-of-list:hover { background: rgba(251, 133, 0, 0.13); }

.drillin .action-chip {
  display: inline-block; padding: 3px 9px; border-radius: 12px;
  color: #ffffff; font-size: 11px; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.02em;
}
.drillin .when { color: #8ecae6; font-size: 12px; white-space: nowrap; }
.drillin .from { color: #cbe1ec; }
.drillin .subject { color: #ffffff; font-weight: 500; }
.drillin .reason {
  color: #8ecae6; font-style: italic; font-size: 12px;
  line-height: 1.4; opacity: 0.92;
}

.drillin .severity-pill {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.drillin .sev-critical { background: #fb8500; color: #ffffff; }
.drillin .sev-high     { background: rgba(251, 133, 0, 0.22); color: #ffb703; }
.drillin .sev-normal   { background: rgba(33, 158, 188, 0.22); color: #8ecae6; }
.drillin .sev-low      { background: rgba(142, 202, 230, 0.12); color: #8ecae6; }

.drillin .row-actions { display: flex; gap: 12px; margin-top: 4px; }
.drillin .why-btn, .drillin .explain-btn {
  background: none; border: 0; cursor: pointer;
  font-size: 11px; text-decoration: underline; padding: 0;
  font-family: inherit;
}
.drillin .why-btn      { color: #ffb703; }
.drillin .explain-btn  { color: #8ecae6; }
.drillin .why-btn:hover, .drillin .explain-btn:hover { color: #ffffff; }

.drillin .why-detail {
  display: none; background: rgba(2, 48, 71, 0.6);
  font-size: 12px; padding: 10px 12px;
  border-radius: 6px; margin: 6px 0 0; color: #cbe1ec;
  border: 1px solid rgba(142, 202, 230, 0.18);
}
.drillin .why-detail.open { display: block; }
.drillin .why-detail .kv {
  padding: 3px 0;
  border-bottom: 1px solid rgba(142, 202, 230, 0.06);
}
.drillin .why-detail .kv:last-child { border-bottom: 0; }
.drillin .why-detail dt {
  color: #ffffff; font-weight: 700; margin: 0;
  font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
}
.drillin .why-detail dd {
  color: #cbe1ec; font-weight: 400; margin: 1px 0 0;
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11.5px;
  word-break: break-word;
}

.drillin .explain-panel {
  display: none; background: rgba(33, 158, 188, 0.10);
  font-size: 12.5px; line-height: 1.5; padding: 10px 12px;
  border-radius: 6px; margin: 6px 0 0; color: #e8f4f9;
  border: 1px solid rgba(142, 202, 230, 0.22);
}
.drillin .explain-panel.open { display: block; }

.drillin .inbox-summaries {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(142, 202, 230, 0.18);
  border-radius: 10px; padding: 16px 18px 12px; margin-bottom: 18px;
}
.drillin .section-eyebrow {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #8ecae6; margin: 0 0 10px; font-weight: 700;
}
.drillin .inbox-summary {
  padding: 8px 0; border-bottom: 1px solid rgba(142, 202, 230, 0.10);
}
.drillin .inbox-summary:last-child { border-bottom: 0; }
.drillin .inbox-label {
  font-size: 11px; font-weight: 700; color: #ffb703;
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 3px;
}
.drillin .inbox-summary p {
  margin: 0; font-size: 13px; line-height: 1.55; color: #e8f4f9;
}

.drillin .redacted { color: #fb8500; font-style: italic; opacity: 0.92; }
.drillin tbody tr.redacted-row { background: rgba(251, 133, 0, 0.04); }

.drillin .empty {
  text-align: center; padding: 40px; color: #8ecae6; font-size: 14px;
}

@media (max-width: 900px) {
  .drillin .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .drillin .aux ul { columns: 1; }
}
@media (max-width: 640px) {
  .drillin { padding: 4px 12px 16px; }
  .drillin h1 { font-size: 22px; }
  .drillin .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .drillin .stat-card { padding: 10px 12px; }
  .drillin .stat-value { font-size: 22px; }
  .drillin thead th, .drillin tbody td { padding: 8px 8px; font-size: 12px; }
  .drillin .filter-row { flex-direction: column; align-items: stretch; }
  .drillin .filter-row .hint { display: none; }
}
