@import url("colors_and_type.css");

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Canonical brand tokens (--mb-*) come from colors_and_type.css.
     The aliases below preserve account-console-local semantic names. */
  --blue:      var(--mb-blue);
  --blue-dk:   var(--mb-blue-deep);
  --blue-lt:   var(--mb-blue-soft);
  --green:     #16a34a;
  --red:       var(--mb-error);
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-700:  #374151;
  --gray-900:  #111827;
  --sidebar-w: 230px;
  --radius:    8px;
  --shadow:    0 1px 6px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ── Login screen ─────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mb-blue);
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 360px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}

.login-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gray-400);
  margin-bottom: 6px;
}

/* The wordmark image inside a .login-label — sized larger than the
   surrounding caption text so the brand mark reads at a glance. */
.login-label img {
  height: 40px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.login-sub {
  font-size: 15px;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  transition: border-color .15s, box-shadow .15s;
}

.btn-google:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.login-error {
  margin-top: 16px;
  font-size: 14px;
  color: var(--red);
  min-height: 20px;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Mobile top bar (MB-202) ──────────────────────────────────────────────
 * Hidden on desktop. At small viewports the sidebar collapses to a
 * hamburger toggle; the wordmark + button live here so the brand stays
 * anchored in the first-screen real estate that the sidebar used to
 * occupy. The toggle's data-mb-mobile-menu-toggle attribute + aria-
 * controls="sidebar" pair this with the existing <nav id="sidebar">,
 * exactly as on the marketing pages. */
.mobile-top-bar {
  display: none;
}
.mobile-top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-top-bar-logo {
  height: 22px;
  width: auto;
  display: block;
}
.mobile-top-bar-toggle {
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: #fff;
}
.mobile-top-bar-toggle:hover,
.mobile-top-bar-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.mobile-top-bar-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 160ms ease, opacity 120ms ease;
}
/* X affordance when open — mirrors the marketing-page hamburger so the
 * visual language is consistent across surfaces. */
.mobile-top-bar-toggle[aria-expanded="true"] .mobile-top-bar-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-top-bar-toggle[aria-expanded="true"] .mobile-top-bar-bar:nth-child(2) {
  opacity: 0;
}
.mobile-top-bar-toggle[aria-expanded="true"] .mobile-top-bar-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
@media (prefers-reduced-motion: reduce) {
  .mobile-top-bar-bar { transition: none; }
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* The "View public site" link sits under the missionary name in the
 * sidebar header. Extracted from an inline style in the markup (MB-202
 * touched this file so the no-inline-styles rule kicked in). */
.sidebar-public-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: underline;
}

/* Variant of .btn-logout used for the "Switch missionary" anchor.
 * Extracted from an inline style — same CSP-readiness rationale. */
.btn-logout-link {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: 6px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo {
  width: 24px;
  height: 30px;
  display: block;
  /* Legacy fallback if a <span> still carries this class */
  font-size: 24px;
  line-height: 1;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .6;
}

.sidebar-missionary {
  font-size: 15px;
  font-weight: 600;
  margin-top: 2px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,.7);
  border-radius: 6px;
  margin: 2px 8px;
  font-size: 15px;
  transition: background .12s, color .12s;
  text-decoration: none;
  position: relative;
}

.nav-item:hover        { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active       { background: var(--blue); color: #fff; }

.nav-icon {
  font-family: var(--mb-font-icons);
  font-size: 18px;
  line-height: 1;
  width: 22px;
  display: inline-block;
  text-align: center;
  font-weight: normal;
  font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
  opacity: .85;
  /* Don't ligature-substitute when content is a literal unicode glyph */
  font-feature-settings: "liga";
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: rgba(255,255,255,.4);
}

#account-email-display { display: block; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.5);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  transition: border-color .15s, color .15s;
}

.btn-logout:hover { border-color: rgba(255,255,255,.5); color: #fff; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  max-width: 960px;
}

.page        { display: none; }
.page.active { display: block; }

/* ── Maintenance-mode banner ─────────────────────────────────────────────────
 * Persistent across all account pages while missionary.maintenanceMode is on.
 * Amber palette to match the in-form warning treatment of the toggle itself.
 */
.maintenance-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  margin-bottom: 24px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  color: #78350f;
  font-size: 14px;
  line-height: 1.5;
}
.maintenance-banner-icon {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1.3;
}
.maintenance-banner-text { flex: 1; }
.maintenance-banner a {
  color: #78350f;
  text-decoration: underline;
  font-weight: 600;
}

/*
 * MB-197 Phase 8 — "Mission complete" banner. Green/celebratory
 * treatment — the mission ending is news worth marking, not an alarm.
 * Sits at the top of every account page while
 * declaredMissionEndDate < now AND the viewer is Missionary or Admin.
 */
.mission-end-banner {
  padding: 14px 16px;
  margin-bottom: 24px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #064e3b;
  font-size: 14px;
  line-height: 1.5;
}
.mission-end-banner__text {
  margin-bottom: 10px;
}
.mission-end-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.mission-end-banner__cta {
  color: #047857;
  text-decoration: underline;
  font-weight: 600;
}
.mission-end-banner__dismiss {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid #a7f3d0;
  background: transparent;
  color: #064e3b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

/*
 * MB-197 Phase 2 — "Missionary role unassigned" banner. Blue/info
 * treatment (vs. amber for maintenance) since it's a request for
 * information, not an alarm. Stacks above the dashboard content the
 * same way maintenance-banner does.
 */
.missionary-role-banner {
  padding: 14px 16px;
  margin-bottom: 24px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e3a8a;
  font-size: 14px;
  line-height: 1.5;
}
.missionary-role-banner__text {
  margin-bottom: 10px;
}
.missionary-role-banner__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.missionary-role-banner__self {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.missionary-role-banner__email {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  font-size: 14px;
}
.missionary-role-banner__submit {
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.missionary-role-banner__submit:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.missionary-role-banner__msg {
  min-height: 1.2em;
  margin-top: 8px;
  font-size: 13px;
}
.missionary-role-banner__msg--error { color: #991b1b; }
.missionary-role-banner__msg--ok    { color: #166534; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--gray-900);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header .page-title { margin-bottom: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dk); }

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--gray-400); }

.btn-send { background: var(--green); }
.btn-send:hover { background: #15803d; }

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

.btn-tertiary {
  background: none;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, color .15s;
}
.btn-tertiary:hover { border-color: #dc2626; color: #dc2626; }

.btn-back {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 14px;
  padding: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--gray-400);
  line-height: 1;
  padding: 4px;
}

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);

  /* The tiles are <button>s so they're keyboard-reachable. Strip the
     user-agent button look (centered text, system font, hand cursor on
     hover only) so they read as cards, not chrome buttons. */
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 80ms ease;
}

.stat-card:hover {
  border-color: var(--gray-300, #d1d5db);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
}

.stat-card:active {
  transform: translateY(0);
}

.stat-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 6px;
}

.stat-sublabel {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.field-error {
  font-size: 13px;
  color: #b91c1c;
  margin: 4px 0 0;
  min-height: 1em;
}
.form-control.invalid {
  border-color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.08);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--gray-700);
}

/* Intro / description paragraph for a config-card section, sits
   immediately under a .card-title. Tight to the heading above
   (visually attached) and well-separated from the form-groups
   below (so it reads as describing the section, not the next
   field). Use instead of .form-hint for these. */
.card-section-intro {
  margin: -10px 0 22px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--gray-500);
}

/* When a sub-section header (`<h3>`) appears inside a config-card
   (e.g. "Postmark location" inside the Postmark stamp card),
   match the visual rhythm of the top-level heading + intro. */
.card-subhead {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
}
.card-subhead-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-500);
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-action {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  border: none;
  transition: background .15s;
}

.btn-action:hover             { background: var(--blue-dk); }
.btn-action.secondary         { background: #fff; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-action.secondary:hover   { border-color: var(--gray-400); }

/* ── Tab bar ──────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: -2px;
}

.tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}

.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab:hover  { color: var(--gray-700); }

/* ── Item list ────────────────────────────────────────────────────────────── */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.item-row:hover { border-color: var(--gray-300); }

.item-title   { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.item-meta    { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: system-ui, sans-serif;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-sent    { background: #d1fae5; color: #065f46; }
.badge-draft   { background: var(--gray-100); color: var(--gray-500); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 15px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
  background: #fff;
  color: var(--gray-900);
  font-family: inherit;
}

.form-control:focus { border-color: var(--blue); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 5px;
}

/* ── Letter editor ────────────────────────────────────────────────────────── */
.editor-wrap {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.editor-actions { display: flex; gap: 10px; }

.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-300);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar button {
  padding: 4px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  color: var(--gray-700);
  transition: background .1s;
}

.editor-toolbar button:hover { background: var(--gray-200); }

.editor-body {
  min-height: 360px;
  padding: 16px;
  border: 1.5px solid var(--gray-300);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 16px;
  font-family: var(--mb-font-serif);
  line-height: 1.8;
  outline: none;
  color: var(--gray-900);
}

.editor-body:focus { border-color: var(--blue); }
.editor-body:empty:before { content: attr(placeholder); color: var(--gray-400); }

.editor-status {
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
  color: var(--green);
}

.editor-status.error { color: var(--red); }

/* ── Site Config auto-save toast ─────────────────────────────────────────────
 * Single status surface beneath the form. State is communicated via the
 * --saving / --saved / --partial / --error modifier on the same node;
 * #config-status is treated as a polite live region in the HTML.
 */
.config-toast {
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
  color: var(--gray-500);
  transition: opacity 200ms ease;
}
.config-toast--saving  { color: var(--gray-500); }
.config-toast--saved   { color: var(--green); }
.config-toast--partial { color: var(--mb-warning); }
.config-toast--error   { color: var(--red); }

/* ── Per-field validation visuals ────────────────────────────────────────────
 * Used by the Site Config auto-save flow (option a): the field stays red
 * with an inline message, but valid edits elsewhere on the form still
 * ship. .is-invalid lands on the input itself; .field-error-msg is
 * injected as the input's next sibling.
 */
.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.field-error-msg {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--red);
}

/* ── Attachments ──────────────────────────────────────────────────────────── */
.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--gray-700);
}

.attachment-chip button {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.btn-upload {
  display: inline-block;
  padding: 7px 14px;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--gray-500);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-upload:hover { border-color: var(--blue); color: var(--blue); }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.search-bar { margin-bottom: 16px; }
.search-bar .form-control { max-width: 400px; }

/* ── Bulk import panel ────────────────────────────────────────────────────── */
.import-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.import-panel-inner {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.import-header h2 { font-size: 20px; }

.import-hint {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 16px;
  line-height: 1.6;
}

.import-textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  resize: vertical;
  margin-bottom: 16px;
  outline: none;
}

.import-textarea:focus { border-color: var(--blue); }

.import-actions { display: flex; gap: 10px; margin-bottom: 20px; }

.import-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.import-preview th {
  text-align: left;
  padding: 8px 10px;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-700);
  font-weight: 600;
}

.import-preview td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.import-preview .status-new       { color: var(--green); font-weight: 600; }
.import-preview .status-duplicate { color: var(--gray-400); }
.import-preview .status-invalid   { color: var(--red); }

.import-summary {
  font-size: 14px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: var(--gray-700);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  /* z-index MUST outrank Leaflet's pane/control stack on any page that
     can show the modal over a map. Leaflet uses up to ~1000 (tile-pane
     200, marker-pane 600, popup-pane 700, controls 1000). 10000 keeps
     us comfortably above that while staying below the conventional
     ranges browser chrome / a11y libraries reserve.
     See: 2026-05-12 regression entry + project_bug_map_pin_modal_occlusion
     in user memory. Do not lower below 1001 without a reason. */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ── Loading / empty ──────────────────────────────────────────────────────── */
.loading-row {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
  font-size: 15px;
}

.empty-row {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
  font-size: 15px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
/* MB-202 — on mobile, the sidebar collapses behind a hamburger toggle in
 * a fixed top bar. Without this, the always-on full-width sidebar takes
 * the entire first screen and page transitions read as "nothing happened"
 * because the menu is the only visible content after a tap.
 *
 * Breakpoint matches the prior `max-width: 768px` rule for the SPA so
 * we don't introduce a new threshold mid-file. The marketing pages chose
 * 600px for their own nav; the SPA needs slightly more room because the
 * top bar holds a wordmark + a 44px hit target. */
@media (max-width: 768px) {
  .app-shell     { flex-direction: column; }

  /* Top bar shows, fixed at the top so the page below scrolls under it. */
  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 12px;
    background: var(--gray-900);
    color: #fff;
    /* Must outrank Leaflet's pane/control stack (up to ~1000) so the bar
       and its toggle stay above the dashboard map. Mirrors the modal-overlay
       rule below; +1 over the sidebar so the close affordance stays clickable.
       See MB-215. */
    z-index: 1002;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Sidebar becomes a drop-down panel under the top bar. Hidden by
   * default; CSS reads data-open which the toggle module flips. */
  .sidebar {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 56px);
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    overflow-y: auto;
    /* The drop-down panel overlays the dashboard, which renders a Leaflet
       map (panes/controls up to ~1000). At the desktop default (z-index:100)
       the map painted through the menu — MB-215. Lift above Leaflet, below
       the modal overlay (10000) so modals still cover the menu. */
    z-index: 1001;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    transition: transform 180ms ease;
    visibility: hidden;
  }
  .sidebar[data-open="true"] {
    transform: translateY(0);
    visibility: visible;
  }
  @media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
  }

  /* Main content makes room for the fixed top bar; no left margin since
   * the sidebar isn't pinned to the side anymore. */
  .main-content  { margin-left: 0; padding: 80px 16px 24px; }

  .stat-grid     { grid-template-columns: 1fr 1fr; }
  .form-row      { grid-template-columns: 1fr; }
}

/* ── Template thumbnails (Email Design tab) ─────────────────────────────── */
.template-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.template-thumb {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  font: inherit;
  color: inherit;
  text-align: center;
}
.template-thumb:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}
.template-thumb.is-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.template-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid #f3f4f6;
  background: #f9fafb;
}
.template-thumb-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

/* ── Live stamp preview (Email Design → Postmark stamp card) ────────────── */
/* Renders the SVG postmark returned by previewStampSvg. Inline-rendered
   so the user sees their Stamp Style + Postmark Location edits without
   opening the broadcast modal. The SVG is server-generated and trusted. */
.stamp-preview-slot {
  /* Block flow (no flex) — per user request 2026-05-18 — so the
     stamp sits at the natural width set on the SVG element via CSS
     below, rather than being centered+squeezed by flex children. */
  margin: 12px 0 18px;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  min-height: 110px;
}
.stamp-preview-slot svg {
  /* Render the SVG ~2x its embedded-email size so the user can
     actually read the cancellation text while editing. The viewBox
     preserves aspect ratio; height is computed automatically.
     Capped at 100% of the container so it doesn't overflow narrow
     viewports. */
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
}
.stamp-preview-empty {
  color: var(--gray-500);
  font-size: 13px;
  line-height: 1.5;
}
.stamp-preview-loading {
  color: var(--gray-500);
  font-size: 12px;
  font-style: italic;
}
.stamp-preview-error {
  color: #b94843;
  font-size: 12px;
}

/* ── Broadcast preview modal (Email Design tab) ─────────────────────────── */
.letter-preview-modal-inner {
  max-width: 920px;
  width: 100%;
  padding: 24px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.letter-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.letter-preview-subject {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7280;
}
.letter-preview-subject strong {
  color: #1f2937;
  font-weight: 600;
}
.letter-preview-frame-wrap {
  flex: 1;
  min-height: 480px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  position: relative;
  overflow: hidden;
}
.letter-preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 0;
  background: #fff;
}
.letter-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}
.letter-preview-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 13px;
}

/* ── Placeholder-resolution hint (small live preview under inputs) ─────── */
.placeholder-resolution {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}
.placeholder-resolution strong {
  color: #1f2937;
  font-weight: 600;
}

/* ── Letter delivery results panel ─────────────────────────────────────── */
.delivery-panel {
  margin-top: 24px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.delivery-panel-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.delivery-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.delivery-count {
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  text-align: center;
}
.delivery-count-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 4px;
}
.delivery-count-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: #1f2937;
}
.delivery-count-failure .delivery-count-value {
  color: #991b1b;
}
.delivery-count-success .delivery-count-value {
  color: #166534;
}
.delivery-details summary {
  cursor: pointer;
  font-size: 13px;
  color: #4b5563;
  padding: 4px 0;
}
.delivery-perrecipient {
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 13px;
  color: #374151;
}
.delivery-perrecipient-row {
  padding: 6px 8px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.delivery-perrecipient-row:last-child {
  border-bottom: none;
}
.delivery-perrecipient-state {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #374151;
}
.delivery-perrecipient-state.is-failure {
  background: #fee2e2;
  color: #991b1b;
}
.delivery-perrecipient-state.is-success {
  background: #dcfce7;
  color: #166534;
}
.delivery-empty {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* ── Domain Setup wizard rebuild (2026-05-20) ─────────────────────────────── */
/* Shape A linear flow: Add records → I saved → Verify → Activate inbound.
   No inline styles per [[no-inline-styles-csp]]; everything here is a class
   on a stable element id. */
.ds-page-intro { color: #6b7280; margin-bottom: 24px; font-size: 15px; }
.ds-card-spacer { margin-bottom: 24px; }
.ds-help-text { color: #4b5563; font-size: 14px; margin: 0 0 12px; }
.ds-help-text--mt { margin-top: 8px; }
.ds-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.ds-row-aligned {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.ds-registrar-detected { color: #6b7280; font-size: 13px; }
.ds-registrar-select { max-width: 320px; }
.ds-registrar-walkthrough {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 14px;
}
.ds-drift-banner {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 14px;
  line-height: 1.5;
}

/* DNS records list — grouped by purpose, not by vendor */
.ds-records-empty {
  padding: 16px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  color: #6b7280;
  font-size: 14px;
  font-style: italic;
}
.ds-records-group { margin-bottom: 20px; }
.ds-records-group:last-child { margin-bottom: 0; }
.ds-records-group-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}
.ds-records-group-blurb {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 10px;
}
.ds-record-row {
  display: grid;
  grid-template-columns: 80px minmax(80px, 1fr) 2fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.ds-record-row:last-child { margin-bottom: 0; }
.ds-record-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
}
/* MB-175: Host and Value cells share click-to-copy affordances so the
   customer can paste either part of a record into their registrar
   without selecting text manually (which is where typos creep in).
   The host's box also makes the row read as "two pasteable fields"
   instead of "one label + one pasteable value." */
.ds-record-host,
.ds-record-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #111827;
  cursor: pointer;
  word-break: break-all;
  padding: 6px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: background-color 120ms;
}
.ds-record-host:hover,
.ds-record-value:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.ds-record-host.is-copied,
.ds-record-value.is-copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.ds-record-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Generic click-to-copy affordance — applies to any element marked with
   .copy-cell. The global click delegate in account-app.js's
   setupClickToCopy() reads the element's textContent (or data-copy
   attribute when set) and stamps the clipboard. Used for the
   dashboard's intake/roster addresses, the Site Settings letters@
   reference, and the Domain Setup wizard's inbound-address card. */
.copy-cell {
  cursor: pointer;
  transition: background-color 120ms, outline-color 120ms;
  outline: 1px solid transparent;
}
.copy-cell:hover {
  outline-color: #c7d2fe;
}
.ds-record-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: #6b7280;
}
.ds-record-why {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.ds-record-why:hover { color: #1d4ed8; }

/* "I just saved my records" affordance */
.ds-saved-action {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.ds-saved-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: #6b7280;
}
.ds-saved-status.is-success { color: #166534; }

/* Verify card */
.ds-verify-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
}
.ds-verify-summary.is-success {
  background: #dcfce7;
  color: #166534;
}
.ds-patience-nudge {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.ds-patience-nudge.is-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.ds-patience-nudge.is-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
.ds-conflict-list { margin-top: 14px; }
.ds-conflict {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
  border-style: solid;
  border-width: 1px;
}
.ds-conflict:last-child { margin-bottom: 0; }
.ds-conflict-label {
  font-weight: 700;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.ds-verify-list { margin-top: 18px; }
.ds-verify-row {
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
}
.ds-verify-row:last-child { margin-bottom: 0; }
.ds-verify-row-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ds-verify-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.ds-verify-chip.is-verified { background: #dcfce7; color: #166534; }
.ds-verify-chip.is-propagating { background: #fef9c3; color: #854d0e; }
.ds-verify-chip.is-mismatch { background: #fed7aa; color: #9a3412; }
.ds-verify-chip.is-missing { background: #fee2e2; color: #991b1b; }
.ds-verify-record-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #111827;
}
.ds-verify-detail {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 12px;
  font-size: 12px;
  color: #4b5563;
}
.ds-verify-detail-label { font-weight: 600; color: #6b7280; }
.ds-verify-detail-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  color: #111827;
}
.ds-verify-hint {
  margin-top: 6px;
  padding: 8px 10px;
  background: #f9fafb;
  border-left: 3px solid #93c5fd;
  font-size: 12px;
  color: #374151;
  border-radius: 4px;
}
.ds-empty-state {
  padding: 16px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  color: #6b7280;
  font-size: 14px;
  font-style: italic;
}

/* Activate inbound card */
.ds-activate-banner {
  padding: 14px 16px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.ds-activate-banner.is-success {
  background: #dcfce7;
  color: #166534;
}
.ds-activate-banner.is-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.ds-activate-banner.is-pending {
  background: #eff6ff;
  color: #1e40af;
}

/* Why-this-matters modal */
.ds-csh-modal-body {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: #1f2937;
}
.ds-csh-modal-body h1,
.ds-csh-modal-body h2,
.ds-csh-modal-body h3 {
  margin-top: 18px;
  margin-bottom: 6px;
  color: #111827;
}
.ds-csh-modal-body h1:first-child,
.ds-csh-modal-body h2:first-child {
  margin-top: 0;
}
.ds-csh-modal-body p { margin-bottom: 10px; }
.ds-csh-modal-body code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ds-csh-modal-body ul,
.ds-csh-modal-body ol {
  margin: 0 0 10px 20px;
}

/* Narrow-screen modal */
.ds-narrow-modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ds-narrow-link-status {
  margin-top: 10px;
  font-size: 13px;
  color: #166534;
  min-height: 18px;
}

/* Hidden helper — kept off the visual layer until JS shows it */
.ds-hidden { display: none; }

/* Help footer + prominent prompt (extracted from previously-inline styles) */
.ds-help-footer {
  margin-top: 28px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  color: #4b5563;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ds-help-prominent {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 10px;
  color: #92400e;
  font-size: 14px;
}
.ds-help-prominent-link {
  color: #92400e;
  text-decoration: underline;
}

/* Help modal & CSH modal & narrow-screen modal sizing/prose */
.ds-modal-narrow { max-width: 560px; }
.ds-modal-wide { max-width: 600px; }
.ds-modal-narrow-screen { max-width: 480px; }
.ds-modal-prose {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.5;
}
.ds-help-snapshot {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}
.ds-help-counter {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9ca3af;
}
.ds-help-error-line {
  min-height: 16px;
}

/* When .btn-secondary is applied to an <a> (e.g. the /admin/ → /admin/logs
 * navigation link), default link underline + baseline alignment fight with
 * the sibling <button class="btn-secondary"> elements. .btn-as-link
 * normalizes the anchor's appearance so it matches the buttons it sits
 * next to. Generic enough to reuse on any future button-styled-link. */
.btn-as-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-as-link:hover {
  text-decoration: none;
}

/* Vertical gap between stacked admin cards, as a class so new cards don't
   need an inline style="margin-top:24px" (CLAUDE.md no-inline-styles rule). */
.card-spaced {
  margin-top: 24px;
}

/* ── MB-137: global broadcast promo line (admin console) ──────────────────────
   Styles live here (not inline) so /admin can run under a strict CSP later —
   see CLAUDE.md "no inline styles" rule. Used by the "Broadcast promo line"
   card in /admin/index.html. */
.promo-input {
  width: 100%;
  max-width: 560px;
  font-family: inherit;
  resize: vertical;
}
.promo-help {
  margin: 4px 0 0;
  color: var(--gray-500);
  font-size: 12px;
  line-height: 1.5;
  max-width: 560px;
}
.promo-help code {
  background: var(--gray-100);
  padding: 1px 4px;
  border-radius: 4px;
}
.promo-preview-label {
  margin: 16px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-400);
}
/* The live preview frames the rendered footer line in the same muted gray
   the broadcast footers use, so the operator sees it in context. */
.promo-preview {
  max-width: 560px;
  min-height: 22px;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  font-size: 12px;
  line-height: 1.6;
  color: #888;
}
.promo-preview-empty {
  color: var(--gray-400);
  font-style: italic;
}
.promo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.promo-meta {
  margin: 0;
  color: var(--gray-400);
  font-size: 12px;
}

/* ── MB-097: Subscribers "Share your page" QR panel ─────────────────────────── */

.qr-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.qr-panel--empty,
.qr-panel--loading {
  text-align: center;
}

.qr-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.qr-panel-header-text {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-qr-toggle {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.btn-qr-toggle:hover {
  background: var(--gray-100);
}

/* Collapsed: hide the body, drop the header bottom margin, hide the
   now-redundant blurb so the collapsed state reads as a compact
   summary card. The title + Show button are enough on their own. */
.qr-panel.is-collapsed .qr-panel-body {
  display: none;
}

.qr-panel.is-collapsed .qr-panel-header {
  margin-bottom: 0;
}

.qr-panel.is-collapsed .qr-panel-blurb {
  display: none;
}

.qr-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 6px;
}

.qr-panel-blurb {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.45;
  margin: 0;
}

.qr-panel-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.qr-panel-preview-wrap {
  flex: 0 0 auto;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
}

.qr-panel-preview {
  display: block;
  width: 240px;
  height: 240px;
}

.qr-panel-side {
  flex: 1 1 280px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-panel-url-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qr-panel-url-label {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qr-panel-url {
  background: var(--gray-100);
  color: var(--gray-900);
  padding: 6px 10px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

.qr-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Buttons inherit the standard .btn-primary / .btn-secondary sizing
   (9px × 18px padding, default font-size) — no override here so the
   tap-target stays consistent with the rest of the SPA. Earlier
   iteration shrunk them which dropped below ≈30px height on mobile;
   reverted per the DoD's "Tap targets" check. */

.qr-panel-toast {
  min-height: 18px;
  font-size: 13px;
  color: var(--green);
  margin: 0;
  opacity: 0;
  transition: opacity 200ms ease;
}

.qr-panel-toast.is-visible {
  opacity: 1;
}

.qr-panel-error {
  font-size: 13px;
  color: var(--red);
  margin: 0;
}

/* Stack the preview above the actions on narrow viewports so the QR
   isn't cramped. Also cap the QR display size so it doesn't dominate
   the screen — 240px on a 375px phone is ~64% of viewport; 180px is
   well above the minimum readable size for a QR but reads as a tidy
   thumbnail rather than a hero element. Canvas backing buffer stays
   at PREVIEW_PIXEL_SIZE × DPR (set by JS in qr-panel.js) so the QR
   remains crisp when scaled down by CSS. */
@media (max-width: 640px) {
  .qr-panel-body {
    flex-direction: column;
    align-items: center;
  }
  .qr-panel-side {
    width: 100%;
  }
  .qr-panel-preview {
    width: min(180px, 60vw);
    height: min(180px, 60vw);
  }
}
