/* Growthbet Command Centre — professional, restrained, mobile-first.
 *
 * Themes: light is the default; dark is applied by [data-theme="dark"] on
 * <html> (set by public/js/theme.js before first paint, from the saved
 * choice or prefers-color-scheme). Every colour comes from a variable so
 * both themes are deliberate designs, not an inversion. No external
 * resources anywhere — system fonts only, CSP stays 'self'-only.
 *
 * Layout: mobile-first. Base styles target phones; tablet starts at
 * 641px, desktop at 1024px. The nav collapses to a hamburger below
 * 1024px (pure-CSS checkbox toggle in views/layout.js — no JS needed).
 * Touch targets are at least 44px. No page may scroll horizontally at
 * 360px wide: wide tables live in .table-wrap scroll containers.
 */
:root {
  --navy: #1f3864;
  --navy-light: #2e4f8a;
  --accent: #1f3864;      /* headings, table headers, active states */
  --link: #2e4f8a;
  --btn-bg: #1f3864;      /* primary buttons + active nav pill */
  --btn-bg-hover: #2e4f8a;
  --btn-text: #ffffff;
  --ink: #1a1a1a;
  --muted: #5f6b7a;
  --line: #e3e6eb;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --card: #ffffff;
  --input-bg: #ffffff;
  --hover: #e9edf3;
  --ok: #1e7a4c; --ok-bg: #e8f5ee; --ok-line: #bfe3cd;
  --warn: #8a6d00; --warn-bg: #fff8e1; --warn-line: #f0dc8a;
  --error: #b3261e; --error-bg: #fdecea; --error-line: #f5c6c2;
  --info: #2456a6; --info-bg: #e8eefb; --info-line: #b9cdf3;
  --purple: #6b3fa0; --purple-bg: #f1eafb; --purple-line: #d3bdf0;
  --tone-dark: #3c4654; --tone-dark-bg: #e9edf3; --tone-dark-line: #c3ccd8;
  --chart-bar: #1f3864;
  --chart-text: #1a1a1a;
  --shadow: rgba(16, 24, 40, 0.10);
  color-scheme: light;
}

/* Dark theme — deliberately designed, not inverted. Body text keeps
 * WCAG AA contrast (ink #e8ebf0 on #12161d is ~14:1; muted #a3adc0
 * is ~7:1). Navy accents lighten to a steel blue so they still read. */
[data-theme="dark"] {
  --navy: #8fb0e0;
  --navy-light: #7aa2d6;
  --accent: #8fb0e0;
  --link: #9db8e8;
  --btn-bg: #2e4f8a;
  --btn-bg-hover: #3a5ea3;
  --btn-text: #ffffff;
  --ink: #e8ebf0;
  --muted: #a3adc0;
  --line: #2e3746;
  --bg: #12161d;
  --bg-soft: #1a2029;
  --card: #1a2029;
  --input-bg: #12161d;
  --hover: #242d3a;
  --ok: #7bc9a3; --ok-bg: #12291d; --ok-line: #1e4d33;
  --warn: #d9c26a; --warn-bg: #2b2408; --warn-line: #6b5a1e;
  --error: #f08a82; --error-bg: #2e1414; --error-line: #5c2320;
  --info: #9db8e8; --info-bg: #16233a; --info-line: #2c4a7a;
  --purple: #c9a9ee; --purple-bg: #241a33; --purple-line: #5a3d80;
  --tone-dark: #c8d0dc; --tone-dark-bg: #232a35; --tone-dark-line: #3a4554;
  --chart-bar: #7aa2d6;
  --chart-text: #e8ebf0;
  --shadow: rgba(0, 0, 0, 0.40);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: clip; /* safety net only — pages must not overflow at 360px */
}
img, svg, video { max-width: 100%; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ------------------------------------------------------------------ header */
.header {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand { font-size: 1.1rem; color: var(--accent); flex: 1 1 auto; white-space: nowrap; }
/* On very small phones the "Growthbet" word hides (the G mark stays),
 * the brand type shrinks a step and header gaps tighten, so brand +
 * theme toggle + Menu button all fit on the header's first row even at
 * 360px wide. */
@media (max-width: 480px) {
  .brand-name { display: none; }
  .brand { font-size: 1rem; }
  .header { gap: 8px; }
  .nav-toggle-label { padding: 8px 10px; }
}
.brand-mark {
  display: inline-block;
  width: 28px; height: 28px; line-height: 28px;
  text-align: center; border-radius: 6px;
  background: var(--btn-bg); color: #fff; font-weight: 700; margin-right: 6px;
}
.userbar {
  font-size: 0.9rem; color: var(--muted);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  flex: 1 1 100%;
}
.inline-form { display: inline; margin: 0; }
.link-button {
  background: none; border: none; padding: 10px 4px; min-height: 44px;
  color: var(--link); cursor: pointer; font-size: 0.9rem; text-decoration: underline;
}

/* Theme toggle — always in the header, never behind the mobile nav. */
.theme-toggle {
  flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); cursor: pointer; font-size: 1.25rem; line-height: 1;
}
.theme-toggle:hover { background: var(--hover); }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-sun { display: inline; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* Global search box in the header (views/layout.js). */
.search-form { margin: 0; flex: 1 1 100%; }
.search-form input[type="search"] {
  font: inherit; font-size: 1rem; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg);
  color: var(--ink); width: 100%;
}

/* ------------------------------------------------- nav + hamburger toggle */
/* The checkbox lives as the first child of <body> (see layout.js); the
 * label sits in the header. The toggle itself is pure CSS:
 * `.nav-toggle:checked ~ .nav` reveals the menu. The checkbox stays
 * focusable for keyboard users (Space toggles it); :has() paints the
 * focus ring on the visible label in browsers that support it. */
.nav-toggle {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.nav-toggle-label {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink); cursor: pointer;
  font-size: 0.92rem; font-weight: 600;
}
.nav-toggle-label:hover { background: var(--hover); }
body:has(.nav-toggle:focus-visible) .nav-toggle-label {
  outline: 2px solid var(--link); outline-offset: 2px;
}
.hamburger { display: inline-flex; flex-direction: column; gap: 4px; }
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--ink); border-radius: 1px;
}

.nav {
  display: none; /* revealed by the toggle below 1024px; always on above */
  flex-direction: column; gap: 2px;
  padding: 8px 12px 12px; background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.nav-toggle:checked ~ .nav { display: flex; }
.nav a {
  color: var(--ink); text-decoration: none; font-size: 0.95rem;
  padding: 12px 14px; min-height: 44px; border-radius: 6px;
  display: flex; align-items: center;
}
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--btn-bg); color: var(--btn-text); }

/* -------------------------------------------------------------------- main */
.main { max-width: 1080px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 8px; color: var(--accent); line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 8px; color: var(--accent); line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.card {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin: 14px 0; background: var(--card);
}
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--bg-soft); }
.tile-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); overflow-wrap: break-word; }
.tile-label { font-size: 0.9rem; font-weight: 600; }
.tile-sub { font-size: 0.8rem; color: var(--muted); }

/* ------------------------------------------------------------------ tables */
/* .table-wrap gives every wide table its own horizontal scroll lane so
 * the page itself never scrolls sideways. -webkit-overflow-scrolling
 * keeps the swipe smooth on iOS. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
/* Data tables get a 680px floor inside their scroll lane: on a phone the
 * columns keep readable widths and the table scrolls, instead of squeezing
 * every column until titles wrap to five lines. The stacked kv table is
 * excluded — it must stay fluid. */
.table-wrap .table:not(.table-kv) { min-width: 680px; }
.table th, .table td {
  text-align: left; padding: 9px 10px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.table th { color: var(--accent); font-size: 0.85rem; }
.table td a { overflow-wrap: break-word; }
/* Date/time cells stay on one line (a wrapped "17 Nov 2026, 08:58" took
 * four lines in a narrow column). Applied per-cell in the views. */
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
/* The contacts table has 9 columns; long source URLs get a capped column
   (breaking anywhere) so the table still fits a 1280px viewport. */
.table-contacts td:nth-child(8) { max-width: 160px; overflow-wrap: anywhere; }
/* Checkbox groups inside table cells (admin roles) stay compact: the
 * 44px .check touch height would otherwise make every row ~200px tall
 * when the three role boxes stack in a narrow Actions column. */
.table .check { min-height: 0; }

/* Key/value detail tables (opportunity detail): stack label-above-value
 * on phones so long values (URLs, notes) never force a scroll lane. */
@media (max-width: 640px) {
  .table-kv { display: block; }
  .table-kv tbody, .table-kv tr { display: block; }
  .table-kv tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table-kv tr:last-child { border-bottom: none; }
  .table-kv th, .table-kv td {
    display: block; padding: 1px 0; border-bottom: none;
  }
  .table-kv th {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--muted);
  }
  .table-kv td a { word-break: break-all; }
}

/* ------------------------------------------------------------------- forms */
.form { display: grid; gap: 14px; margin-top: 16px; }
.form label { display: grid; gap: 4px; font-size: 0.92rem; font-weight: 600; }
/* Checkbox labels inside a form keep their inline layout — without this the
   .form label grid rule stacks the box above its text. */
.form label.check { display: inline-flex; align-items: center; }
.form input, .form textarea, .form select {
  /* 16px font on inputs stops iOS Safari zooming in on focus. */
  font: inherit; font-size: 1rem; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 6px; width: 100%;
  background: var(--input-bg); color: var(--ink);
}
.form textarea { min-height: 88px; resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus {
  outline: 2px solid var(--link); outline-offset: 0; border-color: var(--link);
}
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font-weight: 400; white-space: nowrap; min-height: 44px; }
.check input { min-height: 20px; min-width: 20px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
fieldset legend { font-size: 0.92rem; font-weight: 600; }

/* ----------------------------------------------------------------- buttons */
.btn {
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
  padding: 11px 18px; min-height: 44px; border-radius: 6px;
  border: 1px solid var(--btn-bg);
  background: var(--card); color: var(--link);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { background: var(--btn-bg-hover); }
/* Disabled buttons (e.g. Send while SMTP is unconfigured): visibly
 * inactive, no hover/active feedback, and never clickable. The reason
 * is always given in words next to the button — never colour alone. */
.btn:disabled, .btn[disabled] {
  opacity: 0.55; cursor: not-allowed; box-shadow: none;
}
.btn:disabled:hover, .btn[disabled]:hover { filter: none; }
.btn:disabled:active, .btn[disabled]:active { transform: none; }
@media (max-width: 640px) {
  .form .btn { width: 100%; }
}

/* ----------------------------------------------------------------- banners */
.banner { border-radius: 6px; padding: 12px 16px; margin: 0 0 16px; font-size: 0.92rem; }
.banner-ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); }
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.banner-error { background: var(--error-bg); border: 1px solid var(--error-line); color: var(--error); }

/* -------------------------------------------------------------- pagination */
.pagination {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 16px 0 0;
}
.pagination a, .pagination strong {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; color: var(--ink); background: var(--card);
}
.pagination a:hover { background: var(--hover); }
.pagination strong { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }

/* ------------------------------------------------------------------ footer */
.footer {
  max-width: 1080px; margin: 0 auto; padding: 20px 16px 32px;
  font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line);
}

/* ------------------------------------------------------- 2FA + code boxes */
.code-box {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; word-break: break-all; font-size: 1rem;
}
.code-box code { font-size: 0.95rem; }
.qr-code {
  /* QR codes must stay black-on-white to scan — white in both themes. */
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 12px; margin: 12px 0; display: inline-block; max-width: 100%;
}
.qr-code svg { display: block; width: min(220px, 100%); height: auto; }
.codes {
  list-style: none; padding: 0; margin: 16px 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
}
.codes li {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; text-align: center; font-size: 1.05rem; letter-spacing: 0.04em;
  overflow-wrap: break-word;
}
details { margin: 12px 0; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--link); }

/* ------------------------------------------------------------------ charts */
/* Server-rendered SVG (views/charts.js). CSS fill rules override the SVG
 * presentation attributes so charts follow the active theme. The SVG
 * scales to its container via viewBox — it never overflows on mobile. */
.charts { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 12px 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--chart-text); }
.chart rect { fill: var(--chart-bar); }

/* ------------------------------------------------------------- tablet 641+ */
@media (min-width: 641px) {
  .main { padding: 20px; }
  .card { padding: 20px 22px; margin: 18px 0; }
  h1 { font-size: 1.5rem; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .form-filters { grid-template-columns: repeat(2, 1fr); }
  .form-filters .btn { grid-column: 1 / -1; width: auto; justify-self: start; }
}

/* ------------------------------------------------------------ desktop 1024+ */
@media (min-width: 1024px) {
  .header { flex-wrap: nowrap; padding: 14px 24px; }
  .search-form { flex: 0 0 auto; }
  .search-form input[type="search"] { width: 220px; }
  .userbar { flex: 0 0 auto; }
  .nav-toggle-label { display: none; }
  .nav {
    display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px;
    padding: 8px 24px;
  }
  .nav a { padding: 6px 10px; min-height: 0; display: inline-block; }
  .main { padding: 24px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: repeat(2, 1fr); }
  .form-filters { grid-template-columns: repeat(4, 1fr); }
  .footer { padding: 20px 24px 32px; }
}

/* ============================================================ chips ======
 * Status + deadline chips (views/chips.js). Colour is never the only
 * signal: every chip carries its fact in words. Tones are shared by
 * status and deadline chips so the same meaning always looks the same.
 * All tones are defined in both themes above (light + dark variables).
 */
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.8rem; font-weight: 600; line-height: 1.4;
  white-space: nowrap; vertical-align: middle;
}
/* Deadline bands: urgent = overdue or closing within 48h (red),
 * soon = 3–7 days (amber), ok = more than 7 days (green),
 * none = no deadline (grey). */
.chip-deadline-urgent { color: var(--error); background: var(--error-bg); border-color: var(--error-line); }
.chip-deadline-soon { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.chip-deadline-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.chip-deadline-none { color: var(--muted); background: var(--bg-soft); border-color: var(--line); }
/* Status tones. */
.chip-status-green { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.chip-status-amber { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.chip-status-red { color: var(--error); background: var(--error-bg); border-color: var(--error-line); }
.chip-status-blue { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.chip-status-purple { color: var(--purple); background: var(--purple-bg); border-color: var(--purple-line); }
.chip-status-neutral { color: var(--muted); background: var(--bg-soft); border-color: var(--line); }
.chip-status-dark { color: var(--tone-dark); background: var(--tone-dark-bg); border-color: var(--tone-dark-line); }
/* Type + role chips are small neutral markers. */
.chip-type, .chip-role { color: var(--muted); background: var(--bg-soft); border-color: var(--line); }

/* ===================================================== record cards ======
 * Mobile-first list presentation: every data table has a structured-card
 * twin. Sections carrying both get class "has-cards": on phones the table
 * hides and the cards show; on tablet/desktop the cards hide and the
 * table shows. The detail key/value table has no card twin (it stacks)
 * and is unaffected.
 */
.record-cards { display: none; }
@media (max-width: 640px) {
  .has-cards .table-wrap { display: none; }
  .record-cards {
    display: grid; gap: 12px; margin: 0;
  }
}
.record-card {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; background: var(--card);
  box-shadow: 0 1px 2px var(--shadow);
}
.record-card-title {
  font-size: 1rem; font-weight: 700; line-height: 1.35;
  margin: 0 0 4px; overflow-wrap: break-word;
}
.record-card-title a { color: var(--ink); text-decoration: none; }
.record-card-title a:hover { color: var(--link); text-decoration: underline; }
.record-card-sub {
  color: var(--muted); font-size: 0.85rem;
  margin: 0 0 10px; overflow-wrap: break-word;
}
.record-card-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px;
}
.record-card-chips:empty { display: none; }
/* Meta facts as a labelled two-column grid — grouped fields, clear
 * hierarchy, not a vertical list of labels. */
.record-card-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px; margin: 0; font-size: 0.88rem;
}
.record-card-meta > div { min-width: 0; }
.record-card-meta dt {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin: 0 0 2px;
}
.record-card-meta dd {
  margin: 0; overflow-wrap: break-word;
}
.record-card-meta .meta-full { grid-column: 1 / -1; }
.record-card-note {
  font-size: 0.88rem; margin: 10px 0 0; padding-top: 10px;
  border-top: 1px solid var(--line);
}
/* Draft email body (Phase 2): plain text, line breaks kept, long words
 * and URLs wrap instead of overflowing the card on a phone. */
.email-body {
  white-space: pre-wrap; overflow-wrap: break-word;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; margin: 12px 0 0;
  font-size: 0.95rem; line-height: 1.55;
}

.record-card-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.record-card-actions .btn { flex: 1 1 auto; }

/* ==================================================== empty states =======
 * A helpful empty state says what the empty list means and what to do
 * next — never just "No records".
 */
.empty-state {
  border: 1px dashed var(--line); border-radius: 10px;
  padding: 24px 20px; margin: 12px 0; text-align: center;
  background: var(--bg-soft);
}
.empty-state-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 6px; }
.empty-state p { margin: 0; }
.empty-state p + p { margin-top: 6px; }

/* =================================================== quick actions =======
 * Overview shortcut row: the decision queue, deadlines and chase items
 * reachable in one tap from the overview.
 */
.quick-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px;
}
.quick-actions .btn { text-decoration: none; }

/* ============================================== modernized components ===
 * Buttons: danger variant for destructive actions (disable user, revoke
 * session, delete view) — unmistakable red, never a plain link. Secondary
 * buttons are the outlined default .btn. All buttons keep 44px targets.
 */
.btn { border-radius: 8px; box-shadow: 0 1px 2px var(--shadow); }
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-danger {
  background: var(--error); border-color: var(--error); color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm {
  min-height: 44px; padding: 8px 14px; font-size: 0.92rem;
}
/* Destructive inline actions inside tables (where a full button would
 * crowd the row): red + semibold, never a plain blue link. */
.link-button-danger { color: var(--error); font-weight: 600; }
/* Forms: softer radius, clearer focus, roomier labels. */
.form input, .form textarea, .form select { border-radius: 8px; }
.form input:focus, .form textarea:focus, .form select:focus {
  box-shadow: 0 0 0 3px var(--info-bg);
}
.form .field-hint { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
/* Banners: a coloured left edge makes the tone readable at a glance. */
.banner { border-radius: 8px; border-left: 4px solid var(--line); }
.banner-ok { border-left-color: var(--ok); }
.banner-warn { border-left-color: var(--warn); }
.banner-error { border-left-color: var(--error); }
/* Tiles: subtle depth; on desktop a gentle hover lift. */
.tile {
  border-radius: 10px; background: var(--card);
  box-shadow: 0 1px 2px var(--shadow);
}
@media (min-width: 1024px) {
  .tile:hover { border-color: var(--navy-light); box-shadow: 0 2px 8px var(--shadow); }
}
/* Section cards: a touch more depth so the page reads as modern panels. */
.card { border-radius: 10px; box-shadow: 0 1px 2px var(--shadow); }
/* Key/value detail table: on desktop the label column holds a fixed
 * width; on phones the stacked rows already read as a card — the extra
 * padding below makes the grouping deliberate. */
.table-kv th { width: 180px; }
@media (max-width: 640px) {
  .table-kv th { width: auto; }
  .table-kv tr { padding: 10px 0; }
}
/* Definition list for profile/account facts (label/value rows). */
.meta-list { margin: 0; display: grid; gap: 12px; }
.meta-list > div {
  display: grid; gap: 2px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.meta-list > div:last-child { border-bottom: none; padding-bottom: 0; }
.meta-list dt {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.meta-list dd { margin: 0; font-size: 0.95rem; overflow-wrap: break-word; }
/* Admin role picker: checkboxes as a clear row of options with a
 * visible Save action beneath — no more cramped in-table form. */
.role-picker { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.role-picker .check { margin-right: 4px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* Status legend: plain-language explainer for the status vocabulary. */
.status-legend { margin: 8px 0 0; }
.status-legend ul {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: grid; gap: 6px; font-size: 0.88rem;
}
.status-legend li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.status-legend .legend-def { color: var(--muted); }

/* ==================================================== sourcing pack body ===
 * The rendered pack text (see views/markdown.js): long-form reading, so
 * the spacing and heading scale differ from the compact record views.
 * Long supplier URLs and part numbers must wrap — overflow-wrap handles
 * both themes; no fixed widths anywhere.
 */
.pack-body { overflow-wrap: anywhere; }
.pack-body h3 { font-size: 1.05rem; margin: 18px 0 8px; color: var(--accent); line-height: 1.3; }
.pack-body h3:first-child { margin-top: 0; }
.pack-body h4 { font-size: 1rem; margin: 14px 0 6px; color: var(--accent); line-height: 1.3; }
.pack-body p { margin: 0 0 10px; }
.pack-body ul, .pack-body ol { margin: 0 0 10px; padding-left: 22px; }
.pack-body li { margin-bottom: 4px; }
