/* Reserve vertical scrollbar space so the top navigation and map controls do not shift between pages. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
}
body {
  min-height: 100vh;
}

:root {
  --bg:#0b1118; --panel:#17212b; --panel2:#202c36; --text:#eef3f7; --muted:#aab7c4; --gold:#f3c969; --line:#314151; --red:#a43737;
}
* { box-sizing: border-box; }
body { margin:0; font-family: Arial, Helvetica, sans-serif; background:linear-gradient(180deg,var(--bg),#101820 60%,#0b1118); color:var(--text); }
a { color: var(--gold); }
.topbar { display:flex; justify-content:space-between; align-items:stretch; gap:1rem; padding:.9rem 1.15rem; background:rgba(8,12,16,.96); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:5000; box-shadow:0 10px 28px rgba(0,0,0,.28); }
.topbar-brand-wrap { display:flex; align-items:center; gap:.8rem; min-width:0; flex:1 1 460px; }
.topbar-logo { height:66px!important; width:auto!important; max-width:255px; object-fit:contain; display:block; flex:0 0 auto; background:linear-gradient(180deg, rgba(15,23,42,.98), rgba(8,13,24,.98)); border:0; border-radius:.55rem; padding:.18rem .34rem; box-shadow:none; }
.topbar-brand { min-width:250px; display:flex; flex-direction:column; justify-content:center; min-width:0; }
h1 { margin:.04rem 0 0; font-size:1.48rem; letter-spacing:.015em; line-height:1.02; }
.eyebrow { color:var(--gold); text-transform:uppercase; letter-spacing:.085em; font-size:.84rem; font-weight:900; line-height:1; }
.topbar-subtitle { color:var(--muted); font-size:.98rem; margin-top:.12rem; line-height:1.05; }
.prism-letter { color:var(--gold); font-weight:950; }
.topbar-agency { color:rgba(247,249,252,.82); font-size:.76rem; margin-top:.08rem; font-weight:750; }
.nav-groups { display:flex; gap:.65rem; flex-wrap:wrap; justify-content:flex-end; align-items:stretch; }
.nav-group { display:flex; gap:.35rem; align-items:center; padding:.32rem; border:1px solid rgba(255,255,255,.09); background:rgba(255,255,255,.035); border-radius:1rem; }
.nav-label { color:var(--muted); font-size:.68rem; font-weight:900; text-transform:uppercase; letter-spacing:.08em; padding:0 .35rem; }
nav a, .nav-group a { text-decoration:none; color:var(--text); padding:.48rem .68rem; border:1px solid var(--line); border-radius:.75rem; background:rgba(255,255,255,.035); font-weight:800; font-size:.86rem; }
nav a:hover, .nav-group a:hover { border-color:rgba(243,201,105,.65); background:rgba(243,201,105,.12); }
.nav-primary { background:var(--gold)!important; color:#17120a!important; border-color:var(--gold)!important; }
.container { max-width:1220px; margin:0 auto; padding:1.25rem; }
.card { background:linear-gradient(180deg,rgba(24,32,40,.98),rgba(19,27,35,.98)); border:1px solid var(--line); border-radius:1rem; padding:1.25rem; margin-bottom:1rem; box-shadow:0 12px 30px rgba(0,0,0,.22); }
.card h2, .card h3 { margin-top:0; }
.hero p { color:var(--muted); max-width:850px; }
.grid { display:grid; gap:1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display:flex; flex-direction:column; gap:.35rem; margin-bottom:.8rem; color:var(--muted); font-weight:700; }
input, select, textarea { width:100%; background:var(--panel2); color:var(--text); border:1px solid var(--line); border-radius:.65rem; padding:.65rem; font-size:1rem; }
input:focus, select:focus, textarea:focus { outline:2px solid rgba(243,201,105,.35); border-color:rgba(243,201,105,.7); }
.actions { display:flex; gap:.75rem; align-items:center; flex-wrap:wrap; margin-top:1rem; }
.button, button.button { display:inline-block; border:1px solid var(--line); background:var(--panel2); color:var(--text); padding:.7rem 1rem; border-radius:.75rem; text-decoration:none; cursor:pointer; font-weight:800; touch-action:manipulation; font-family:inherit; font-size:1rem; line-height:1.2; }
.button:hover, button.button:hover { border-color:rgba(243,201,105,.7); background:#273542; }
.button.primary { background:var(--gold); color:#17120a; border-color:var(--gold); }
.button.danger, .danger-button { background:#7f1d1d; color:#fff; border-color:#b91c1c; }
.button.subtle { background:rgba(255,255,255,.04); }
.subareas { display:grid; grid-template-columns: repeat(8, 1fr); gap:.55rem; margin:1rem 0; }
.subarea { margin:0; display:block; }
.subarea input { display:none; }
.subarea span { display:block; text-align:center; padding:.8rem 0; background:var(--panel2); border:1px solid var(--line); border-radius:.75rem; color:var(--text); font-weight:900; }
.subarea input:checked + span { background:var(--gold); color:#17120a; border-color:var(--gold); box-shadow:0 0 0 3px rgba(243,201,105,.15); }
.meta-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:.75rem; background:var(--panel2); padding:1rem; border-radius:.85rem; margin-bottom:1rem; }
.message-preview { white-space:pre-wrap; background:#0b0f13; border:1px solid var(--line); border-radius:.8rem; padding:1rem; line-height:1.45; max-height:55vh; overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:.95rem; }
th, td { border-bottom:1px solid var(--line); padding:.65rem; text-align:left; vertical-align:top; }
th { color:var(--gold); font-size:.82rem; text-transform:uppercase; letter-spacing:.05em; }
tr:hover td { background:rgba(255,255,255,.025); }
.flash { background:#24311d; border:1px solid #4a6b32; border-radius:.85rem; padding:.6rem 1rem; margin-bottom:1rem; }
.inline-form { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 180px; }
.button.small { padding: 0.38rem 0.6rem; font-size: 0.85rem; }
.mini-form { display: inline-flex; gap: 0.35rem; align-items: center; margin-left: 0.35rem; }
.mini-form input { width: 70px; padding: 0.35rem; }
.nowrap { white-space: nowrap; }
.wide-table { overflow-x: auto; }
tr.inactive { opacity: 0.62; }
.full { grid-column: 1 / -1; }
hr { border: 0; border-top: 1px solid rgba(255,255,255,0.12); margin: 1rem 0; }
textarea { width: 100%; border-radius: 12px; border: 1px solid rgba(255,255,255,0.14); background: rgba(0,0,0,0.25); color: #f5f7fb; padding: 0.75rem; }
.stacked-form { display:grid; gap:0.9rem; }
.stacked-form label { display:grid; gap:0.35rem; font-weight:700; }
.warning-box { border:1px solid rgba(245, 158, 11, .55); background:rgba(245, 158, 11, .12); border-radius:12px; padding:.75rem; }
.match-field { padding:.4rem 0; border-bottom:1px solid rgba(255,255,255,.08); }
.match-field:last-child { border-bottom:0; }
.match-field span { white-space:pre-wrap; }
.flash-inline { border: 1px solid rgba(243,201,105,.45); background: rgba(243,201,105,.12); color: #fff7df; border-radius: 12px; padding: .7rem .85rem; margin: .4rem 0 .8rem; }
.secondary-actions { margin-top: .65rem; }
.login-card { max-width: 520px; margin: 32px auto; }
.badge { display:inline-block; border:1px solid rgba(243,201,105,.55); border-radius:999px; padding:2px 8px; margin:2px; color:#f3c969; background:rgba(243,201,105,.12); font-size:.8rem; }
.global-training-banner { display:none; position: sticky; top: 0; z-index: 9; width: 100%; background: #7f1d1d; color: #fff7ed; border-bottom: 1px solid rgba(255,255,255,.18); text-align: center; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: .45rem .75rem; box-shadow: 0 8px 20px rgba(0,0,0,.25); line-height:1.25; }
.global-training-banner.active { display:block; }
.global-training-banner .lock-detail { color:#fde68a; }
.login-warning { background: #7f1d1d; border: 1px solid #fca5a5; color: #fff7ed; border-radius: .85rem; padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 900; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.panel-lite { border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); border-radius: 14px; padding: 1rem; margin: 1rem 0; }
.panel-lite h3 { margin-top: 0; color: var(--gold); }
.muted { color: var(--muted); }
.page-header { display:flex; justify-content:space-between; align-items:flex-end; gap:1rem; margin-bottom:1rem; }
.page-header h2 { margin:0; }
.page-kicker { color:var(--gold); font-size:.75rem; text-transform:uppercase; letter-spacing:.08em; font-weight:900; }
.dashboard-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; margin:1rem 0; }
.dashboard-card { border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.04); border-radius:1rem; padding:1rem; min-height:185px; display:flex; flex-direction:column; }
.dashboard-card h3 { margin:0 0 .45rem; color:var(--gold); }
.dashboard-card p { color:var(--muted); margin:.2rem 0 1rem; line-height:1.35; }
.dashboard-card .actions { margin-top:auto; }
.workflow-steps { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; margin:.9rem 0 1.1rem; }
.step-pill { border:1px solid rgba(243,201,105,.28); background:rgba(243,201,105,.08); border-radius:.85rem; padding:.65rem .75rem; color:var(--muted); }
.step-pill strong { display:block; color:var(--gold); font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; margin-bottom:.15rem; }
.section-title { display:flex; justify-content:space-between; align-items:center; gap:1rem; border-bottom:1px solid rgba(255,255,255,.1); padding-bottom:.55rem; margin:1.1rem 0 .8rem; }
.section-title h3 { margin:0; }
.table-toolbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-bottom:.75rem; }
@media (max-width: 1050px) { .dashboard-grid { grid-template-columns:1fr; } .workflow-steps { grid-template-columns:repeat(2,minmax(0,1fr)); } .nav-groups { justify-content:flex-start; } }
@media (max-width: 900px) { .topbar { flex-direction:column; gap:.65rem; } .topbar-brand-wrap { min-width:0; flex:1 1 auto; } .topbar-logo { height:54px!important; width:auto!important; max-width:215px; } }
@media (max-width: 800px) { .grid.two, .grid.three, .meta-grid { grid-template-columns:1fr; } .subareas { grid-template-columns:repeat(4,1fr); } table { font-size:.8rem; } .workflow-steps { grid-template-columns:1fr; } }

/* v1.0.7 popup menu navigation */
.nav-menus { display:flex; gap:.55rem; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.menu-home,
.menu-primary,
.menu-link,
.nav-icon-link,
.nav-menu > summary { list-style:none; text-decoration:none; color:var(--text); padding:.55rem .78rem; border:1px solid var(--line); border-radius:.8rem; background:rgba(255,255,255,.04); font-weight:900; font-size:.88rem; cursor:pointer; user-select:none; }
.nav-menu > summary::-webkit-details-marker { display:none; }
.nav-menu > summary::after { content:' ▾'; color:var(--gold); font-size:.78rem; }
.nav-menu[open] > summary { border-color:rgba(243,201,105,.75); background:rgba(243,201,105,.14); }
.menu-primary { background:var(--gold)!important; color:#17120a!important; border-color:var(--gold)!important; }
.menu-home:hover,
.menu-primary:hover,
.menu-link:hover,
.nav-menu > summary:hover,
.nav-icon-link:hover { border-color:rgba(243,201,105,.65); background:rgba(243,201,105,.12); }
.nav-menu { position:relative; }
.menu-panel { position:absolute; top:calc(100% + .45rem); right:0; min-width:220px; display:flex; flex-direction:column; gap:.25rem; padding:.5rem; border:1px solid rgba(255,255,255,.16); border-radius:1rem; background:rgba(15,22,30,.98); box-shadow:0 18px 42px rgba(0,0,0,.38); z-index:5100; }
.menu-panel-right { right:0; }
.menu-panel a { display:block; color:var(--text); text-decoration:none; border:1px solid transparent; border-radius:.7rem; padding:.65rem .75rem; font-weight:800; white-space:nowrap; }
.menu-panel a:hover { background:rgba(243,201,105,.13); border-color:rgba(243,201,105,.45); }
@media (max-width:1050px){ .nav-menus { justify-content:flex-start; } }

/* v1.0.10 title home link */
.title-home { color: inherit; text-decoration: none; cursor: pointer; }
.title-home:hover { text-decoration: none; filter: brightness(1.15); }
.topbar .title-home { display: inline-block; }
.app-topbar h1 .title-home { color: inherit; }

.login-submit { font-size: 1.1rem; padding: 0.8rem 1.15rem; }

.snapshot-option {
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}
.snapshot-option input {
  margin-right: 6px;
}


/* RC4 nav icon buttons: compact Data and System dropdowns */
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.nav-icon-menu > summary { width:2.6rem; min-width:2.6rem; height:2.6rem; padding:0!important; display:inline-flex!important; align-items:center!important; justify-content:center!important; line-height:1!important; box-sizing:border-box; }
.nav-icon-menu > summary::after { content:''!important; display:none!important; }
.nav-icon-link { width:2.6rem; min-width:2.6rem; height:2.6rem; padding:0!important; display:inline-flex!important; align-items:center!important; justify-content:center!important; line-height:1!important; box-sizing:border-box; }
.nav-icon-link:hover .nav-icon-svg { color:var(--gold); opacity:1; }
.nav-icon-svg { width:1.18rem; height:1.18rem; display:block; fill:currentColor; color:var(--text); opacity:.95; }
.nav-icon-menu[open] .nav-icon-svg, .nav-icon-menu > summary:hover .nav-icon-svg { color:var(--gold); opacity:1; }

/* RC4 navbar alignment pass: keep all top buttons consistent and pin system/data icons right. */
.nav-menus {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
}
.menu-home,
.menu-primary,
.menu-link,
.map-link,
.nav-menu > summary,
.map-menu > summary {
  min-height: 2.6rem;
  height: 2.6rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}
.nav-menus .nav-data-link {
  order: 90;
  margin-left: 0;
}
.nav-menus .nav-system-menu {
  order: 100;
  margin-left: 0;
}
.nav-menus:not(:has(.nav-data-link)) .nav-system-menu {
  margin-left: 0;
}
.nav-icon-link,
.nav-icon-menu > summary {
  width: 2.6rem !important;
  min-width: 2.6rem !important;
  max-width: 2.6rem !important;
  height: 2.6rem !important;
  min-height: 2.6rem !important;
  max-height: 2.6rem !important;
  padding: 0 !important;
  border-radius: .8rem !important;
}
.nav-icon-menu > summary::after,
.map-menu.nav-icon-menu > summary::after {
  content: '' !important;
  display: none !important;
}

.nav-cone-svg { width:1.25rem; height:1.25rem; }
.nav-log-svg { width:1.16rem; height:1.16rem; }

/* RC4 icon update: Home/Main Map and TRC/PRC have distinct icons. */
.nav-home-link:hover .nav-icon-svg,
.nav-relocation-link:hover .nav-icon-svg { color: var(--gold); opacity: 1; }
.nav-people-roof-svg { width: 1.22rem; height: 1.22rem; }
.nav-home-svg { width: 1.2rem; height: 1.2rem; }


/* RC4 create-message icon pass: keep primary action left-most and add a file-plus icon. */
.nav-create-link {
  order: -20;
  gap: .45rem;
  padding-left: .8rem !important;
  padding-right: .9rem !important;
}
.nav-create-link .nav-create-svg {
  width: 1.16rem;
  height: 1.16rem;
  display: block;
  fill: currentColor;
  flex: 0 0 auto;
}
.nav-create-link span {
  display: inline-block;
}
.nav-home-link {
  order: -10;
}

/* RC4 Create Message size sync: match the main map page on all subpages. */
.nav-menus .nav-create-link,
.compact-nav .nav-create-link {
  order: -20;
  min-height: 2.6rem !important;
  height: 2.6rem !important;
  max-height: 2.6rem !important;
  padding: .62rem 1rem .62rem .9rem !important;
  gap: .45rem !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  font-size: .88rem !important;
  font-weight: 900 !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  border: 1px solid #314151 !important;
  border-radius: .8rem !important;
  background: var(--gold) !important;
  color: #17120a !important;
}
.nav-menus .nav-create-link .nav-create-svg,
.compact-nav .nav-create-link .nav-create-svg {
  width: 1.16rem !important;
  height: 1.16rem !important;
  display: block !important;
  fill: currentColor !important;
  flex: 0 0 auto !important;
}
.nav-menus .nav-create-link span,
.compact-nav .nav-create-link span {
  display: inline-block !important;
  line-height: 1 !important;
}



/* RC4 final nav size sync: subpage navbar matches main map navbar exactly. */
.nav-menus .nav-create-link {
  min-height: 2.6rem !important;
  height: 2.6rem !important;
  max-height: 2.6rem !important;
  padding: .62rem 1rem .62rem .9rem !important;
  gap: .45rem !important;
  font-size: .88rem !important;
  line-height: 1 !important;
  border-radius: .8rem !important;
}
.nav-menus .nav-create-link .nav-create-svg {
  width: 1.13rem !important;
  height: 1.13rem !important;
}
.nav-menus .nav-icon-link,
.nav-menus .nav-icon-menu > summary {
  width: 2.6rem !important;
  min-width: 2.6rem !important;
  max-width: 2.6rem !important;
  height: 2.6rem !important;
  min-height: 2.6rem !important;
  max-height: 2.6rem !important;
}


/* RC4 nav size lock fallback: keep Create Message identical across map and subpages. */
.nav-menus.compact-nav { align-items:center !important; gap:.55rem !important; }
.nav-menus.compact-nav .nav-create-link,
.nav-create-link {
  min-height:2.66rem !important;
  height:2.66rem !important;
  max-height:2.66rem !important;
  padding:.66rem 1.06rem .66rem .94rem !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:.48rem !important;
  box-sizing:border-box !important;
  line-height:1 !important;
  font-size:.9rem !important;
  font-weight:900 !important;
  letter-spacing:0 !important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif !important;
  white-space:nowrap !important;
  border-radius:.8rem !important;
  background:var(--gold) !important;
  color:#17120a !important;
  border-color:var(--gold) !important;
}
.nav-menus.compact-nav .nav-create-link .nav-create-svg,
.nav-create-link .nav-create-svg {
  width:1.16rem !important;
  height:1.16rem !important;
  min-width:1.16rem !important;
  display:block !important;
  fill:currentColor !important;
  flex:0 0 auto !important;
}
.nav-menus.compact-nav .nav-create-link span,
.nav-create-link span {
  display:inline-block !important;
  line-height:1 !important;
  font-weight:900 !important;
}


/* RC4 topbar height sync: keep subpage header from shrinking before the map page does. */
@media (min-width: 901px) {
  .app-topbar.topbar {
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 1rem !important;
    padding: .9rem 1.15rem !important;
  }
  .app-topbar .topbar-logo {
    height: 66px !important;
    max-width: 255px !important;
  }
  .app-topbar .nav-menus {
    align-self: stretch !important;
  }
}
@media (max-width: 900px) {
  .app-topbar.topbar {
    flex-direction: column !important;
    gap: .65rem !important;
  }
  .app-topbar .topbar-logo {
    height: 54px !important;
    max-width: 215px !important;
  }
}


/* RC4 viewport gutter sync: reserve the same scrollbar space on every page so the top navbar does not shift between the map and subpages. */
html {
  overflow-y: scroll !important;
  scrollbar-gutter: stable both-edges !important;
}
body {
  min-height: 100vh;
}


