/* SOC CoPilot web console — light admin-dashboard theme.
   Accents: indigo (actions/links), dark teal pills (metadata badges), card
   layout per the report mock. All assets local; system font stack. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --pill: #155e75;
  --pill-text: #ffffff;
  --ok: #16a34a;
  --warn: #ca8a04;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.05);
  --font: -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; }
a { color: var(--primary); }

/* ---------- shared ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--primary); }
.btn-wide { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--pill);
  color: var(--pill-text);
  white-space: nowrap;
}
.chip-muted { background: #f1f5f9; color: var(--text-muted); }
.chip-ok { background: #dcfce7; color: #166534; }
.chip-warn { background: #fef9c3; color: #854d0e; }
.chip-bad { background: #fee2e2; color: #991b1b; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- login ---------- */
.view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 20% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, #ccfbf1 0%, transparent 55%),
    var(--bg);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
  width: min(400px, 92vw);
  padding: 40px 36px;
  text-align: center;
}
.brand-mark { margin-bottom: 14px; }
.login-logo { height: 34px; width: auto; }
.login-card h1 { font-size: 24px; letter-spacing: -0.02em; }
.login-sub {
  margin: 2px 0 18px;
  color: var(--pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11.5px;
}
.login-detail { color: var(--text-muted); font-size: 13.5px; margin: 0 0 22px; }
.login-waiting { margin-top: 16px; color: var(--text-muted); font-size: 13.5px; }
.dev-login { display: flex; gap: 8px; margin-top: 14px; }
.dev-login input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  outline: none;
}
.dev-login input:focus { border-color: var(--primary); }

/* ---------- topbar ---------- */
.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 15px;
}
.topbar-brand span { color: var(--text-muted); font-weight: 600; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mcp-health { display: inline-flex; gap: 5px; }
.mcp-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border);
}
.mcp-dot.ok { background: var(--ok); }
.mcp-dot.bad { background: var(--bad); }

/* ---------- tenant lock banner ---------- */
.tenant-banner {
  background: var(--pill);
  color: var(--pill-text);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tenant-banner .tb-id {
  font-family: var(--mono);
  font-weight: 400;
  opacity: 0.8;
  font-size: 12px;
}

/* ---------- chat layout ---------- */
.view-chat { height: 100vh; display: flex; flex-direction: column; }
.chat-layout {
  flex: 1;
  display: flex;
  gap: 18px;
  padding: 18px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 12px 2px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg { max-width: 82%; }
.msg-user { align-self: flex-end; }
.msg-user .bubble {
  background: var(--primary);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.msg-agent { align-self: flex-start; max-width: 92%; }
.msg-agent .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  overflow-wrap: break-word;
}
.msg-agent .bubble > :first-child { margin-top: 4px; }
.msg-agent .bubble > :last-child { margin-bottom: 4px; }
.bubble pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
}
.bubble code { font-family: var(--mono); font-size: 0.92em; }
.bubble :not(pre) > code { background: var(--primary-soft); border-radius: 4px; padding: 1px 5px; }
.bubble table { border-collapse: collapse; margin: 8px 0; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 5px 9px; font-size: 13px; }

.msg-system {
  align-self: center;
  color: var(--text-muted);
  font-size: 12.5px;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 14px;
}
.msg-error { background: #fee2e2; color: #991b1b; }

.turn-meta {
  align-self: center;
  color: #94a3b8;
  font-size: 11.5px;
}

/* permission card */
.perm-card {
  align-self: stretch;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  border-radius: var(--radius);
  padding: 12px 16px;
}
.perm-card h3 { font-size: 14px; margin-bottom: 4px; }
.perm-card .perm-desc { color: var(--text-muted); font-size: 13px; margin: 0 0 8px; }
.perm-card pre {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.perm-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-approve { background: var(--ok); color: #fff; }
.btn-deny { background: var(--card); border-color: var(--border); color: var(--bad); }
.perm-resolved { opacity: 0.55; pointer-events: none; }

/* AskUserQuestion picker — a question, not a warning gate, so neutral chrome */
.q-card { border-color: var(--border); background: var(--primary-soft); }
.q-block { margin: 10px 0 4px; }
.q-block + .q-block { border-top: 1px solid var(--border); padding-top: 10px; }
.q-header {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--primary);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; margin-bottom: 6px;
}
.q-q { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.q-opt {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}
.q-opt:hover { border-color: var(--primary); }
.q-opt input { margin-top: 2px; flex: none; }
.q-opt-text { display: flex; flex-direction: column; gap: 2px; }
.q-opt-text strong { font-size: 13px; }
.q-opt-desc { color: var(--text-muted); font-size: 12px; }
.q-other-text {
  flex: 1; font: inherit; font-size: 13px; border: none; background: transparent;
  padding: 0; outline: none;
}
.q-card.q-needs-input .perm-actions::after {
  content: "Pick at least one option."; color: var(--bad); font-size: 12px; align-self: center;
}

/* composer */
/* ---------- activity indicator ---------- */
.activity {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  margin: 2px 2px 0;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--primary-soft);
  border-radius: 10px;
  align-self: flex-start;
}
.activity.waiting { background: #fffbeb; color: #854d0e; }
.activity-text { font-weight: 600; }
.activity-timer { color: #94a3b8; font-size: 12px; font-variant-numeric: tabular-nums; }
.activity-dots { display: inline-flex; gap: 3px; }
.activity-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  display: inline-block;
  animation: act-bounce 1.2s infinite ease-in-out both;
}
.activity.waiting .activity-dots i { background: var(--warn); }
.activity-dots i:nth-child(1) { animation-delay: -0.24s; }
.activity-dots i:nth-child(2) { animation-delay: -0.12s; }
@keyframes act-bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
/* send button "busy" state — a spinner, but still clickable to queue a follow-up */
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* report nudge — shown once an investigation is underway with no report yet */
.report-nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  margin: 4px 2px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 13px;
  color: #854d0e;
}
.report-nudge-txt { flex: 1; }
.report-nudge .btn { padding: 6px 12px; font-size: 12.5px; }

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
}
.composer.drag { outline: 2px dashed var(--primary); outline-offset: 3px; }
.composer-main { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  border: 0;
  resize: none;
  font: inherit;
  outline: none;
  max-height: 160px;
  background: transparent;
}
.composer-attach {
  background: transparent; border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 4px 2px;
  color: var(--text-muted); align-self: flex-end;
}
.composer-attach:hover { color: var(--primary); }
.composer-note { color: var(--bad); font-size: 12px; min-height: 0; }
.composer-note:empty { display: none; }
.composer-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.composer-thumbs.hidden { display: none; }
.composer-thumb {
  position: relative; width: 56px; height: 56px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.composer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.composer-thumb button {
  position: absolute; top: 1px; right: 1px;
  width: 16px; height: 16px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; line-height: 16px; text-align: center; cursor: pointer; padding: 0;
}
/* images inside a chat bubble */
.bubble-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
.bubble-imgs + div { margin-top: 6px; }
.chat-img {
  max-width: 220px; max-height: 220px;
  border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in;
}

/* ---------- timeline rail ---------- */
.rail { width: 320px; flex-shrink: 0; min-height: 0; display: flex; }
.rail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  width: 100%;
  overflow-y: auto;
}
.rail-card h2 { font-size: 15px; margin-bottom: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline li {
  position: relative;
  padding: 0 0 14px 26px;
  font-size: 12.5px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 1px; top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1.5px #38bdf8;
}
.timeline li.pending::before { background: var(--card); box-shadow: 0 0 0 1.5px var(--warn); }
.timeline li.error::before { background: var(--bad); box-shadow: 0 0 0 1.5px var(--bad); }
.timeline .t-tool { font-weight: 700; }
.timeline .t-time {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeline .t-sub {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: break-word;
  display: block;
}
.timeline img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 6px;
}

/* ---------- reports modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
  z-index: 50;
}
.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  width: min(560px, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; }
.reports-list { list-style: none; margin: 0; padding: 8px; }
.reports-list li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.reports-list li:hover { background: var(--primary-soft); }
.reports-list .r-ref { color: var(--pill); font-weight: 700; font-size: 12.5px; }
.reports-list .r-title { font-weight: 600; }
.reports-list .r-date { color: var(--text-muted); font-size: 12px; }
.reports-empty { color: var(--text-muted); padding: 18px; text-align: center; }

/* ---------- detail modal (KQL inspection) ---------- */
.detail-body { padding: 14px 18px; }
.detail-body .d-intent { font-size: 14px; margin: 0 0 10px; }
.detail-body .d-meta { color: var(--text-muted); font-size: 12.5px; margin: 0 0 10px; }
.detail-body pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  margin: 0;
}
.timeline li.inspectable { cursor: pointer; }
.timeline li.inspectable:hover .t-tool { color: var(--primary); text-decoration: underline; }

/* generic-playbook warning band, under the title before the analysis */
.generic-banner {
  grid-column: 1 / -1;
  padding: 12px 22px;
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

/* customer-context call-out band: informational amber, distinct from the red
   generic-playbook warning */
.context-banner {
  grid-column: 1 / -1;
  padding: 12px 22px;
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
  font-size: 14px;
}
.context-banner-title { font-weight: 700; margin-bottom: 6px; }
.context-banner ul { margin: 0; padding-left: 18px; }
.context-banner li { margin: 3px 0; }
.context-banner code { font-size: 12.5px; }
.context-unavailable-note {
  grid-column: 1 / -1;
  padding: 10px 22px;
  color: var(--text-muted);
  font-size: 13px;
}

/* reports modal search */
.reports-search {
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
}

/* customer-context admin page (/context) */
.ctx-text { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
tr.ctx-archived td { color: var(--text-muted); }
tr.ctx-expired .ctx-text { color: var(--text-muted); }
#f-text { resize: vertical; font: inherit; }

/* ---------- report feedback ---------- */
.feedback-section {
  grid-column: 1 / -1;
  padding: 12px 22px;
}
.feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.feedback-label { color: var(--text-muted); font-size: 13px; }
.btn-agree { background: var(--ok); color: #fff; }
.btn-disagree { background: var(--card); border-color: var(--border); color: var(--bad); }
.feedback-recorded { font-size: 13px; font-weight: 600; }
.feedback-recorded.agree { color: var(--ok); }
.feedback-recorded.disagree { color: var(--bad); }

/* ---------- report view ---------- */
.report-root {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 18px 60px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}
.report-head {
  grid-column: 1 / -1;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.report-ref {
  color: var(--text-muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.report-title { font-size: 24px; letter-spacing: -0.01em; }
.report-client { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }
.report-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.report-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.report-section { padding: 18px 22px; }
.report-section h2 { font-size: 16px; margin-bottom: 10px; }
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 10px; flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 0; }
.summary-prose { white-space: pre-wrap; }
/* impact callout — clearly separated from the narrative, colour-cued by level */
.impact-callout {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--slate, #64748b);
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.impact-callout .impact-tag {
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.impact-callout .impact-note { font-size: 13.5px; }
.impact-none_observed { border-left-color: var(--ok); background: #f0fdf4; }
.impact-none_observed .impact-tag { color: #166534; }
.impact-unconfirmed { border-left-color: var(--warn); background: #fefce8; }
.impact-unconfirmed .impact-tag { color: #854d0e; }
.impact-confirmed { border-left-color: var(--bad); background: #fef2f2; }
.impact-confirmed .impact-tag { color: #991b1b; }

/* evidence & reasoning — scannable, not a muted wall */
.rationale-h {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 18px 0 8px;
}
.rationale { font-size: 13.5px; line-height: 1.65; color: var(--text); }
.rationale p { margin: 0 0 8px; }
.rationale ul, .rationale ol { margin: 0; padding-left: 18px; }
.rationale li { margin-bottom: 7px; }
.rationale li::marker { color: var(--primary); }
.rationale strong { color: var(--text); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
  text-align: left; color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border); padding: 4px 8px 6px 0;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}
.mini-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.mini-table td.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.empty-note { color: var(--text-muted); font-size: 13px; }

.etimeline { list-style: none; margin: 0; padding: 0; }
.etimeline li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.etimeline .ts {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--pill);
  white-space: nowrap;
  padding-top: 2px;
}
.recommendations li { margin-bottom: 6px; }

.verdict-pill { font-size: 13px; padding: 6px 14px; }
.verdict-TRUE_POSITIVE { background: var(--bad); }
.verdict-FALSE_POSITIVE { background: var(--ok); }
.verdict-UNDETERMINED { background: var(--warn); }
.sev-High, .sev-Critical { background: var(--bad); }
.sev-Medium { background: #ea580c; }
.sev-Low { background: var(--warn); }
.sev-Informational { background: #64748b; }

/* ---------- analytics page ---------- */
.mx-refresh { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.mx-updated { font-size: 12px; color: var(--text-muted); }
.mx-wrap { max-width: 1320px; margin: 16px auto; padding: 0 18px 60px; display: flex; flex-direction: column; gap: 18px; }
.mx-note { color: var(--text-muted); font-size: 12px; text-align: center; }
.mx-card { padding: 18px 20px; }
.mx-card h2 { font-size: 14.5px; margin-bottom: 14px; }
/* card header row: title left, action (e.g. Export CSV) right */
.mx-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mx-card-head h2 { margin-bottom: 14px; }
.mx-card-head .btn { padding: 6px 12px; font-size: 12.5px; }
.mx-sub { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.mx-chart { width: 100%; }
.mx-table { overflow-x: auto; }

/* KPI stat cards */
.mx-kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.mx-kpi-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.mx-kpi-ic {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.mx-kpi-txt { display: flex; flex-direction: column; min-width: 0; }
.mx-kpi-v { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.mx-kpi-l { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.mx-kpi-s { font-size: 11px; color: #94a3b8; }

/* rows */
/* analysis row: determinations gets its own column, top-N a roomy 2×2 grid */
.mx-row-analysis { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.mx-topgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mx-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.mx-determinations { align-self: stretch; }

/* donut */
.mx-donut-wrap { display: flex; align-items: center; gap: 14px; }
.mx-donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.mx-leg-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.mx-leg-row i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.mx-leg-row span { flex: 1; color: var(--text-muted); }
.mx-leg-row em { color: #94a3b8; font-style: normal; font-size: 11.5px; }
.mx-agreement { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.mx-agree-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.mx-agree-l { flex-basis: 46%; color: var(--text-muted); }
.mx-agree-track { flex: 1; height: 7px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.mx-agree-track div { height: 100%; border-radius: 4px; }
.mx-agree-row b { width: 38px; text-align: right; }

/* top-N bar lists */
.mx-barlist { display: flex; flex-direction: column; gap: 10px; }
.mx-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.mx-bar-l { flex-basis: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-bar-track { flex: 1; height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.mx-bar-track div { height: 100%; border-radius: 4px; }
.mx-bar-row b { min-width: 44px; text-align: right; font-size: 12px; }

.det-none { color: #94a3b8; font-style: italic; }
.mx-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.mx-leg { display: inline-flex; align-items: center; gap: 5px; }
.mx-leg i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

@media (max-width: 1100px) {
  .mx-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .mx-row-analysis { grid-template-columns: 1fr; }
  .mx-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .mx-kpi-row, .mx-topgrid { grid-template-columns: 1fr; }
}

.conn-banner {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: #0f172a; color: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  z-index: 100;
}

@media (max-width: 980px) {
  .rail { display: none; }
  .report-root { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .conn-banner { display: none !important; }
  body { background: #fff; }
  .report-root { grid-template-columns: 1fr 260px; padding: 0; }
  .card { box-shadow: none; }
}
.mx-signin { max-width: 420px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 32px; }

/* ---------- opt-out admin page ---------- */
.oo-wrap { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.oo-intro { color: var(--text-muted); font-size: 13px; margin: 0; }
.oo-card { padding: 18px 20px; }
.oo-card h2 { font-size: 14.5px; margin-bottom: 14px; }
.oo-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.oo-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 180px; }
.oo-field-wide { flex-basis: 100%; }
.oo-field span { font-size: 12px; color: var(--text-muted); }
.oo-field input {
  font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text);
  outline: none;
}
.oo-field input:focus { border-color: var(--primary); }
.oo-note { margin-top: 10px; font-size: 12.5px; min-height: 0; }
.oo-note:empty { display: none; }
.oo-table { overflow-x: auto; }
.oo-mono { font-family: var(--mono); font-size: 12px; }
.oo-mini { width: 100%; }
.oo-mini td, .oo-mini th { vertical-align: middle; }
.oo-mini .btn-deny { padding: 4px 10px; font-size: 12px; }
