/* FMA UK Enquiry Response Tool — shared styles
 * Phase 6.8: brand colours updated to the official FMA UK palette.
 * Purple: #402D89 (deep saturated brand purple)
 * Yellow: #F3EC18 (accent, used sparingly for highlights)
 */

:root {
  --purple: #402d89;
  --purple-dark: #2e2069;
  --purple-soft: #ede9f8;        /* tinted panels */
  --yellow: #f3ec18;             /* accent only */
  --bg: #f6f4fa;
  --card: #ffffff;
  --border: #d4ccdf;
  --text: #2a2433;
  --muted: #6b6478;
  --ok: #2e7d4f;
  --err: #b3261e;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 17px 18px 70px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--purple-dark); }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 0.95rem; }
.topbar { display:flex; justify-content: space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; margin-bottom: 13px; }
.topbar-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.who { font-size: 0.85rem; color: var(--muted); }
a { color: var(--purple-dark); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card h2 { font-size: 1.1rem; margin: 0 0 4px; color: var(--purple-dark); }
.card .cardsub { font-size: 0.85rem; color: var(--muted); margin: 0 0 14px; }

/* Sidebar menu */
.menu { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.menu h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 6px 8px 10px; }
.menu-item {
  display:block; width:100%; text-align:left; background:transparent; color:var(--text);
  border:none; border-radius:8px; padding:11px 12px; font-size:0.95rem; cursor:pointer; font-weight:500;
}
.menu-item:hover { background:#f1edf8; }
.menu-item.active { background: var(--purple); color:#fff; }

/* Form elements */
label.block {
  display:block; font-size: 0.82rem; font-weight: 600; color: var(--muted);
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em;
}
textarea, input[type=text], input[type=password] {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85rem;
  background: #fbfafd; color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
textarea.tall { min-height: 200px; }
textarea#raw { min-height: 300px; font-size: 0.85rem; }
input[type=text], input[type=password] { padding: 10px 12px; font-size: 0.82rem; }
textarea:focus, input[type=text]:focus, input[type=password]:focus {
  outline: 2px solid var(--purple); border-color: var(--purple);
}
.hint { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }

/* Buttons */
.btnrow { display:flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
button, a.button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 11px 18px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button:hover, a.button:hover { background: var(--purple-dark); }
button.secondary, a.button.secondary { background: #efeaf6; color: var(--purple-dark); }
button.secondary:hover, a.button.secondary:hover { background: #e3dbf0; }
button.danger { background: #f6e9e8; color: var(--err); }
button.danger:hover { background: #efd6d3; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Output box (user page) */
.output {
  width: 100%; min-height: 360px; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92rem; white-space: pre-wrap; background: #fbfafd; color: var(--text);
}

/* Toast notifications */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ok); color:#fff; padding: 10px 20px; border-radius: 8px;
  font-size: 0.9rem; opacity: 0; transition: opacity .25s; pointer-events:none; z-index: 100;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--err); }

/* Warnings / banners */
.warn {
  background: #fff4e5; border: 1px solid #f0d9b0; color: #8a5a00;
  padding: 10px 12px; border-radius: 8px; font-size: 0.85rem;
  margin-top: 12px;
}
.banner {
  background: #fff4e5; border: 1px solid #f0d9b0; color: #8a5a00;
  padding: 12px 14px; border-radius: 8px; font-size: 0.9rem;
  margin-bottom: 18px;
}
.banner a { color: #8a5a00; font-weight: 600; }

/* Login / setup grid */
.login-grid { display:grid; gap:12px; max-width: 420px; }
.login-grid label {
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.err-msg { color: var(--err); font-size: 0.88rem; margin-top: 8px; min-height: 1.2em; }

/* Field groups (admin editor) */
.field-group { margin-bottom: 16px; }
.section-divider { border:0; border-top:1px solid var(--border); margin: 22px 0 18px; }
.group-title { font-size: 0.95rem; font-weight:700; color: var(--purple-dark); margin: 0 0 12px; }
.saved-flag { font-size: 0.8rem; color: var(--ok); font-weight:600; }

/* Footer meta on user page */
.footer-meta { margin-top: 22px; font-size: 0.85rem; }

/* Details / disclosures */
details { margin-top: 18px; font-size: 0.86rem; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; color: var(--purple-dark); }
details code { background:#efeaf6; padding: 1px 5px; border-radius: 4px; }

/* Layouts */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items:start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }
.two { display:grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }

/* Admin-specific */
.admin-header { display:flex; justify-content: space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom: 22px; }
.admin-header h1 { margin: 0; }
.admin-header .nav { display:flex; gap:10px; align-items:center; }
.admin-card-header { display:flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.admin-card-header h2 { margin: 0; }

/* Phase 4: postcode search result rows */
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfafd;
  margin-bottom: 6px;
}
.result-row:last-child { margin-bottom: 0; }
.result-row button { padding: 6px 12px; font-size: 0.85rem; }

/* Phase 5: version footer + signed-in indicator */
/* Phase 7.26.0: the same quick-access buttons repeated at the top, inside the
   search strip. Left-aligned so they line up with the search field above them,
   where the footer copy is centred. */
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.quick-links a.button { font-size: 0.82rem; }

/* 2026-10-14: on narrow screens, hide the top quick-access row (the one
   under the search bar, #topLinks -- not the bottom one, #footerLinks,
   which stays) and show the same items under the account icon instead,
   so they don't take up vertical space right at the top on a phone. */
.profile-quicklinks { display: none; }
@media (max-width: 600px) {
  #topLinks { display: none; }
  .profile-quicklinks {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
  }
}

/* Phase 7.26.0: back-to-top button. Long views -- the support group data table
   especially -- otherwise need scrolling all the way back up to reach the
   controls. z-index sits below the toast (100) and well below the bookmarks
   flyout and modals (1099+), so none of those get obscured. Declared as a
   class so it beats the bare `button` rules above. */
.scroll-top-btn {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  width: 42px; height: 42px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--purple-dark);
  font-size: 1.15rem; line-height: 1;
  box-shadow: 0 2px 10px rgba(42, 36, 51, 0.18);
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
}
.scroll-top-btn.show { display: flex; }
.scroll-top-btn:hover { background: #efeaf6; color: var(--purple-dark); }

/* Phase 7.24.0: quick-access buttons above the version footer. Reuses the
   existing a.button.secondary styling, so only layout is defined here. */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 22px 0 0;
}
.footer-links a.button { font-size: 0.82rem; }

.version-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 24px 0 8px;
  letter-spacing: 0.04em;
}
.topbar-actions .hint { display: inline; }

/* Phase 5: dashboard tiles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dash-card {
  background: #fbfafd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
}
.dash-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.dash-number {
  margin: 6px 0 4px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple-dark);
  line-height: 1;
}
.dash-card .hint { margin: 4px 0 0; font-size: 0.82rem; }

/* Users table */
.resp-table select { padding: 4px; font-size: 0.85rem; }

/* Phase 5.1: role badges, inline links, selected-groups header */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 11px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 6px;
}
.role-badge.primary {
  background: var(--purple);
  color: #fff;
}
.role-badge.backup {
  background: #e9e3f5;
  color: var(--purple-dark);
}

.result-row-selected {
  background: #f6f2fc;
  border-color: var(--purple);
}

.inline-links {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 4px 0 14px;
  padding: 8px 12px;
  background: #faf8fd;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}
.inline-links a {
  font-weight: 600;
  color: var(--purple-dark);
}
.inline-links a:hover { text-decoration: underline; }

.selected-groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Phase 5.2: danger-zone styling */
.danger-zone {
  border: 1px solid #ecc6c6;
  background: #fdf5f5;
}
.danger-zone .group-title { color: #b93232 !important; }

/* Phase 5.3: bookmarks bar at the bottom of the support group card */
.bookmarks-bar {
  margin-top: 20px;
  padding: 12px 14px;
  background: #faf8fd;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.bookmarks-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  margin-right: 4px;
}
.bookmark-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
}
.bookmark-item:last-child { margin-right: 0; }
.bookmark-item a {
  font-weight: 600;
  color: var(--purple-dark);
  font-size: 0.88rem;
}
.bookmark-item a:hover { text-decoration: underline; }
.audience-badge {
  display: inline-block;
  padding: 1px 7px;
  background: #e9e3f5;
  color: var(--purple-dark);
  border-radius: 9px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

/* Phase 5.4: profile menu in topbar */
.profile-menu { position: relative; display: inline-block; }
.profile-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.1s, box-shadow 0.1s;
}
.profile-icon:hover { transform: scale(1.05); box-shadow: 0 2px 5px rgba(0,0,0,0.15); }
.profile-icon:focus { outline: 2px solid var(--purple-dark); outline-offset: 2px; }
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(42,36,51,0.12);
  min-width: 220px;
  z-index: 50;
  overflow: hidden;
}
.profile-info {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: #faf8fd;
}
.profile-name { font-weight: 600; font-size: 0.95rem; color: var(--purple-dark); }
.profile-role { font-size: 0.75rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.profile-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  font-family: inherit;
  text-decoration: none;
}
.profile-item:hover { background: #faf8fd; }
.profile-item:focus { outline: none; background: #f1eaf8; }

/* Phase 5.4: sidebar visual differentiation for manage/action items */
.menu-subsection {
  font-size: 0.7rem !important;
  color: var(--muted) !important;
  border-top: none !important;
  padding-top: 8px !important;
  margin-top: 8px !important;
  font-weight: 600 !important;
}
.menu-action {
  font-style: italic;
  color: var(--purple-dark);
  margin-top: 4px;
  position: relative;
  padding-left: 28px;
}
.menu-action::before {
  content: "⚙";
  position: absolute;
  left: 10px;
  font-style: normal;
  opacity: 0.7;
}
.menu-action.active { font-style: normal; }

/* Phase 6.1: CiviCRM "open in" link in the support groups data view */
.civi-link {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: #e6f0fa;
  color: #1d5a96;
  border-radius: 9px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  text-decoration: none;
}
.civi-link:hover { background: #d4e4f5; text-decoration: underline; }

/* Phase 6.2: passphrase suggest link inside labels */
.suggest-link {
  margin-left: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--purple-dark);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.1s;
}
.suggest-link:hover { background: #f1eaf8; }
.suggest-link:focus { outline: 2px solid var(--purple); outline-offset: 1px; }

/* Phase 6.2: signature preview in My Account */
.sig-preview {
  margin: 0;
  padding: 12px 14px;
  background: #fbfafd;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 60px;
}
.sig-preview-empty { font-style: italic; color: var(--muted); }

/* Phase 6.3: stale-data flag, charity flag, group extras */
.stale-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #fdf2f0;
  color: #b93232;
  border: 1px solid #f1c6bf;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.charity-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 4px;
  background: #e8f3ea;
  color: #1f7a3c;
  border-radius: 9px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

/* Phase 7.27: open-flag badge on search results, same palette as the
   map's fmauk-popup-flag / cluster-ring amber so it reads consistently
   across the whole app. */
.flag-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 4px;
  background: #fdf2f0;
  color: #7a3025;
  border: 1px solid #f1c6bf;
  border-radius: 9px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  cursor: help;
}

/* Phase 6.3: volunteer search result expander */
.group-extras {
  margin-top: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.group-extras summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--purple-dark);
  font-weight: 600;
  padding: 4px 0;
  user-select: none;
}
.group-extras summary:hover { text-decoration: underline; }
.group-extras-body {
  margin-top: 8px;
  font-size: 0.85rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.group-extras-body label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.group-extras-body input[type="checkbox"] { margin: 0; }
.group-website {
  font-size: 0.86rem;
  margin-top: 2px;
}
.group-website a {
  color: var(--purple-dark);
  font-weight: 500;
}

/* Phase 6.5: modal (shared by admin.html and index.html now) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(42,36,51,0.55);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; padding: 20px; max-width: 480px; width: 100%; }
.modal h3 { color: var(--purple-dark); margin: 0 0 8px; }
.modal p { color: var(--text); margin: 0 0 14px; }

/* Phase 6.5: outcome recording card */
.outcome-card { background: #fbfafd; margin-top: 14px; }
.outcome-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin-top: 6px;
}
.outcome-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px 0;
}
.outcome-options input[type="radio"] { margin: 0; }
@media (max-width: 600px) {
  .outcome-options { grid-template-columns: 1fr; }
}

/* Phase 6.5: flag-for-review link in search results */
.flag-link {
  background: none;
  border: 1px solid #f1c6bf;
  color: #b93232;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.flag-link:hover { background: #fdf2f0; }
.flag-link:focus { outline: 2px solid #b93232; outline-offset: 1px; }

/* Phase 6.5: open-flag count badge on the Flags menu entry */
.flag-count-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  background: #b93232;
  color: #fff;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* Phase 6.5: admin flag list rows */
.flag-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffbfb;
  margin-bottom: 10px;
}
.flag-row.flag-resolved {
  background: #f6f6f8;
  opacity: 0.85;
}

/* Phase 6.5: outcome summary table sits in a soft panel */
.outcome-summary {
  padding: 14px;
  background: #fbfafd;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.outcome-summary table { margin-top: 8px; }

/* Phase 6.7: brief flash to draw the eye when the outcome card appears */
.outcome-card-flash {
  animation: outcome-flash 1.3s ease-out;
}
@keyframes outcome-flash {
  0%   { box-shadow: 0 0 0 4px rgba(92, 61, 140, 0.55); }
  100% { box-shadow: 0 0 0 4px rgba(92, 61, 140, 0); }
}

/* Phase 6.7: volunteer-side response menu, category subgroups */
details.vol-menu-section { margin: 4px 0; }
summary.vol-menu-cat {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple-dark);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 6px 8px;
  border-radius: 6px;
}
summary.vol-menu-cat::-webkit-details-marker { display: none; }
summary.vol-menu-cat::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  font-size: 0.72rem;
  color: var(--muted);
  transition: transform 0.15s ease-out;
}
details[open] > summary.vol-menu-cat::before { transform: rotate(90deg); }
summary.vol-menu-cat:hover { background: rgba(92, 61, 140, 0.08); }
details.vol-menu-section .menu-item { margin-left: 14px; }

/* Phase 6.7: bookmarks flyout panel */
.bookmarks-trigger {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  color: var(--purple-dark);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 10px;
  font-family: inherit;
}
.bookmarks-trigger:hover { background: #fff; border-color: var(--purple); }
.bookmarks-trigger:focus { outline: 2px solid var(--purple); outline-offset: 2px; }
@media (max-width: 600px) {
  .bookmarks-trigger-label { display: none; }
}

.bookmarks-flyout-backdrop {
  position: fixed; inset: 0;
  background: rgba(42, 36, 51, 0.4);
  /* Phase 7.5.5: bump above Leaflet's panes/controls (max 800) so the
     bookmarks flyout sits above any map content. */
  z-index: 1099;
}
.bookmarks-flyout {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 90vw;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.15);
  z-index: 1100;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
}
.bookmarks-flyout.open { transform: translateX(0); }
.bookmarks-flyout-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f6f0fa, #fff);
}
.bookmarks-flyout-header h2 {
  margin: 0; font-size: 1.1rem; color: var(--purple-dark);
}
.bookmarks-flyout-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--muted);
  padding: 0 6px; font-family: inherit;
}
.bookmarks-flyout-close:hover { color: var(--text); }
.bookmarks-flyout-body {
  flex: 1; overflow-y: auto;
  padding: 12px 18px 18px;
}
/* Phase 6.8.2: bookmark categories are now <details>, with a summary
   header carrying a count badge and a chevron. Tighter overall layout. */
.bookmarks-flyout-body {
  padding: 10px 16px 16px;
}
.bookmark-cat { margin-top: 6px; }
.bookmark-cat:first-child { margin-top: 0; }
.bookmark-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple-dark);
  font-weight: 700;
}
.bookmark-cat-header::-webkit-details-marker { display: none; }
.bookmark-cat-header::before {
  content: '▸';
  display: inline-block;
  width: 12px;
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s ease-out;
}
details[open] > .bookmark-cat-header::before { transform: rotate(90deg); }
.bookmark-cat-header:hover { background: var(--purple-soft); }
.bookmark-cat-count {
  margin-left: auto;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: 0;
}
.bookmark-cat ul {
  list-style: none;
  padding: 2px 0 2px 14px;  /* indent under summary, tight */
  margin: 0 0 4px;
}
.bookmark-row {
  padding: 5px 8px;
  border-radius: 5px;
  transition: background 0.1s ease-out;
}
.bookmark-row:hover { background: #fbfafd; }
.bookmark-row a {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--purple-dark);
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1.3;
}
.bookmark-row a:hover { text-decoration: underline; }
.bookmark-external {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}
.bookmark-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
  margin-left: 0;
  line-height: 1.3;
}

/* Mobile: bottom sheet style */
@media (max-width: 600px) {
  .bookmarks-flyout {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-width: 100%;
    max-height: 80vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(100%);
  }
  .bookmarks-flyout.open { transform: translateY(0); }
}

/* Phase 6.8: brand mark in topbar */
.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark { flex-shrink: 0; display: block; }
.brand-text h1 { margin: 0 0 2px; }
.brand-text .sub { margin: 0; }

/* Phase 6.8: login card branding */
.login-card { padding-top: 28px; }
.login-logo { text-align: center; margin: 0 0 18px; }
.login-logo img { display: inline-block; }
.login-tagline {
  margin: 8px 0 0;
  color: var(--purple);
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 500;
}

/* Phase 6.8: mobile refinements (≤ 600px viewports) */
@media (max-width: 600px) {
  .wrap { padding: 10px 12px 60px; }

  /* Topbar collapses to two rows: brand, then actions */
  .topbar { gap: 8px; margin-bottom: 8px; }
  .topbar > .brand { width: 100%; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .brand-mark { width: 36px !important; height: 48px !important; }
  .brand-text h1 { font-size: 1.15rem; line-height: 1.2; }
  .brand-text .sub { font-size: 0.82rem; }

  /* Admin header same treatment */
  .admin-header { flex-wrap: wrap; gap: 8px; }
  .admin-header > .brand { width: 100%; }
  .admin-header .nav { width: 100%; justify-content: flex-end; display:flex; gap: 8px; }

  /* Cards: tighter padding, full-width on phones */
  .card { padding: 14px; border-radius: 10px; }
  .card h2 { font-size: 1rem; }

  /* Volunteer layout: side menu stacks above content */
  .layout { display: block; }
  .menu { width: 100% !important; min-width: 0 !important; margin-bottom: 12px; }
  .menu-item { padding: 10px 12px; font-size: 0.94rem; }
  details.vol-menu-section .menu-item { margin-left: 18px; }

  /* Search results: stack action buttons rather than wrap into a wall */
  .search-result-actions { display: flex; flex-direction: column; gap: 6px; }

  /* Buttons big enough for fingers */
  button, .button { min-height: 40px; padding: 8px 14px; }
  button.secondary { min-height: 36px; }

  /* Outcome card columns stack */
  .outcome-options { grid-template-columns: 1fr !important; }

  /* Reduce visual weight of section dividers */
  .menu-section-wrap + .menu-section-wrap { margin-top: 4px; padding-top: 4px; }

  /* Profile dropdown takes more of the screen */
  .profile-dropdown { right: 0; left: auto; min-width: 220px; }

  /* Last-updated line less prominent */
  #lastUpdatedLine, .version-footer { font-size: 0.78rem; }
}

/* Phase 6.8: tighter still on very narrow phones */
@media (max-width: 380px) {
  .brand-mark { width: 32px !important; height: 42px !important; }
  .brand-text h1 { font-size: 1.05rem; }
  .brand-text .sub { display: none; }  /* save vertical real estate */
}

/* Phase 6.8.1: caller details two-column on the outcome card */
.outcome-caller-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.outcome-caller-row input {
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.92rem;
}
@media (max-width: 600px) {
  .outcome-caller-row { grid-template-columns: 1fr; }
}

/* Phase 6.8.1: data-table scroll container for narrow viewports */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}
.data-table {
  min-width: 720px;  /* keeps columns from crushing on mobile; container scrolls horizontally */
}
@media (max-width: 600px) {
  .table-scroll {
    border: 1px solid var(--border);
    background: linear-gradient(to right, transparent 95%, rgba(0,0,0,0.04));
  }
  .data-table { font-size: 0.84rem; }
  .data-table th, .data-table td { padding: 6px 8px; }
}

/* Phase 6.8.3: collapsible "Add a new ..." forms on admin panels.
   The expectation is most visits = managing existing records, not adding
   new ones, so these start collapsed to keep the list of existing rows
   above the fold. */
details.add-form-collapsible {
  margin: 0 0 14px;
}
details.add-form-collapsible > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 10px 14px;
  background: var(--purple-soft);
  border: 1px dashed var(--purple);
  border-radius: 8px;
  font-weight: 600;
  color: var(--purple-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
details.add-form-collapsible > summary::-webkit-details-marker { display: none; }
details.add-form-collapsible > summary::before {
  content: '+';
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  border: 1.5px solid var(--purple);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s ease-out;
}
details.add-form-collapsible[open] > summary::before {
  content: '−';
  transform: rotate(0);
}
details.add-form-collapsible > summary:hover {
  background: #e2dbf2;
}
.add-form-toggle-label { font-size: 0.95rem; }

/* Phase 6.9.2: collapsible Users / Recent activity blocks on the
   dashboard. Styled to read as add-form-equivalent cards with a clickable
   summary header. Default state in JS is closed. */
details.dash-collapsible {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 0 0 14px;
}
details.dash-collapsible > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--purple-dark);
}
details.dash-collapsible > summary::-webkit-details-marker { display: none; }
details.dash-collapsible > summary::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  transition: transform 0.15s ease-out;
}
details.dash-collapsible[open] > summary::before {
  transform: rotate(90deg);
}

/* Phase 6.10.5: inline lifecycle tags next to a group-title. Used to
   mark features being phased out or that have a manual-only status.
   The host element should sit inline-block, small, with a tiny pill
   shape to read as a subtle annotation rather than a loud warning. */
.lifecycle-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
  border: 1px solid transparent;
}
.lifecycle-tag.tag-deprecated {
  background: #fdf2f0;
  color: #7a3025;
  border-color: #f1c6bf;
}
.lifecycle-tag.tag-fallback {
  background: #fff8d9;
  color: #6a5500;
  border-color: #f0e090;
}
.lifecycle-tag.tag-manual {
  background: #eef1f5;
  color: #34414f;
  border-color: #c9d2dd;
}

/* Phase 7.0: experimental tag — distinct from deprecated/fallback/manual
   tags. Yellow-amber to signal "in development, use with awareness" rather
   than red/pink which suggests "going away soon". Slightly stronger
   contrast than fallback for visibility in the sidebar. */
.lifecycle-tag.tag-experimental {
  background: #fff4d1;
  color: #6a4a00;
  border-color: #e8c87a;
}

/* Make sidebar entries with a tag wrap nicely if the label runs long.
   The tag is small enough that it shouldn't blow the layout, but we
   want graceful handling on narrow viewports. */
/* Phase 7.16: "What's new" / "Release notes" — dark green accent pill. */
.lifecycle-tag.tag-new {
  background: #e6f4ec;
  color: #1a5c36;
  border-color: #8fcba8;
}

.menu-item .lifecycle-tag {
  font-size: 0.6rem;
  padding: 1px 6px;
  margin-left: 6px;
}

/* Phase 7.1: brand styling for Leaflet markers, clusters, and popups.
   Overrides the default MarkerCluster.Default.css colours which are
   green/yellow/red — replaces with the FMA UK purple palette. */

/* Custom pin markers — DivIcon container needs no background since the
   SVG inside has its own fill. Drop any default Leaflet styling. */
.fmauk-marker {
  background: none !important;
  border: none !important;
}

/* Cluster bubbles. Three tiers by count: small (<10), medium (<50),
   large (50+). All use the brand purple, scaling slightly with count
   so the visual weight tracks group density. */
.fmauk-cluster {
  background: none;
  border: none;
}
.fmauk-cluster > div {
  width: 36px;
  height: 36px;
  margin-left: 2px;
  margin-top: 2px;
  text-align: center;
  border-radius: 50%;
  font-family: inherit;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85);
}
.fmauk-cluster > div > span {
  font-size: 0.85rem;
  line-height: 1;
}
.fmauk-cluster-small > div {
  background: #6b54c0;  /* lighter purple */
}
.fmauk-cluster-medium > div {
  background: #402d89;  /* brand purple */
  width: 40px; height: 40px;
}
.fmauk-cluster-large > div {
  background: #2e2069;  /* deep purple */
  width: 44px; height: 44px;
}
.fmauk-cluster-large > div > span {
  font-size: 0.95rem;
}

/* Popup styling: nicer typography, brand purple title, label+value lines.
   maxWidth on the popup is set per-popup; here we tune spacing and fonts. */
.fmauk-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(46, 32, 105, 0.22);
  padding: 0;
}
.fmauk-popup-wrap .leaflet-popup-content {
  margin: 12px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
}
.fmauk-popup-wrap .leaflet-popup-tip {
  background: #fff;
}
.fmauk-popup-title {
  font-weight: 700;
  color: #2e2069;
  font-size: 1rem;
  margin-bottom: 6px;
  border-bottom: 1px solid #ede9f8;
  padding-bottom: 4px;
}
.fmauk-popup-friendly {
  font-weight: 400;
  color: #6b6478;
  font-size: 0.85rem;
}
.fmauk-popup-line {
  margin: 3px 0;
  color: #2a2533;
}
.fmauk-popup-label {
  display: inline-block;
  min-width: 70px;
  font-size: 0.78rem;
  color: #7a7287;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  margin-right: 4px;
}
.fmauk-popup-tag {
  display: inline-block;
  background: #ede9f8;
  color: #402d89;
  border: 1px solid #d6cdef;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 4px 0 2px;
}
.fmauk-popup-flag {
  margin-top: 6px;
  padding: 4px 8px;
  background: #fdf2f0;
  color: #7a3025;
  border: 1px solid #f1c6bf;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* Phase 7.2: flagged-cluster ring, region swatch chips, legend layout,
   and the preserve-newlines utility class. */

/* Cluster with at least one flagged child gets a thick amber ring drawn
   via box-shadow so it stays sharp without changing the cluster shape. */
.fmauk-cluster-has-flagged > div {
  box-shadow: 0 0 0 3px #f39c12, 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}

/* Override the 7.1 hard-coded background — width/height/colour now come
   inline on the inner div so the cluster JS controls them. Keep the
   shared layout/typography here. */
.fmauk-cluster > div {
  margin-left: 0;
  margin-top: 0;
}
.fmauk-cluster-small > div { background: inherit; }
.fmauk-cluster-medium > div { background: inherit; }
.fmauk-cluster-large > div { background: inherit; }

/* Small inline region colour swatch — used in popups and the legend. */
.fmauk-region-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Region legend grid: chips wrap, equal column rhythm. */
.fmauk-region-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
}
.fmauk-region-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  color: #2a2533;
}

/* Phase 7.2: line-break preservation for notes-shaped text. Use this
   class on any container rendering a free-text notes field so newlines
   in the source data render as paragraph breaks rather than collapsing
   into spaces. */
.preserve-newlines {
  white-space: pre-wrap;
}

/* Phase 7.3: filter row for the map view. Horizontal flex layout that
   wraps on narrow viewports so each control gets a sensible row. */
.map-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}
.map-filter {
  display: flex;
  flex-direction: column;
  min-width: 140px;
}
.map-filter select,
.map-filter input[type="text"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.map-filter input[type="text"] {
  min-width: 200px;
}

/* Phase 7.4: mobile pass for the map view. Filter row stacks, map
   shrinks, popup width sized for narrow viewports. The breakpoint
   matches the rest of the tool. */
@media (max-width: 720px) {
  .map-filter-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .map-filter {
    min-width: 0;
    width: 100%;
  }
  .map-filter select,
  .map-filter input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    min-height: 38px;     /* easier tap target */
  }
  /* Map height tighter on phones so the controls stay reachable */
  #leafletMap, #volLeafletMap {
    height: 420px !important;
  }
  /* Popup max-width sizes down to fit narrow viewports */
  .fmauk-popup-wrap .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 60px);
  }
  .fmauk-popup-title {
    font-size: 0.95rem;
  }
  /* Legend chips wrap more naturally on narrow */
  .fmauk-region-legend {
    gap: 6px 10px;
  }
  .fmauk-region-chip {
    font-size: 0.82rem;
  }
  /* Reset button full-width on its own line */
  .map-filter button.secondary {
    width: 100%;
    min-height: 38px;
  }
}

/* Phase 7.4: comfortable tap targets for Leaflet's zoom controls on
   touch devices — Leaflet's defaults are 30px which is fiddly. */
@media (pointer: coarse) {
  .leaflet-touch .leaflet-bar a {
    width: 36px !important;
    height: 36px !important;
    line-height: 34px !important;
    font-size: 22px !important;
  }
}

/* Phase 7.5: mailbox monitor status pills and row tints. Extends the
   .lifecycle-tag pattern with six operational statuses matching the
   PowerShell Monitor-Mailboxes.ps1 output. Row tints are deliberately
   subtle to coexist with the brand's softer aesthetic — saturated
   row colours in the standalone report don't carry across. */
.lifecycle-tag.tag-status-alert {
  background: #fdf2f0;
  color: #7a3025;
  border-color: #f1c6bf;
}
.lifecycle-tag.tag-status-caution {
  background: #fff8d9;
  color: #6a5500;
  border-color: #f0e090;
}
.lifecycle-tag.tag-status-growing {
  background: #fff0e0;
  color: #7a4500;
  border-color: #f0c490;
}
.lifecycle-tag.tag-status-vacancy {
  background: var(--purple-soft);
  color: var(--purple-dark);
  border-color: #c5b9e0;
}
.lifecycle-tag.tag-status-routed {
  background: #e8f0fa;
  color: #1f4a7a;
  border-color: #b7cce6;
}
.lifecycle-tag.tag-status-ok {
  background: #e8f5ec;
  color: var(--ok);
  border-color: #b9d9c4;
}

/* Row tint per status — pairs with the pill above. OK stays untinted. */
.row-status-alert    { background: #fdf6f5; }
.row-status-caution  { background: #fffcea; }
.row-status-growing  { background: #fff7ee; }
.row-status-vacancy  { background: var(--purple-soft); }
.row-status-routed   { background: #f3f7fc; }

/* Hover stays a touch darker than the tint so the row still reacts */
.row-status-alert:hover    { background: #fbe9e7; }
.row-status-caution:hover  { background: #fff5cc; }
.row-status-growing:hover  { background: #ffeed9; }
.row-status-vacancy:hover  { background: #e3dcf3; }
.row-status-routed:hover   { background: #e9f0f9; }

/* Sticky thead for tables that benefit from it (mailbox monitor mainly).
   Applied via a class so other data-tables aren't affected unexpectedly. */
.mailbox-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  box-shadow: 0 1px 0 var(--border);
}

/* Sortable column header affordance */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover {
  background: var(--purple-soft);
}
.data-table th.num,
.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Last-emails list inside the mailbox detail row */
.mailbox-last-emails {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
}
.mailbox-last-emails li {
  margin: 1px 0;
}

/* Phase 7.5.1 / 7.5.2: two-row layout per coordinator.
   Each coordinator is its own <tbody class="row-status-X mailbox-coord">
   containing a summary <tr> + detail <tr>. The status tint applies to
   both rows via the tbody. Dividers between coordinators use the
   `tbody + tbody` selector so they only appear between groups, never
   between a summary and its own detail row.
   7.5.2: additional info moved into the detail row as an inline strip
   between the status reason and the emails list, so emails can flow
   across the full width of the detail row. */
.mailbox-table {
  min-width: 720px;
}

/* Strong divider between coordinators (between tbodies), no divider
   between a coordinator's summary row and its own detail row. */
.mailbox-table tbody.mailbox-coord + tbody.mailbox-coord {
  border-top: 2px solid var(--border);
}

/* Summary row: compact, no bottom border (it flows into the detail row) */
.mailbox-table .mailbox-row-summary td {
  border-bottom: none;
  vertical-align: top;
  padding-top: 10px;
  padding-bottom: 6px;
}

/* Detail row: visually subordinate — smaller font, top padding tighter
   to the summary above. */
.mailbox-table .mailbox-row-detail td {
  border-bottom: none;
  padding-top: 0;
  padding-bottom: 12px;
  font-size: 0.86rem;
}

/* Small label above the emails list */
.mailbox-detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Status reason banner spans the full detail row */
.mailbox-status-reason {
  font-size: 0.86rem;
  color: var(--text);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.55);
  border-left: 3px solid var(--border);
  border-radius: 4px;
}

/* Phase 7.5.2: inline additional-info strip. Horizontal flex with a thin
   middle-dot between items so it reads as a single metadata line. Sits
   between the status reason and the Last 20 emails block. */
.mailbox-extras-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 0.84rem;
  margin-bottom: 10px;
  color: var(--text);
}
.mailbox-extras-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 8px;
  border-right: 1px solid var(--border);
}
.mailbox-extras-item:last-child {
  border-right: none;
}
.mailbox-extras-item:first-child {
  padding-left: 0;
}
.mailbox-extras-label {
  color: var(--muted);
  font-weight: 600;
}

/* Phase 7.5.2: clickable tally chips for status filtering. Reuses the
   existing .lifecycle-tag pill style but as a <button>, with hover
   affordance and a clear active state. When a filter is active the
   non-active chips dim so the selection is unambiguous. */
.mailbox-filter-chip {
  font: inherit;
  cursor: pointer;
  margin: 0 0 0 6px;
  transition: opacity 120ms ease;
}
.mailbox-filter-chip:first-child {
  margin-left: 0;
}
.mailbox-filter-chip:hover {
  filter: brightness(0.95);
}
.mailbox-filter-chip.active {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.mailbox-filter-chips.has-filter-active .mailbox-filter-chip:not(.active) {
  opacity: 0.35;
}
.mailbox-filter-chips.has-filter-active .mailbox-filter-chip:not(.active):hover {
  opacity: 0.7;
}

/* Phase 7.5.5: login authorised-users notice. Plain panel between the
   intro copy and the form. Neutral colours so it informs without
   feeling like a warning. */
.login-notice {
  background: var(--purple-soft);
  color: var(--text);
  border: 1px solid #d6cdef;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin: 10px 0 16px;
  line-height: 1.4;
}

/* Phase 7.5.7: notes block inside Leaflet popups. Tighter line-height
   than the popup default since multi-line notes are common, with the
   .preserve-newlines class on the same element keeping newlines intact. */
.fmauk-popup-notes {
  margin: 2px 0 6px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 4px;
  padding: 4px 8px;
  max-height: 140px;
  overflow-y: auto;
}

/* Phase 7.6: rendered help markdown. Comfortable reading column with
   tighter line-height for headings and adequate spacing between
   paragraphs and lists. */
.help-rendered { line-height: 1.55; color: var(--text); max-width: 760px; }
.help-rendered h1 { font-size: 1.45rem; margin: 16px 0 12px; color: var(--purple); }
.help-rendered h2 { font-size: 1.18rem; margin: 22px 0 8px; color: var(--purple-dark); }
.help-rendered h3 { font-size: 1.02rem; margin: 18px 0 6px; color: var(--text); }
.help-rendered p  { margin: 8px 0; }
.help-rendered ul, .help-rendered ol { margin: 8px 0 8px 26px; padding: 0; }
.help-rendered li { margin: 4px 0; }
.help-rendered code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: Menlo, Consolas, monospace;
}
.help-rendered pre {
  background: #2a2533;
  color: #f1ecf8;
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 10px 0;
}
.help-rendered pre code { background: transparent; padding: 0; color: inherit; }
.help-rendered blockquote {
  border-left: 3px solid var(--purple);
  background: var(--purple-soft);
  margin: 10px 0;
  padding: 8px 14px;
  color: var(--text);
}
.help-rendered hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.help-rendered a {
  color: var(--purple);
  text-decoration: underline;
}

/* Phase 7.7: embedded map below postcode search results. Collapsed by
   default; expands inline below the result list. Mobile reduces the
   height. */
.search-results-map summary {
  cursor: pointer;
  padding: 6px 0;
  font-weight: 600;
  color: var(--purple);
  user-select: none;
}
.search-results-map summary:hover { color: var(--purple-dark); }
.search-results-map-wrap {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--purple-soft);
  border-radius: 6px;
}
#searchResultsMapEl {
  height: 320px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #e8eaef;
}
.embed-pin-icon { background: transparent; border: none; }

@media (max-width: 720px) {
  #searchResultsMapEl { height: 240px; }
}

/* Phase 7.10: Top 10 postcodes column layout. 3 columns at typical
   widths, 2 on tablets, 1 on phones. break-inside avoids breaking a
   single list item across columns mid-line. */
.dash-top-postcodes {
  columns: 3;
  column-gap: 24px;
}
.dash-top-postcodes li {
  break-inside: avoid;
  margin-bottom: 4px;
}
@media (max-width: 900px) {
  .dash-top-postcodes { columns: 2; }
}
@media (max-width: 560px) {
  .dash-top-postcodes { columns: 1; }
}

/* ── Phase 7.19.1 ─────────────────────────────────────────────────────────── */

/* Global search bar */
.global-search-bar { background:var(--bg); border-bottom:1px solid var(--border); padding:7px 20px; }
.global-search-inner { display:flex; align-items:center; gap:8px; max-width:580px; }
.global-search-label { font-size:0.83rem; color:var(--muted); white-space:nowrap; }
.global-search-input { flex:1; padding:5px 9px; font-size:0.9rem; }
.global-search-btn { padding:5px 13px; font-size:0.9rem; }

/* Map tab panel: own stacking context so Leaflet z-index values don't
   bleed outside and tile panes can't overlap content in other columns. */
#groupTabMap { isolation: isolate; }

/* Search/Map tab bar */
.group-tab-bar { display:flex; gap:2px; border-bottom:2px solid var(--border); margin-bottom:14px; }
.group-tab { background:none; border:none; border-bottom:3px solid transparent; margin-bottom:-2px;
             padding:7px 18px; font-size:0.9rem; font-weight:600; color:var(--muted); cursor:pointer; border-radius:0; }
.group-tab:hover { color:var(--purple); background:rgba(92,61,140,0.05); }
.group-tab-active { color:var(--purple) !important; border-bottom-color:var(--purple) !important; }

/* Results header row with map toggle */
.results-header-row { display:flex; align-items:flex-end; justify-content:space-between; gap:8px; margin-bottom:0; }

/* Small buttons */
.btn-sm { padding:4px 10px !important; font-size:0.82rem !important; }

/* Email modal */
.modal-email { max-width:700px; width:95vw; max-height:90vh; overflow-y:auto; }
.modal-email-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.modal-close-btn { background:none; border:none; font-size:1.4rem; line-height:1; cursor:pointer;
                   color:var(--muted); padding:2px 6px; border-radius:4px; }
.modal-close-btn:hover { background:rgba(0,0,0,0.06); }

/* Flag search results */
.flag-search-row { display:flex; align-items:center; justify-content:space-between; gap:10px;
                   padding:8px 10px; border:1px solid var(--border); border-radius:6px; margin-bottom:6px; }
.flag-search-info { display:flex; flex-direction:column; gap:2px; flex:1; min-width:0; }
.flag-search-name { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.flag-search-meta { font-size:0.82rem; }

/* Nested menu section (category inside Template Responses) */
.vol-menu-section-nested { margin-left:6px; }
.vol-menu-section-nested .menu-item { margin-left:20px; }
summary.vol-menu-cat-nested { padding-left:20px; font-size:0.82rem; color:var(--muted); }

/* Flag quick link row */
.flag-anywhere-row { margin-top:14px; padding-top:10px; border-top:1px solid var(--border); }

@media (max-width:680px) {
  .global-search-label { display:none; }
  .global-search-inner { max-width:100%; }
  .modal-email { width:100vw; max-height:100vh; border-radius:0; }
}

/* Phase 7.20: flag comment trail */
.flag-trail {
  margin-top: 10px;
  border-left: 3px solid var(--border);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flag-trail-row {
  font-size: 0.87rem;
  line-height: 1.4;
}
.flag-trail-action {
  font-weight: 600;
  margin-right: 6px;
}
.flag-trail-meta {
  color: var(--muted);
  font-size: 0.83rem;
}
.flag-trail-body {
  margin-top: 2px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
