/* =============================================================
   DocuFire Web Portal — theme
   Rebuilt 2026-07-15 against real screenshots of the native
   macOS/iPadOS app: neutral dark gray (not navy), borderless
   label-over-value field rows with dividers (not boxed inputs),
   two-column grids, small-caps section headers, red accent.
   ============================================================= */

:root {
  --bg: #f2f2f4;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --text: #1a1a1a;
  --text-muted: #6b6b70;
  --text-faint: #9a9a9f;
  --border: #e2e2e5;
  --accent: #E81C23;
  --accent-hover: #c9161c;
  --accent-text: #ffffff;
  --danger: #d92626;
  --success: #2fae4e;
  --warning: #c9a227;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --sidebar-bg: #1c1c1e;
  --sidebar-text: #f2f2f2;
}

[data-theme="dark"] {
  --bg: #1c1c1e;
  --surface: #242426;
  --surface-2: #2c2c2e;
  --text: #f2f2f2;
  --text-muted: #9a9a9f;
  --text-faint: #6e6e73;
  --border: #38383a;
  --accent: #FF453A;
  --accent-hover: #ff6259;
  --accent-text: #ffffff;
  --danger: #ff6b6b;
  --success: #30D158;
  --warning: #e0b93a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --sidebar-bg: #1c1c1e;
  --sidebar-text: #f2f2f2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 14px;
}

/* ---- Header ---- */

.topbar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.topbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 26px; height: 26px; border-radius: 7px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.brand-tagline { font-size: 10px; color: rgba(255,255,255,0.5); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 12px; color: rgba(255,255,255,0.65); }

#apple-sign-out-button button {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 7px;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.16); }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline; }

/* ---- Sign-in ---- */

.signin-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 52px);
  min-height: calc(100dvh - 52px);
  padding: 24px;
  box-sizing: border-box;
  position: relative;
  background:
    radial-gradient(ellipse 820px 480px at 50% 0%, rgba(232, 28, 35, 0.09), transparent 62%),
    var(--bg);
}
[data-theme="dark"] .signin-wrap {
  background:
    radial-gradient(ellipse 820px 480px at 50% 0%, rgba(255, 69, 58, 0.13), transparent 62%),
    var(--bg);
}

.signin-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  text-align: center;
  padding: 40px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14), 0 2px 10px rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .signin-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 10px rgba(0, 0, 0, 0.35);
}

.signin-logo {
  width: 76px;
  height: 76px;
  border-radius: 19px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(232, 28, 35, 0.3);
}

.signin-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.signin-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 20px;
}

.signin-divider {
  width: 36px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.signin-copy {
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.signin-button-wrap {
  display: flex;
  justify-content: center;
  min-height: 30px;
}

/* CloudKit JS draws the button label as an SVG positioned with
   `left: 50%` relative to its normal inline position, assuming that
   position is the button's left edge. The card's text-align: center
   was inheriting into the button and centering the SVG first, so the
   label ended up ~19px right of center. Restore start alignment inside
   the button only. */
.signin-button-wrap .apple-auth-button {
  text-align: left;
}

/* "Works with DocuFire / DocuFire Institutional" strip under the button. */
.signin-apps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 18px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.signin-apps-label {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.signin-app {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.signin-app img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
  width: 100%;
}

/* Small-caps section headers, matching native "CASE INFORMATION" style */
.card h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 2px;
  padding-top: 2px;
}
.card h3:not(:first-child) { margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--border); }

.muted { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

.primary-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { background: var(--border); cursor: not-allowed; }

.status-message { margin-top: 14px; font-size: 12px; color: var(--danger); min-height: 16px; }
.status-message.info { color: var(--text-muted); }

.hidden { display: none !important; }

/* ---- Case list ---- */

.case-list-page { max-width: 900px; margin: 0 auto; padding: 24px 22px; }

.case-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.case-list-header h1 { font-size: 22px; font-weight: 700; }
.case-list-subhead { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.case-list-sync { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.case-list-header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--border); }
.case-list-header-actions .theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
}
.case-list-header-actions .theme-toggle:hover { background: var(--border); }
.new-case-btn { width: auto; padding: 9px 16px; border-radius: 8px; font-size: 13px; }

.case-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 10px;
}

.add-year-row { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.pill-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pill-btn:hover { background: var(--accent-hover); }

/* ---- Folder sections (Active + year archives) ---- */

.folder-section { margin-bottom: 10px; }
.folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.folder-header:hover { background: var(--border); }
.folder-icon { font-size: 13px; }
.folder-title { font-size: 13px; font-weight: 700; color: var(--text-muted); flex: 1; }
.folder-info-btn { background: none; border: none; color: var(--text-faint); font-size: 14px; cursor: pointer; padding: 0 2px; }
.folder-count {
  background: var(--surface);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.folder-chevron { font-size: 10px; color: var(--text-faint); }
.folder-body { padding-top: 8px; }
.folder-empty { text-align: center; color: var(--text-faint); font-size: 13px; padding: 18px 0; }

.case-list { display: flex; flex-direction: column; gap: 8px; }

.case-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s ease;
  border-left: 4px solid var(--border);
}
/* Recency accent — how recently the case was updated, NOT how complete it is. */
.case-card.recency-green  { border-left-color: var(--success); }
.case-card.recency-orange { border-left-color: var(--warning); }
.case-card.recency-gray   { border-left-color: var(--border); }
.case-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

.case-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.case-card-top strong { font-size: 14px; }
.case-card-badges { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.status-tag { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status-tag.status-blue   { background: rgba(74,144,226,0.15); color: #4a90e2; }
.status-tag.status-green  { background: rgba(47,174,78,0.15); color: var(--success); }
.status-tag.status-orange { background: rgba(224,185,58,0.18); color: var(--warning); }
.status-tag.status-red    { background: rgba(217,38,38,0.15); color: var(--danger); }
.status-tag.tag-red    { background: rgba(217,38,38,0.15); color: var(--danger); }
.status-tag.tag-green  { background: rgba(47,174,78,0.15); color: var(--success); }
.status-tag.tag-orange { background: rgba(224,185,58,0.18); color: var(--warning); }

.case-card-meta { margin: 3px 0 0; font-size: 12px; }
.case-card-progress { font-size: 11px; color: var(--text-faint); margin-top: 6px; }
.case-card-dates { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

/* ---- Right-click context menu ----
   Native uses swipe-to-reveal on iPad but disables it on Mac Catalyst in
   favor of a context menu, reasoning that touch-swipe and trackpad/mouse
   scroll gestures conflict. The web portal is mouse/trackpad-first like
   Mac Catalyst, so it gets the context menu, not a swipe simulation. */
.context-menu {
  position: fixed;
  z-index: 2000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  min-width: 190px;
  padding: 6px;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.context-menu button:hover { background: var(--surface-2); }
.context-menu-label { display: block; font-size: 10px; text-transform: uppercase; color: var(--text-faint); padding: 6px 10px 2px; }
.context-menu-divider { height: 1px; background: var(--border); margin: 6px 2px; }
.context-menu-danger { color: var(--danger) !important; }

.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.legend-swatch { width: 4px; height: 22px; border-radius: 2px; display: inline-block; }
.legend-swatch.recency-green  { background: var(--success); }
.legend-swatch.recency-orange { background: var(--warning); }
.legend-swatch.recency-gray   { background: var(--border); }

/* ---- Settings: toggles, pickers, and sub-components ---- */

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row-text { flex: 1; }
.settings-toggle-row-text strong { display: block; font-size: 14px; }
.settings-toggle-row-text .muted { margin: 2px 0 0; font-size: 12px; }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-switch .toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px; transition: 0.15s;
}
.toggle-switch .toggle-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.15s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.settings-picker-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.settings-picker-row:last-child { border-bottom: none; }
.settings-picker-row select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); font-size: 13px; }

.settings-help-toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em; }
.settings-help-body { padding: 0 14px 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.settings-help-body ol { margin: 0; padding-left: 18px; }
.settings-help-body a { color: var(--accent); }
.settings-key-note { font-size: 11px; color: var(--text-faint); padding: 0 14px 10px; margin: 0; }

.filename-token-chip { display: inline-block; background: rgba(232,28,35,0.12); color: var(--accent); border: none; border-radius: 20px; padding: 5px 12px; font-size: 11px; font-weight: 600; cursor: pointer; margin: 3px; }
.filename-token-chip:hover { background: rgba(232,28,35,0.2); }
.filename-preview { font-family: monospace; font-size: 12px; background: var(--surface-2); padding: 8px 10px; border-radius: 6px; margin-top: 8px; word-break: break-all; }
.filename-preset-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.filename-preset-row:last-child { border-bottom: none; }
.filename-preset-row .preset-example { font-family: monospace; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.filename-preset-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.filename-preset-radio.selected { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }

.settings-warning-box { display: flex; gap: 8px; background: rgba(224,185,58,0.1); border: 1px solid rgba(224,185,58,0.3); border-radius: 8px; padding: 10px 12px; font-size: 11px; color: var(--warning); margin-top: 6px; }
.settings-unconfirmed-box { display: flex; gap: 8px; background: rgba(74,144,226,0.08); border: 1px solid rgba(74,144,226,0.25); border-radius: 8px; padding: 10px 12px; font-size: 11.5px; color: var(--text-muted); margin: 8px 0 16px; line-height: 1.5; }

.settings-visibility-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.settings-visibility-row:last-child { border-bottom: none; }
.settings-visibility-row.locked { opacity: 0.55; cursor: default; }
.settings-visibility-row .vis-icon { width: 18px; text-align: center; }
.settings-visibility-row .vis-status { margin-left: auto; font-size: 11px; color: var(--text-faint); }

.logo-upload-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.logo-preview { width: 48px; height: 48px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); object-fit: contain; }
.logo-preview-empty { width: 48px; height: 48px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--border); }
.logo-upload-actions button { display: block; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; background: none; border: none; padding: 2px 0; text-align: left; }

/* ---- Settings modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.modal-header h2 { font-size: 16px; font-weight: 700; flex: 1; text-align: center; }
.modal-back-btn { background: none; border: none; color: var(--accent); font-size: 18px; cursor: pointer; padding: 0; width: 28px; text-align: left; }
.modal-done-btn { background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }

.settings-body { padding: 14px 16px 18px; }
.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.settings-form-card { padding: 4px 14px; }
.settings-form-card .field-cell:last-child { border-bottom: none; }

.settings-list { padding: 8px; }
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.settings-row:hover { background: var(--surface-2); }
.settings-row-disabled { opacity: 0.55; cursor: default; }
.settings-row-disabled:hover { background: none; }
.settings-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.settings-row-text { flex: 1; display: flex; flex-direction: column; }
.settings-row-text strong { font-size: 13px; }
.settings-row-text .muted { margin: 0; font-size: 11px; }
.settings-chevron { color: var(--text-faint); font-size: 18px; }

.case-type-modal { max-width: 320px; padding: 22px; text-align: center; }
.case-type-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.case-type-btn {
  display: block;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
}
.case-type-btn:hover { background: var(--border); }
.case-type-cancel { color: var(--text-muted); font-weight: 500; margin-top: 4px; margin-bottom: 0; background: none; border: none; }
.case-type-cancel:hover { color: var(--accent); background: none; }

/* ---- Case shell: sidebar + section content ---- */

.case-shell {
  display: flex;
  min-height: calc(100vh - 52px);
  max-width: 1680px;
  margin: 0 auto;
}

.case-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.back-btn {
  text-align: left;
  padding: 4px 6px;
  width: auto;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}
.back-btn:hover { color: #fff; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }

.case-sidebar-info {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 10px 12px;
}
.case-sidebar-info strong { display: block; font-size: 13px; margin-bottom: 2px; color: #fff; }
.case-sidebar-info .muted { margin: 0; font-size: 11px; color: rgba(255,255,255,0.5); }

.case-nav { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }

.case-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 9px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  font-family: inherit;
}
.case-nav-item:hover:not(.disabled) { background: rgba(255,255,255,0.06); }
.case-nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.case-nav-item.disabled { opacity: 0.35; cursor: default; }

.case-nav-num { font-variant-numeric: tabular-nums; font-size: 11px; opacity: 0.7; width: 18px; }
.case-nav-label { flex: 1; }
/* ---- Vehicle / Vessel sections ---- */
.vin-result { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.vin-result .vin-icon { font-size: 18px; line-height: 1.2; width: 22px; text-align: center; }
.vin-result p { margin: 2px 0 0; font-size: 12.5px; }
.vin-ok { color: #2e9e5b; }
.vin-warn { color: #e0871a; }
.vin-bad { color: var(--accent); }
.recall-count { font-weight: 600; margin: 8px 0; }
.recall-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.recall-card summary { cursor: pointer; }
.recall-card p { margin: 8px 0 0; font-size: 13px; }
.recall-label { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.ref-details summary { cursor: pointer; font-weight: 600; }
.ref-list { margin: 8px 0 0 18px; font-size: 13px; line-height: 1.6; }
.vv-check-list .photo-subheader { margin-top: 12px; }
.vv-check-row { display: flex; padding: 4px 0; }

/* Month / Day / Year (+ time) dropdown date fields. */
.date-parts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Beats the generic full-width field select rule (same class+element
   specificity, but this one is more specific). */
.field-cell .date-parts select { width: auto; flex: 0 0 auto; min-width: 0; padding-right: 22px; }
.field-cell .date-parts .date-clear { width: auto; flex: 0 0 auto; padding: 0 6px; font-size: 12px; color: var(--text-muted); }

/* Read-only computed value shown in a field cell (Age next to DOB). */
.age-display {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Sidebar status marks (SidebarView.swift: checkmark / exclamationmark / minus). */
.case-nav-status { font-size: 13px; font-weight: 800; margin-left: 6px; line-height: 1; }
.nav-status-complete { color: #34c759; }
.nav-status-visited { color: #ffd60a; }
.nav-status-notused { color: rgba(255,255,255,0.35); }
.case-nav-item.active .case-nav-status { color: #fff; }

.case-nav-soon {
  font-size: 9px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.12);
  padding: 2px 5px;
  border-radius: 5px;
  letter-spacing: 0.03em;
}

.case-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.case-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.case-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ai-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(232,28,35,0.10);
  border: 1px solid rgba(232,28,35,0.30);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.ai-toolbar-btn:hover { background: rgba(232,28,35,0.16); }
.toolbar-export-btn, .toolbar-save-btn { padding: 7px 14px; font-size: 13px; }

.case-breadcrumb {
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: center;
  padding: 5px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow-x: auto;
  min-width: 0;
}

.case-progress-track { height: 3px; background: var(--border); flex-shrink: 0; }
.case-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }

.case-main {
  flex: 1;
  padding: 20px 28px;
  max-width: 1080px;
}

.case-main-header { margin-bottom: 12px; }
.case-main-header h2 { font-size: 17px; font-weight: 700; }

.case-main .card + .card { margin-top: 12px; }

/* ---- Field grid: two columns, label-over-value rows with dividers,
   matching the native app's minimal-chrome field style exactly. ---- */

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 20px;
}

.field-cell {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

/* Marker wrapper saveCase() queries for to route fields onto the separate
   CD_SolarPanel record — must not affect layout, since it can wrap either
   a single field-grid cell (Present? toggle in Electric Service) or a
   whole card's worth of subsections (bottom Solar PV System card). */
.solar-panel-fields { display: contents; }
.field-cell:nth-last-child(2):not(.textarea):not(.multiselect):not(.checkbox),
.field-cell:last-child { border-bottom: 1px solid var(--border); }

.field-cell.textarea, .field-cell.multiselect, .field-cell.checkbox {
  grid-column: 1 / -1;
}

.field-cell label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.field-cell input[type="text"],
.field-cell select,
.field-cell textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 0;
  resize: vertical;
}
.field-cell input[type="text"]:focus,
.field-cell select:focus,
.field-cell textarea:focus {
  outline: none;
  color: var(--accent);
}
.field-cell select { appearance: auto; cursor: pointer; }
.field-cell textarea { resize: vertical; min-height: 60px; }

/* Standalone label/input pairs outside a field-grid (e.g. inline forms) */
label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); margin-top: 12px; margin-bottom: 4px; }
input[type="text"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
}
select { appearance: auto; cursor: pointer; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

/* Chips: pill-shaped, filled red when selected — matches Panel Condition
   / Type of Wiring exactly. */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 13px;
  cursor: pointer;
  user-select: none;
}
.chip-label:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chip-label input[type="checkbox"] { display: none; }

.save-bar { position: sticky; bottom: 14px; text-align: center; }

/* ---- Mark Complete / Mark as Not Used (SectionStatus) ---- */

.mark-complete-row { display: flex; gap: 8px; margin-top: 12px; }
.mark-complete-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.mark-complete-btn:hover { background: var(--border); }
.mark-complete-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mark-complete-btn .mc-icon { font-size: 13px; }
.mark-complete-btn.is-complete { background: rgba(47,174,78,0.12); border-color: rgba(47,174,78,0.4); color: var(--success); }
.mark-complete-btn.not-used.is-not-used { background: var(--surface); border-color: var(--border); color: var(--text-faint); }
@media (max-width: 500px) {
  .mark-complete-row { flex-direction: column; }
}

.section-nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.section-nav-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.section-nav-prev { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.section-nav-prev:hover { background: var(--border); }
.section-nav-next { background: var(--accent); color: var(--accent-text); margin-left: auto; }
.section-nav-next:hover { background: var(--accent-hover); }
@media (max-width: 500px) {
  .section-nav-row { flex-direction: column; }
  .section-nav-next { margin-left: 0; }
}

.occupants-preview-list { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; }
.occupants-preview-list li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.occupants-preview-list li:last-child { border-bottom: none; }

.witness-list { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.witness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 4px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.witness-row:last-child { border-bottom: none; }
.witness-row:hover { background: var(--surface-2); }
.witness-edit-hint { font-size: 11px; color: var(--accent); opacity: 0; transition: opacity 0.1s ease; }
.witness-row:hover .witness-edit-hint { opacity: 1; }

.add-witness-btn {
  margin-top: 8px;
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 9px;
  width: 100%;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}
.add-witness-btn:hover { background: var(--surface-2); }

.delete-witness-btn { display: block; margin: 8px auto 0; color: var(--danger); font-size: 12px; }
.delete-witness-btn:hover { opacity: 0.8; }

.secondary-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.secondary-btn:hover { color: var(--accent); }

.ignition-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ignition-row:last-child { border-bottom: none; }
.ignition-name { margin-top: 0 !important; text-transform: none; letter-spacing: normal; font-size: 13px; }
.ignition-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
  margin-top: 8px;
  margin-left: 24px;
}
.ignition-fields select, .ignition-fields input {
  margin-top: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
}
@media (max-width: 700px) {
  .ignition-fields { grid-template-columns: 1fr; margin-left: 0; }
}

/* ---- Footage / Video Evidence (Property Description) ---- */

.surv-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.surv-item:last-child { border-bottom: none; }
.surv-item-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.surv-item-header strong { font-size: 13px; font-weight: 600; }
.surv-item-header select {
  width: auto;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 12px;
}
.surv-item-fields {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  margin-top: 8px;
}
.surv-item-fields select, .surv-item-fields input {
  margin-top: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
}
@media (max-width: 700px) {
  .surv-item-fields { grid-template-columns: 1fr; }
}

/* ---- Export document ---- */

.export-doc { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 36px; max-width: 760px; }
.export-doc h1 { font-size: 22px; margin-bottom: 4px; }
.export-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 22px; }
.export-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.export-section h3 { font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.export-section h4 { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 12px; margin-bottom: 5px; }
.export-row { display: flex; padding: 3px 0; font-size: 12px; border-bottom: 1px solid var(--surface-2); }
.export-label { flex: 0 0 46%; color: var(--text-muted); }
.export-value { flex: 1; }
.export-list-item { padding: 8px 0; border-bottom: 1px dashed var(--border); margin-bottom: 3px; }
.export-list-item:last-child { border-bottom: none; }

@media print {
  .no-print, .case-sidebar, .topbar { display: none !important; }
  .case-shell { display: block; }
  .case-main { padding: 0; max-width: 100%; }
  .export-doc { box-shadow: none; padding: 0; max-width: 100%; }
  body { background: #fff; color: #000; }
}

/* ---- Photos ---- */

.photo-subheader {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 10px 0 0;
}

.field-cell.field-inline-ref { grid-column: 1 / -1; padding: 0 0 9px; border-bottom: none; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-slot { position: relative; background: var(--surface-2); border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.photo-slot img { width: 100%; height: 88px; object-fit: cover; display: block; }
.photo-placeholder { width: 100%; height: 88px; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 11px; }
.photo-slot-empty { width: 100%; height: 88px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-faint); font-size: 24px; font-weight: 300; }
.photo-slot-empty:hover { background: var(--border); color: var(--accent); }

/* Scene Summary — report-photo picker and captions */
.modal-card-wide { max-width: 720px; }
.ss-photo-pick { cursor: pointer; }
.ss-photo-pick:hover { outline: 1px solid var(--border); }
.ss-photo-selected { outline: 2px solid var(--accent); }
.ss-photo-badge {
  position: absolute; top: 4px; left: 4px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ss-caption-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ss-caption-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.ss-caption-input { flex: 1; }
.photo-tile-footer { padding: 5px 7px; font-size: 10px; color: var(--text-muted); text-align: center; }
.photo-delete-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.65); border: none; color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 13px; cursor: pointer; line-height: 1; }

/* ---- CPSC ---- */

.cpsc-results { margin-top: 10px; }
.cpsc-result { padding: 11px; border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; font-size: 12px; }
.cpsc-result p { margin-top: 3px; }
.cpsc-result a { color: var(--accent); font-size: 11px; display: inline-block; margin-top: 5px; }

/* ---- Breaker panel: real two-column odd/even layout matching the
   native app's physical panel representation ---- */

.breaker-panel { border: 1px solid var(--border); border-radius: 9px; padding: 14px; margin-top: 10px; }
.breaker-panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.breaker-title { font-size: 14px; font-weight: 700; flex: 1; border: none; background: transparent; color: var(--text); padding: 0; }
.breaker-meta-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.breaker-meta-row label { font-size: 10px; margin-top: 0; }
.breaker-meta-row input, .breaker-meta-row select { margin-top: 2px; border: none; background: transparent; padding: 0; font-size: 13px; color: var(--text); }

.breaker-grid-2col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; margin-bottom: 10px; }
.breaker-col { display: flex; flex-direction: column; }
/* Flex, not grid — the 2-pole badge is optional per row, and a fixed
   grid-template-columns can't account for a variable number of items
   without misaligning every column after it. With flex, the label is the
   only item that grows/shrinks; every other item (amps, status, the pair
   icon, split icon) is a fixed width, so they always land at the same
   distance from the row's right edge whether or not that row's badge is
   showing — which is what keeps the 2-pole connecting line lined up
   between adjacent rows. */
.breaker-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.breaker-slot.breaker-slot-tandem { display: block; padding: 2px; border-bottom: none; }
.breaker-slot .breaker-slot-num { width: 22px; flex-shrink: 0; }
/* Grows to fill whatever's left after the fixed-width cells (same as
   native), just capped so it can't sprawl on very wide screens — a cap
   below the row's typical available width would leave dead space after
   the icons instead of shortening anything useful. */
.breaker-slot .breaker-slot-label { flex: 1 1 auto; min-width: 60px; max-width: 300px; }
.breaker-slot .breaker-slot-amps { width: 44px; flex-shrink: 0; }
.breaker-slot .breaker-status-btn { flex-shrink: 0; }

.breaker-split-btn, .breaker-pair-btn, .breaker-merge-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.breaker-split-btn:hover, .breaker-pair-btn:hover { color: var(--accent); border-color: var(--accent); }
.breaker-split-btn:disabled { opacity: 0.25; cursor: default; }
.breaker-split-btn:disabled:hover { color: var(--text-faint); border-color: transparent; }
.breaker-pair-btn.is-paired { color: #4a90e2; }
.breaker-pair-btn.is-paired:hover { color: var(--accent); }
/* Merge reuses the exact same two-squares icon as Split — native tints it
   orange rather than swapping to a different glyph, so the same icon means
   "toggle the tandem state" whichever direction it's going. */
.breaker-merge-btn { color: #e09628; width: 23px; height: 23px; }
.breaker-merge-btn:hover { color: var(--accent); border-color: var(--accent); }
.breaker-split-spacer { width: 23px; height: 23px; flex-shrink: 0; }

.breaker-2pole-badge {
  font-size: 9px;
  font-weight: 700;
  color: #4a90e2;
  background: rgba(74,144,226,0.15);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Pair (2-pole) link icon + the vertical connecting line native draws
   between two paired rows' icons — line-up/line-down are two independent
   half-height segments so adjacent paired rows' segments meet exactly at
   the row boundary and read as one continuous line, same technique as
   native's pairCell. */
.breaker-pair-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 23px;
  flex-shrink: 0;
}
.breaker-pair-line {
  position: absolute;
  left: 50%;
  width: 2px;
  background: #4a90e2;
  transform: translateX(-50%);
}
.breaker-pair-line.line-up { top: 0; height: 50%; }
.breaker-pair-line.line-down { bottom: 0; height: 50%; }
.breaker-pair-cell .breaker-pair-btn { position: relative; z-index: 1; background: var(--surface); }

/* Tandem (twin) breaker: two independent circuits sharing one physical
   slot number — shown as a bordered pair of half-rows, orange to match
   the native app's tandem theming. */
.breaker-slot-tandem {
  border: 1px solid rgba(224, 150, 40, 0.35);
  border-radius: 6px;
  background: rgba(224, 150, 40, 0.06);
  margin: 1px 0;
}
.breaker-slot-half { display: flex; align-items: center; gap: 6px; padding: 5px 4px; }
.breaker-slot-half:first-child { border-bottom: 1px solid rgba(224, 150, 40, 0.25); }
.breaker-slot-half .breaker-slot-num { width: 22px; flex-shrink: 0; }
.breaker-slot-half .breaker-slot-label { flex: 1; min-width: 0; }
.breaker-slot-half .breaker-slot-amps { width: 44px; flex-shrink: 0; }
.breaker-tdm-badge {
  font-size: 9px;
  font-weight: 700;
  color: #c9822a;
  background: rgba(224, 150, 40, 0.18);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.breaker-slot-num { font-size: 10px; color: var(--text-faint); text-align: center; font-variant-numeric: tabular-nums; }
.breaker-slot-label, .breaker-slot-amps {
  border: none;
  background: transparent;
  padding: 2px 0;
  font-size: 12px;
  color: var(--text);
}
.breaker-slot-amps { text-align: right; color: var(--text-muted); }
select.breaker-slot-amps, select.breaker-main-amps { cursor: pointer; text-align-last: right; }
.breaker-status-btn {
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
  min-width: 44px;
}
.breaker-status-on { background: var(--success); }
.breaker-status-off { background: var(--warning); color: #2a2a1a; }
.breaker-status-tripped { background: var(--danger); }
.breaker-status-unknown { background: #8a8f99; }

.breaker-row-controls { display: flex; gap: 8px; margin-bottom: 8px; }
.breaker-row-controls .secondary-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 11px;
}

@media (max-width: 700px) {
  .breaker-grid-2col { grid-template-columns: 1fr; }
  .breaker-meta-row { grid-template-columns: 1fr; }
}

/* ---- Case Header additions: IA role picker, address autocomplete,
   weather pull, thunderstorm banner ---- */

.role-field-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.role-select {
  background: rgba(232,28,35,0.14);
  color: var(--accent);
  border: none;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  overflow: hidden;
  margin-top: 4px;
}
.address-suggestion-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.address-suggestion-row:last-child { border-bottom: none; }
.address-suggestion-row:hover { background: var(--surface-2); }

.weather-pull-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.weather-pull-btn {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
}
.weather-pull-btn:hover { background: var(--accent-hover); color: #fff; }

.thunder-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: rgba(224,185,58,0.12);
  border: 1px solid rgba(224,185,58,0.35);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
  font-size: 13px;
}

/* ---- Roof Type Reference modal ---- */

.roof-ref-box { max-width: 640px; }
.roof-ref-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}
@media (max-width: 560px) {
  .roof-ref-grid { grid-template-columns: 1fr; }
}
.roof-ref-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.roof-ref-icon { width: 100%; height: 70px; margin-bottom: 6px; }
.roof-ref-icon svg { width: 100%; height: 100%; }
.roof-ref-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.roof-ref-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

/* ---- Electric reference sheets (Panel Condition / Wiring / Trip-to-OFF / Recalled Brand) ---- */
.ref-sheet-box { max-width: 620px; }
.ref-sheet-body { padding: 16px; }
.ref-sheet-section { margin-bottom: 18px; }
.ref-sheet-section h4 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.ref-sheet-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.ref-sheet-callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.ref-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ref-card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.ref-card-name { font-size: 13px; font-weight: 700; }
.ref-card-badge { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--border); color: var(--text-muted); }
.ref-card-badge-blue { background: rgba(74,144,226,0.15); color: #4a90e2; }
.ref-card-badge-amber { background: rgba(224,150,40,0.15); color: #e09628; }
.ref-card-badge-red { background: rgba(232,28,35,0.15); color: var(--accent); }
.ref-card-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* ---- Brand-match banners (recalled brand / trip-to-off) ---- */
.brand-banners:empty { display: none; }
.brand-banner {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 12px;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0 0;
  cursor: pointer;
  border: 1px solid;
}
.brand-banner-sub { display: block; font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.brand-banner-amber { background: rgba(224,150,40,0.10); border-color: rgba(224,150,40,0.35); color: var(--text); }
.brand-banner-blue { background: rgba(74,144,226,0.10); border-color: rgba(74,144,226,0.30); color: var(--text); }
.breaker-triptoref-link { display: block; margin: 8px 0 4px; }

/* ---- Dismissable reminder/guidance notes ---- */
.dismissable-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.dismissable-note-close { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; flex-shrink: 0; padding: 0; }
.dismissable-note-close:hover { color: var(--text); }

/* ---- Voice Note modal ---- */
.voice-note-box { max-width: 440px; }
.voice-note-body { padding: 18px; }
.voice-record-row { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 20px; }
.voice-record-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}
.voice-record-btn.recording { background: var(--danger); animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.voice-note-body textarea { width: 100%; margin: 6px 0 12px; min-height: 100px; }
#voiceTranscribeBtn { width: 100%; margin-bottom: 12px; }
#voiceNoteSaveBtn { width: 100%; }
#voiceNoteError { margin-bottom: 12px; }

/* ---- AI Analysis modal ---- */
.ai-analysis-box { max-width: 560px; }
.ai-analysis-body { padding: 18px; }
.ai-analysis-body .settings-unconfirmed-box { margin: 0 0 14px; }
#aiAnalysisRunBtn { width: 100%; }
.ai-analysis-result {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-top: 10px;
  max-height: 50vh;
  overflow-y: auto;
}
