/* ============================================================================
   AeroTrace demo UI — Cognizant AIA Hackathon 2026
   Palette: Cognizant navy → blue → cyan/teal (the brand's shades of blue).
   Plain CSS, no framework, no build step.
   ============================================================================ */
:root {
  --c-navy:    #00113a;   /* deepest — header background */
  --c-navy-2:  #001b45;
  --c-blue:    #0a3aa0;   /* mid blue */
  --c-blue-2:  #1466c8;
  --c-cyan:    #00c9d7;   /* accent / hackathon tag */
  --c-cyan-2:  #2ec5e6;

  --bg:        #eef3fa;   /* app background */
  --panel:     #ffffff;
  --line:      #d7e0ee;
  --text:      #0b1b3a;
  --muted:     #5a6b8c;

  --ok:        #1f9d55;
  --warn:      #e08a00;
  --fail:      #d33a2c;
  --info:      #1466c8;

  --radius:    12px;
  --shadow:    0 2px 10px rgba(0, 27, 69, .08);
  --font:      system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
code { background: #eaf0fb; padding: 1px 5px; border-radius: 5px; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }

/* ------------------------------- header ------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px;
  background: var(--c-navy);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { display: block; }
.wordmark { font-size: 1.1rem; font-weight: 700; letter-spacing: .2px; }
.hackathon-tag {
  background: var(--c-cyan); color: var(--c-navy);
  font-weight: 700; font-size: .64rem; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 6px; text-transform: uppercase;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.1); padding: 5px 11px; border-radius: 20px;
  font-size: .8rem;
}
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa; }
.status-pill.ok   .dot { background: #37e39b; } .status-pill.ok   { color: #cffbe8; }
.status-pill.down .dot { background: #ff6b5e; } .status-pill.down { color: #ffd8d3; }
.status-pill.unknown .dot { background: #f0c24b; }
.icon-btn {
  background: rgba(255,255,255,.12); color: #fff; border: none;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.icon-btn:hover { background: rgba(255,255,255,.22); }

/* ------------------------------- hero ------------------------------- */
.hero {
  background: linear-gradient(115deg, var(--c-navy) 0%, var(--c-blue) 55%, var(--c-cyan) 140%);
  color: #fff; padding: 26px 22px;
}
.hero-inner { max-width: 1000px; margin: 0 auto; }
.hero h1 { margin: 0; font-size: 2rem; letter-spacing: .5px; }
.hero .tagline { margin: 6px 0 0; color: #d6e6ff; font-size: .98rem; }

/* ------------------------------- tabs ------------------------------- */
.tabs {
  display: flex; gap: 4px; max-width: 1000px; margin: 0 auto;
  padding: 0 22px; transform: translateY(-1px);
}
.tab {
  background: transparent; border: none; cursor: pointer;
  padding: 14px 20px; font-size: .95rem; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--c-blue-2); }
.tab.active { color: var(--c-blue); border-bottom-color: var(--c-cyan); }

/* ------------------------------- panels ------------------------------- */
.content { max-width: 1000px; margin: 12px auto 40px; padding: 0 22px; }
.panel { display: none; background: var(--panel); border: 1px solid var(--line);
         border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel.active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 1.2rem; }
.panel-head-actions { display: flex; align-items: center; gap: 10px; }

/* buttons */
.primary-btn {
  background: var(--c-blue); color: #fff; border: none; border-radius: 9px;
  padding: 10px 18px; font-size: .92rem; font-weight: 600; cursor: pointer;
}
.primary-btn:hover { background: var(--c-blue-2); }
.primary-btn:disabled { background: #9db2d8; cursor: not-allowed; }
.ghost-btn {
  background: #fff; color: var(--c-blue); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 15px; font-weight: 600; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--c-cyan); }
.ghost-btn:disabled { color: #9db2d8; cursor: not-allowed; }

/* ------------------------------- chat ------------------------------- */
.chat-log {
  min-height: 280px; max-height: 52vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  background: #fbfdff; display: flex; flex-direction: column; gap: 12px;
}
.empty-hint { color: var(--muted); font-size: .92rem; text-align: center; margin: auto; max-width: 60ch; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--c-blue); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: #eef3fb; color: var(--text); border-bottom-left-radius: 3px; }
.msg.error { align-self: flex-start; background: #fdecea; color: var(--fail); border: 1px solid #f5c6c0; }
.msg .msg-meta { margin-top: 8px; font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.route-badge { background: var(--c-navy); color: #fff; padding: 2px 8px; border-radius: 5px; font-weight: 700; font-size: .7rem; letter-spacing: .4px; }
.citations { margin-top: 8px; font-size: .82rem; }
.citations b { color: var(--c-blue); }
.citations a { color: var(--c-blue-2); }
.citations ul { margin: 4px 0 0; padding-left: 18px; }
.details-toggle { cursor: pointer; color: var(--c-blue-2); font-size: .78rem; text-decoration: underline; }
.details-body { margin-top: 6px; background: #0b1b3a; color: #cfe0ff; padding: 10px; border-radius: 8px;
                font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .74rem; overflow-x: auto; max-height: 220px; }

/* ---- rendered Markdown inside assistant answers (GitHub-style) ---- */
.msg .md { white-space: normal; }               /* override the plain-text pre-wrap */
.msg .md > :first-child { margin-top: 0; }
.msg .md > :last-child { margin-bottom: 0; }
.md-p { margin: 8px 0; line-height: 1.55; }
.md-h { margin: 12px 0 6px; line-height: 1.3; }
.md-ul, .md-ol { margin: 6px 0; padding-left: 22px; }
.md-ul li, .md-ol li { margin: 2px 0; }
.md-hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md code { background: rgba(10, 58, 160, .08); padding: 1px 5px; border-radius: 4px;
           font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.md pre.md-code { background: #0b1b3a; color: #cfe0ff; padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.md pre.md-code code { background: none; padding: 0; color: inherit; }
.md a { color: var(--c-blue-2); }
.md-table-wrap { overflow-x: auto; margin: 10px 0; }
.md-table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md-table thead th { background: #eaf1fc; color: var(--c-navy); font-weight: 700; white-space: nowrap; }
.md-table tbody tr:nth-child(even) { background: rgba(20, 102, 200, .04); }

/* ---- collapsible + scrollable Sources ---- */
.citations summary { cursor: pointer; color: var(--c-blue); font-size: .82rem; }
.citations summary::-webkit-details-marker { color: var(--c-blue); }
.citations .cite-list { max-height: 220px; overflow-y: auto; }

.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input textarea { flex: 1; resize: vertical; padding: 10px 12px; border: 1px solid var(--line);
                       border-radius: 10px; font-family: var(--font); font-size: .95rem; }
.chat-input textarea:focus { outline: 2px solid var(--c-cyan); border-color: var(--c-cyan); }

/* ------------------------------- upload ------------------------------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed var(--c-blue-2); border-radius: 12px; padding: 30px;
  background: #f6faff; cursor: pointer; margin: 12px 0; text-align: center;
}
.dropzone.dragover { background: #e6f1ff; border-color: var(--c-cyan); }
.dropzone-icon { font-size: 2rem; }
.result-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.result-list li { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: .88rem; display: flex; justify-content: space-between; gap: 10px; }
.result-list li.ok { border-color: #b7e4c7; background: #f2fbf5; }
.result-list li.err { border-color: #f5c6c0; background: #fdf1f0; }
.result-list li.pending { border-color: #ffe2a8; background: #fffaf0; }

/* ------------------------------- report ------------------------------- */
.report-input { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.report-input input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .95rem; min-width: 220px; }
.report-input input:focus { outline: 2px solid var(--c-cyan); border-color: var(--c-cyan); }
.report-result { margin-top: 8px; }
.verdict { display: inline-block; padding: 6px 14px; border-radius: 8px; font-weight: 800; letter-spacing: .5px; color: #fff; }
.verdict.PASS { background: var(--ok); } .verdict.WARN { background: var(--warn); }
.verdict.FAIL { background: var(--fail); } .verdict.INSUFFICIENT_DATA { background: var(--muted); }
.cat-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 14px; }
.cat-card { border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; }
.cat-card .cat-top { display: flex; justify-content: space-between; align-items: center; }
.cat-status { font-weight: 700; font-size: .8rem; padding: 2px 8px; border-radius: 5px; }
.cat-status.PASS { color: var(--ok); } .cat-status.WARN { color: var(--warn); }
.cat-status.FAIL { color: var(--fail); } .cat-status.INSUFFICIENT_DATA { color: var(--muted); }
.gaps { margin-top: 14px; }
.gaps h4 { margin: 0 0 6px; }
.gap { border-left: 4px solid var(--warn); background: #fffaf0; padding: 8px 12px; margin-bottom: 6px; border-radius: 0 8px 8px 0; font-size: .88rem; }
.gap.high, .gap.critical { border-left-color: var(--fail); background: #fdf1f0; }

/* ------------------------------- settings drawer ------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(0,17,58,.45); display: flex; justify-content: flex-end; z-index: 50; }
.overlay.hidden { display: none; }
.drawer { width: 380px; max-width: 92vw; height: 100%; background: #fff; padding: 20px; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,.2); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h3 { margin: 0; }
.drawer .field { display: flex; flex-direction: column; gap: 5px; margin: 16px 0 8px; font-size: .88rem; }
.drawer .field input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.drawer-actions { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.drawer .icon-btn { background: #eef3fb; color: var(--text); }
.memory-dump { background: #0b1b3a; color: #cfe0ff; padding: 10px; border-radius: 8px; font-size: .72rem; overflow: auto; max-height: 260px; }

/* ------------------------------- footer ------------------------------- */
.footer { max-width: 1000px; margin: 0 auto; padding: 18px 22px 40px; display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }

/* ------------------------- chat attachments (Claude-style) ------------------------- */
.attach-btn {
  background: #eef3fb; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1.15rem; line-height: 1; padding: 0 12px; cursor: pointer; color: var(--c-blue);
}
.attach-btn:hover { border-color: var(--c-cyan); background: #e6f1ff; }
.attach-hint { margin: 6px 2px 0; }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: #e8f0ff;
  border: 1px solid #c8dcfb; color: var(--c-navy-2); border-radius: 16px;
  padding: 4px 6px 4px 11px; font-size: .82rem;
}
.chip button { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .95rem; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--fail); }
.msg .attachments { margin-top: 6px; font-size: .8rem; opacity: .9; }
.msg.system { align-self: center; background: #f1f5fb; color: var(--muted); font-size: .82rem; border: 1px dashed var(--line); }

/* ------------------------- download dropdown ------------------------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 120px; z-index: 10;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); overflow: hidden;
}
.dropdown-menu.hidden { display: none; }
.dropdown-menu button {
  display: block; width: 100%; text-align: left; background: #fff; border: none;
  padding: 9px 14px; cursor: pointer; font-size: .9rem; color: var(--text);
}
.dropdown-menu button:hover { background: #eef3fb; color: var(--c-blue); }

/* ------------------------- cost & tracing panel ------------------------- */
.trace-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.trace-tile { background: #f6faff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.trace-tile .t-val { font-size: 1.15rem; font-weight: 700; color: var(--c-blue); }
.trace-tile .t-lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.mono-dump { background: #0b1b3a; color: #cfe0ff; padding: 10px; border-radius: 8px; font-size: .72rem; overflow: auto; max-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ------------------------- KPI bar (memory + cost/tracing, color-coded) ------------------------- */
.kpi-bar { max-width: 1000px; margin: 14px auto 0; padding: 0 22px; display: grid;
           grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { border-radius: 11px; padding: 10px 14px; color: #fff; box-shadow: var(--shadow);
       display: flex; flex-direction: column; gap: 2px;
       align-items: center; justify-content: center; text-align: center; }
.kpi .kpi-val { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.kpi .kpi-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; opacity: .9; }
.kpi-memory { background: linear-gradient(135deg, #0a3aa0, #1466c8); }   /* blue  */
.kpi-req    { background: linear-gradient(135deg, #0e7490, #00c9d7); }   /* cyan  */
.kpi-cost   { background: linear-gradient(135deg, #0f766e, #14b8a6); }   /* teal  */
.kpi-lat    { background: linear-gradient(135deg, #1f9d55, #38b26b); }   /* green (recolored by JS) */
.kpi-lat.warn { background: linear-gradient(135deg, #e08a00, #f0a52a); }
.kpi-lat.bad  { background: linear-gradient(135deg, #c0392b, #d33a2c); }
.kpi-cost.none, .kpi-lat.none { background: linear-gradient(135deg, #64748b, #94a3b8); }

/* Hover tooltip: plain-English description of what each KPI means. */
.kpi.has-tip { position: relative; cursor: help; }
.kpi.has-tip::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 0;
  width: max-content; max-width: 280px;
  background: #0b1f3a; color: #eaf2ff;
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 9px 11px; border-radius: 9px;
  font-size: .74rem; font-weight: 500; line-height: 1.35;
  text-transform: none; letter-spacing: normal; white-space: normal; text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .14s ease, transform .14s ease; z-index: 60;
}
.kpi.has-tip:hover::after, .kpi.has-tip:focus-visible::after { opacity: 1; transform: translateY(0); }
/* Keep the rightmost cell's tooltip from spilling past the viewport edge. */
.kpi-cost.has-tip::after { left: auto; right: 0; }

/* ------------------------- suggested prompts ------------------------- */
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.suggest {
  background: #eef3fb; border: 1px solid var(--line); color: var(--c-blue);
  border-radius: 18px; padding: 7px 14px; font-size: .85rem; cursor: pointer;
}
.suggest:hover { border-color: var(--c-cyan); background: #e6f1ff; }

/* ------------------------- per-message controls ------------------------- */
.msg-meta .lat { color: var(--muted); }
.copy-btn { background: none; border: none; cursor: pointer; color: var(--c-blue-2); font-size: .74rem; text-decoration: underline; padding: 0; }
.citations li a { cursor: pointer; }

/* ------------------------- report date fields ------------------------- */
.date-field { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.date-field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }

/* ------------------------- citation preview modal ------------------------- */
.modal { width: min(900px, 92vw); height: 82vh; background: #fff; border-radius: 12px; margin: auto;
         display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.overlay { align-items: center; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.modal-head .icon-btn { background: #eef3fb; color: var(--text); }
#cite-frame { flex: 1; border: none; width: 100%; }
#cite-fallback { padding: 20px; }

/* ------------------------- settings switch ------------------------- */
.switch-field { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: .9rem; }

/* ------------------------- DARK MODE ------------------------- */
body.dark {
  --bg: #0a1526; --panel: #0f2038; --line: #21324f; --text: #e7eefb; --muted: #94a9cc;
}
body.dark code { background: #1b2c48; color: #cfe0ff; }
body.dark .ghost-btn { background: #142441; color: #9fc2ff; }
body.dark .chat-log { background: #0c1c33; }
body.dark .msg.assistant { background: #172b49; color: #e7eefb; }
body.dark .md code { background: rgba(120, 170, 255, .14); color: #cfe0ff; }
body.dark .md a { color: #7fb2ff; }
body.dark .md-hr { border-top-color: #2b436b; }
body.dark .md-table th, body.dark .md-table td { border-color: #2b436b; }
body.dark .md-table thead th { background: #1b2f4e; color: #dbe7fb; }
body.dark .md-table tbody tr:nth-child(even) { background: rgba(120, 170, 255, .06); }
body.dark .citations summary { color: #7fb2ff; }
body.dark .empty-hint, body.dark .suggest { color: #9fc2ff; }
body.dark .suggest { background: #142441; }
body.dark .dropzone { background: #10233f; }
body.dark .cat-card, body.dark .trace-tile, body.dark .date-field input,
body.dark .drawer .field input, body.dark .cfg input { background: #0f2038; }
body.dark .attach-btn { background: #142441; }

/* ------------------------- dashboard + alerts (bonus tabs) ------------------------- */
.s-chip { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .72rem; font-weight: 700;
          color: #fff; letter-spacing: .3px; }
.s-chip.COMPLIANT { background: var(--ok); }
.s-chip.NEEDS_ATTENTION { background: var(--warn); }
.s-chip.NON_COMPLIANT { background: var(--fail); }
.s-chip.ERROR, .s-chip.UNKNOWN, .s-chip.NO_RECORD { background: var(--muted); }
.chip-legend { display: inline-flex; gap: 6px; margin-left: 10px; }

.dash-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.dash-tile { border-radius: 11px; padding: 10px 14px; color: #fff; box-shadow: var(--shadow); }
.dash-tile .d-val { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.dash-tile .d-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; opacity: .92; }
.dash-tile.total { background: linear-gradient(135deg, #0a3aa0, #1466c8); }
.dash-tile.bad   { background: linear-gradient(135deg, #c0392b, #d33a2c); }
.dash-tile.warn  { background: linear-gradient(135deg, #e08a00, #f0a52a); }
.dash-tile.ok    { background: linear-gradient(135deg, #1f9d55, #38b26b); }

.fleet-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.fleet-table th, .fleet-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.fleet-table th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; position: sticky; top: 0; background: var(--panel); }
.fleet-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fleet-table td.num.hot { color: var(--fail); font-weight: 700; }
.fleet-scroll { max-height: 56vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }

.alert-row { display: grid; grid-template-columns: 90px 1fr auto auto; gap: 10px; align-items: center;
             padding: 9px 12px; border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 0 8px 8px 0; margin-bottom: 6px; font-size: .9rem; }
.alert-row.soon { border-left-color: var(--warn); }
.alert-row.urgent { border-left-color: var(--fail); background: #fdf1f0; }
.alert-row .days { font-weight: 700; }
.alert-row.urgent .days { color: var(--fail); }
.alert-row.soon .days { color: var(--warn); }

body.dark .fleet-table th { background: var(--panel); }
body.dark .alert-row.urgent { background: #2a1620; }

/* --- Loading bubble (chat prompt in flight) --- */
.msg.loading { display: flex; align-items: center; gap: 10px; }
.load-cube { display: inline-flex; }
.load-cube svg { display: block; transform-origin: 50% 50%; animation: cube-spin 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes cube-spin { to { transform: rotate(360deg); } }
.load-text { color: var(--muted); }
.load-timer { color: var(--c-blue); font-weight: 700; font-variant-numeric: tabular-nums; }
body.dark .load-timer { color: #2ec5e6; }

/* --- Architecture diagram tab --- */
.arch-wrap {
  margin-top: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: auto;            /* scroll on very narrow screens rather than squashing */
}
.arch-img {
  display: block;
  width: 100%;
  min-width: 760px;          /* keep the diagram legible; wrap scrolls if narrower */
  height: auto;
  margin: 0 auto;
}
body.dark .arch-wrap { background: #0c1a30; }
/* the SVG has its own light canvas; frame it softly in dark mode */
body.dark .arch-img { border-radius: 10px; background: #fbfdff; }

@media (max-width: 640px) {
  .msg { max-width: 92%; }
  .hero h1 { font-size: 1.6rem; }
  .kpi-bar { grid-template-columns: repeat(2, 1fr); }
  .dash-summary { grid-template-columns: repeat(2, 1fr); }
}
