:root {
  --navy: #1f3a5f;
  --navy-700: #16304f;
  --teal: #0f766e;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #dfe4ec;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--navy) 0%, var(--teal) 100%); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 36px 32px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login-card label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.login-card .err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 10px 0 0; }
.login-card .foot { margin-top: 18px; font-size: 12px; color: var(--muted); }
.brand-mark { width: 44px; height: 44px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 16px; font-size: 18px; overflow: hidden; }
.brand-mark.has-img { width: auto; height: auto; background: transparent; border-radius: 0; display: block; }
.brand-mark.has-img img { display: block; max-height: 140px; max-width: 260px; width: auto; height: auto; object-fit: contain; }
.brand-mark.small.has-img img { max-height: 42px; max-width: 160px; background: #fff; padding: 3px 6px; border-radius: 6px; }
.brand-mark.small { width: 34px; height: 34px; margin: 0; font-size: 14px; background: rgba(255,255,255,.16); border-radius: 8px; }

/* ---------- Controls ---------- */
.input, input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
textarea { min-height: 110px; resize: vertical; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: 14px; }
.btn:hover { background: #f8fafc; }
a.btn { text-decoration: none; color: inherit; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-700); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .6; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; user-select: none; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eef2f7; color: #334155; font-size: 12px; font-weight: 600; }
.tag.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #e6f4f2; color: var(--teal); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.high { background: #dcfce7; color: var(--ok); }
.badge.medium { background: #fef3c7; color: var(--warn); }
.badge.low { background: #e2e8f0; color: #475569; }
.badge.unverified { background: #fef3c7; color: var(--warn); }

/* ---------- Shell ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 58px; background: var(--navy); color: #fff; flex-shrink: 0; }
.topbar .title { font-weight: 700; font-size: 16px; white-space: nowrap; }
.topbar .title small { display: block; font-weight: 400; font-size: 11px; opacity: .8; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav button { background: transparent; border: 0; color: rgba(255,255,255,.8); padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.nav button:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav button.active { background: rgba(255,255,255,.16); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .role { font-size: 12px; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 999px; }
.topbar .signout { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.view { flex: 1; min-height: 0; overflow: auto; }
.view.map-view { display: flex; overflow: hidden; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
h2.page { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
p.lead { margin: 0 0 20px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.notice { padding: 10px 14px; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px; }
.notice.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.notice.err { background: #fef2f2; border-color: #fecaca; color: var(--danger); }

/* ---------- Map view ---------- */
.sidebar { width: 360px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar .filters { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sidebar .filters h3 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sidebar .filters h3:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.results { flex: 1; overflow: auto; padding: 8px 0; }
.results .count { padding: 6px 16px; font-size: 12px; color: var(--muted); }
.site-row { padding: 10px 16px; border-left: 4px solid transparent; cursor: pointer; }
.site-row:hover, .site-row.active { background: #f1f5f9; }
.site-row .n { font-weight: 600; font-size: 14px; }
.site-row .a { font-size: 13px; color: var(--muted); }
.site-row .h { font-size: 12px; color: #475569; margin-top: 2px; }
#map { flex: 1; min-width: 0; background: #e5ecf3; }
.map-fallback { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 30px; text-align: center; }
.leaflet-popup-content { font: 14px/1.4 var(--font); margin: 12px 14px; min-width: 240px; }
.popup .t { font-weight: 700; margin-bottom: 2px; }
.popup .o { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.popup .l { font-size: 13px; color: #334155; }
.popup .l b { color: var(--muted); font-weight: 600; }
.legend { position: absolute; right: 12px; bottom: 24px; z-index: 500; background: rgba(255,255,255,.95); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); }
.legend div { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 50%; }
.map-area { position: relative; flex: 1; display: flex; min-width: 0; }
@media (max-width: 860px) {
  .view.map-view { flex-direction: column; }
  .sidebar { width: 100%; max-height: 45%; }
}

/* ---------- Directory ---------- */
.org-card { margin-bottom: 16px; border-top: 4px solid var(--navy); }
.org-card header { display: flex; align-items: flex-start; gap: 14px; }
.org-card header h3 { margin: 0; font-size: 18px; }
.org-card header .meta { color: var(--muted); font-size: 13px; }
.org-card .desc { margin: 10px 0 12px; }
.services-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 12px; }
.svc { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fafbfc; }
.svc .n { font-weight: 600; }
.svc .c { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.svc .d { font-size: 13px; }
.svc .codes { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.sites-mini { margin-top: 12px; font-size: 13px; }
.sites-mini li { margin: 3px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--navy); margin-top: 10px; }

/* ---------- Problem codes ---------- */
.codes-layout { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .codes-layout { grid-template-columns: 1fr; } }
table.codes { width: 100%; border-collapse: collapse; font-size: 14px; }
table.codes th, table.codes td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.codes th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f8fafc; position: sticky; top: 0; }
table.codes tr.cat td { background: #eef2f7; font-weight: 700; color: var(--navy); }
table.codes tr.row { cursor: pointer; }
table.codes tr.row:hover, table.codes tr.row.active { background: #f1f5f9; }
.code-detail { position: sticky; top: 16px; }
.provider { padding: 8px 0; border-top: 1px solid var(--border); }
.provider .o { font-weight: 700; font-size: 14px; }
.provider .s { font-size: 13px; }
.provider .i { font-size: 12px; color: var(--muted); }

/* ---------- Ask ---------- */
.ask-form { display: grid; gap: 12px; }
.ask-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ask-row select { width: auto; }
.answer { margin-top: 20px; display: grid; gap: 14px; }
.match { border-left: 4px solid var(--navy); }
.match .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.match .top h4 { margin: 0; font-size: 16px; }
.match p { margin: 6px 0; font-size: 14px; }
.match .lbl { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.alt { padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.alt:first-of-type { border-top: 0; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.examples button { font-size: 12px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-list { max-height: 70vh; overflow: auto; }
/* Directory totals — a quiet summary strip under the editor */
.admin-counts { margin-top: 18px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.admin-counts .row { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.admin-counts .stat { font-size: 13px; color: var(--muted); }
.admin-counts .stat b { font-size: 16px; color: var(--navy); margin-right: 4px; }
.admin-counts .stat.total b { color: var(--teal); }
.admin-counts .cov { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.admin-counts .cov b { color: #1f2937; }
.admin-counts .cov a { color: var(--navy); }
body.print-needs .admin-counts { display: none !important; }
.admin-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.admin-item:hover, .admin-item.active { background: #f1f5f9; }
.admin-item small { display: block; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.form-actions .status { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 2000; display: grid; place-items: center; padding: 20px; overflow: auto; }
.modal-card { background: #fff; border-radius: 12px; width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; padding: 20px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; color: var(--navy); }
.preview-box { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-top: 12px; background: #fafbfc; }
.preview-box .sms { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; background: #eef2f7; padding: 10px; border-radius: 6px; }
.preview-box iframe { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* ---------- Handout ---------- */
.topbar .pill { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--navy); font-size: 11px; font-weight: 700; margin-left: 4px; }
.modal-card.wide { max-width: 1100px; }
.handout-layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .handout-layout { grid-template-columns: 1fr; } }
.handout-org { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.handout-org .t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.handout-org .sub { margin: 4px 0 0 22px; font-size: 13px; }
.handout-org .sub label, .handout-check-list label { display: flex; gap: 6px; align-items: flex-start; margin: 2px 0; font-size: 13px; cursor: pointer; }
.handout-org .sub label input, .handout-check-list label input, .handout-org .t input { width: auto; margin-top: 3px; }
.handout-check-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.handout-preview { border: 1px solid var(--border); border-radius: 8px; background: #f1f5f9; padding: 16px; max-height: 70vh; overflow: auto; }
.svc-row { padding: 10px 16px; border-left: 4px solid transparent; background: #fbfcfe; border-bottom: 1px solid var(--border); }
.svc-row .n { font-weight: 600; font-size: 14px; }
.svc-row .a { font-size: 13px; color: #334155; margin-top: 2px; }
.svc-row .h { font-size: 12px; color: var(--muted); margin-top: 2px; }
.svc-row .acts, .site-row .acts, .popup .acts { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; flex-wrap: wrap; }

/* The handout document itself (screen preview and print share these styles) */
.handout { background: #fff; color: #111827; font-family: Georgia, "Times New Roman", serif; font-size: 12.5pt; line-height: 1.45; padding: 0.7in 0.75in; max-width: 8.5in; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.handout * { box-sizing: border-box; }
.handout .hd-head { display: flex; align-items: center; gap: 18px; border-bottom: 3px solid var(--navy); padding-bottom: 12px; margin-bottom: 14px; }
.handout .hd-head img { max-height: 78px; max-width: 200px; }
.handout .hd-head .org { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-weight: 700; font-size: 15pt; color: var(--navy); }
.handout .hd-head .title { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 20pt; font-weight: 700; color: #111827; margin-top: 2px; }
.handout .hd-meta { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 10.5pt; color: #475569; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.handout .hd-intro { margin: 0 0 14px; }
.handout .hd-note { background: #f1f5f9; border-left: 4px solid var(--teal); padding: 8px 12px; margin: 0 0 14px; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 11.5pt; }
.handout .hd-org { break-inside: avoid; border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; }
.handout .hd-org h2 { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14pt; margin: 0 0 4px; color: var(--navy); }
.handout .hd-org .hd-svc { margin: 0 0 6px; padding: 6px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; }
.handout .hd-org .hd-svc b { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.handout .hd-org table { border-collapse: collapse; width: 100%; font-size: 11.5pt; margin-top: 4px; }
.handout .hd-org td { padding: 3px 0; vertical-align: top; }
.handout .hd-org td:first-child { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-weight: 700; color: #475569; width: 1.5in; font-size: 10.5pt; padding-right: 8px; }
.handout .hd-org ul { margin: 2px 0 0; padding-left: 18px; }
.handout h3.hd-sec { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 12.5pt; color: var(--navy); margin: 16px 0 6px; border-bottom: 1px solid #cbd5e1; padding-bottom: 3px; }
.handout .hd-res { break-inside: avoid; margin: 0 0 6px; font-size: 11.5pt; }
.handout .hd-foot { border-top: 1px solid #cbd5e1; margin-top: 16px; padding-top: 8px; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 9.5pt; color: #64748b; }
.handout-print-area { display: none; }
/* Flyers: one page per organization / service / location / community resource */
.flyer { background: #fff; color: #111827; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 11.5pt; line-height: 1.4; padding: 0.6in 0.75in; max-width: 8.5in; min-height: 10in; margin: 0 auto 16px; box-shadow: 0 1px 4px rgba(0,0,0,.15); break-after: page; page-break-after: always; display: flex; flex-direction: column; }
.flyer .fl-body { flex: 1; }
.flyer * { box-sizing: border-box; }
.flyer .fl-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 18px; }
.flyer .fl-head img { max-height: 70px; max-width: 190px; }
.flyer .fl-head .who { text-align: right; font-size: 10.5pt; color: #475569; }
.flyer .fl-head .who b { display: block; font-size: 12.5pt; color: var(--navy); }
.flyer .fl-kind { display: inline-block; font-size: 10pt; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--navy); border-radius: 4px; padding: 3px 9px; margin-bottom: 8px; }
.flyer h1 { font-size: 24pt; line-height: 1.15; margin: 0 0 4px; color: #111827; }
.flyer .fl-sub { font-size: 13pt; color: #475569; margin-bottom: 14px; }
.flyer .fl-desc { font-size: 12.5pt; margin: 0 0 16px; }
.flyer table { border-collapse: collapse; width: 100%; font-size: 12pt; }
.flyer td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid #e5e7eb; }
.flyer td:first-child { font-weight: 700; color: #475569; width: 1.7in; padding-right: 10px; font-size: 11pt; }
.flyer .fl-phone { font-size: 16pt; font-weight: 800; color: var(--navy); }
.flyer ul { margin: 2px 0 0; padding-left: 18px; }
.flyer .fl-sec { font-size: 11pt; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px; }
.flyer .codes { margin-top: 2px; }
.flyer .code-line { font-size: 11pt; margin: 2px 0; }
.flyer .code-line .tag.code { margin-right: 6px; }
.flyer .fl-help { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flyer .fl-phone-big { font-size: 24pt; font-weight: 800; color: var(--navy); margin: 4px 0 10px; letter-spacing: .01em; }
.flyer .fl-phone-big .ic { font-size: 18pt; }
.flyer .fl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.flyer .fl-cell { display: flex; gap: 10px; align-items: flex-start; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; }
.flyer .fl-cell .ic { font-size: 16pt; line-height: 1; }
.flyer .fl-cell .lb { font-size: 9.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.flyer .fl-cell .vl { font-size: 12pt; line-height: 1.35; word-break: break-word; }
.flyer .fl-cell .muted { font-size: 10pt; color: #64748b; }
.flyer .fl-p { margin: 0; font-size: 12pt; }
.flyer .fl-helpline { background: #eef2f7; border-left: 4px solid var(--navy); border-radius: 6px; padding: 8px 12px; font-size: 12.5pt; }
.flyer .fl-desc { font-size: 13pt; }
.flyer h1 { font-size: 26pt; }
.flyer .chip-help { display: inline-block; background: #eef2f7; color: #1f2937; border-radius: 999px; padding: 4px 11px; font-size: 10.5pt; }
.flyer ol.fl-steps { margin: 4px 0 0; padding-left: 20px; font-size: 11.5pt; }
.flyer ol.fl-steps li { margin: 3px 0; }
.flyer .fl-foot { border-top: 1px solid #cbd5e1; margin-top: 18px; padding-top: 8px; font-size: 9pt; color: #64748b; display: flex; justify-content: space-between; gap: 12px; break-inside: avoid; }
.flyer td { padding: 5px 0; }
.flyer .fl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.flyer .fl-cols ul { font-size: 10.5pt; }
.flyer .fl-cols .code-line { font-size: 10pt; }
.flyer .fl-foot .pg { white-space: nowrap; }
@media print {
  @page { size: letter; margin: 0.5in; }
  .flyer { box-shadow: none; margin: 0; padding: 0 0.1in 0.1in; max-width: none; min-height: 0; display: block; font-size: 10.5pt; line-height: 1.35; }
  .flyer h1 { font-size: 20pt; } .flyer .fl-sub { font-size: 12pt; margin-bottom: 10px; } .flyer .fl-desc { font-size: 11pt; margin-bottom: 10px; }
  .flyer table { font-size: 10.5pt; } .flyer td { padding: 3px 0; } .flyer td:first-child { font-size: 10pt; width: 1.5in; } .flyer .fl-phone { font-size: 14pt; }
  .flyer .fl-head { padding-bottom: 6px; margin-bottom: 12px; } .flyer .fl-head img { max-height: 56px; } .flyer .fl-sec { margin: 12px 0 4px; font-size: 10pt; }
  .flyer .chip-help { font-size: 10.5pt; padding: 3px 10px; } .flyer ol.fl-steps { font-size: 11.5pt; } .flyer .fl-foot { margin-top: 12px; font-size: 8.5pt; }
  .flyer .fl-phone-big { font-size: 22pt; margin: 2px 0 8px; } .flyer .fl-cell { padding: 7px 10px; } .flyer .fl-cell .vl { font-size: 10.5pt; } .flyer .fl-cell .lb { font-size: 8.5pt; } .flyer .fl-desc { font-size: 11.5pt; margin-bottom: 8px; } .flyer .fl-p { font-size: 11pt; } .flyer h1 { font-size: 22pt; } .flyer .fl-grid { gap: 8px 14px; } .flyer .fl-sec { margin: 10px 0 4px; } .flyer ol.fl-steps li { margin: 2px 0; }
  .flyer:last-child { break-after: auto; page-break-after: auto; }
  body { background: #fff; }
  body:not(.print-needs) .login-wrap, body:not(.print-needs) .app, .modal { display: none !important; }
  body:not(.print-needs) .handout-print-area { display: block !important; }
  body.print-needs .handout-print-area { display: none !important; }
  .handout { box-shadow: none; padding: 0; max-width: none; margin: 0; }
  .handout a { color: #111827; text-decoration: none; }
  .handout .hd-head .org, .handout .hd-org h2, .handout h3.hd-sec { color: #0a5c8f; }
}
.topbar .signout.flash { background: var(--teal); border-color: var(--teal); }

/* Directory accordion */
.org-acc { background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--navy); border-radius: 10px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.org-acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.org-acc > summary::-webkit-details-marker { display: none; }
.org-acc > summary::before { content: '▸'; color: var(--muted); font-size: 14px; width: 12px; flex: none; transition: transform .15s; }
.org-acc[open] > summary::before { transform: rotate(90deg); }
.org-acc > summary:hover { background: #f8fafc; border-radius: 10px; }
.acc-main { flex: 1; min-width: 0; }
.acc-name { font-weight: 700; font-size: 16px; color: var(--navy); }
.acc-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.acc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.acc-phone { font-weight: 600; font-size: 14px; }
.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acc-body { padding: 4px 16px 16px 42px; border-top: 1px solid var(--border); }
.sub-acc { margin-top: 12px; }
.sub-acc > summary { cursor: pointer; font-weight: 700; color: var(--navy); font-size: 15px; }
.sub-cat { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.res-acc { border-left-color: #64748b; }
@media (max-width: 720px) { .org-acc > summary { flex-wrap: wrap; } .acc-side { align-items: flex-start; width: 100%; padding-left: 26px; } .acc-body { padding-left: 16px; } }

.idle-warning { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; z-index: 2000; font-size: 14px; }
.idle-warning .btn { background: #fff; color: #1f2937; }

.req { color: #b91c1c; font-weight: 600; font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Needs assessment */
.needs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.needs-tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.needs-tile .n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.needs-tile .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.needs-tile.bad .n { color: #dc2626; } .needs-tile.warn .n { color: #d97706; } .needs-tile.good .n { color: #16a34a; } .needs-tile.plain .n { color: var(--navy); }
table.needs td.bad { color: #b91c1c; font-weight: 700; } table.needs td.warn { color: #b45309; font-weight: 600; } table.needs td.good { color: #15803d; }
table.needs .tag { margin: 2px 4px 2px 0; display: inline-block; }
table.needs .bar { position: relative; background: #e5e7eb; border-radius: 6px; height: 16px; min-width: 120px; overflow: hidden; }
table.needs .bar .fill { height: 100%; }
table.needs .bar span { position: absolute; left: 6px; top: 0; font-size: 11px; line-height: 16px; color: #111; }

.needs-map { height: 360px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.needs-legend { background: #fff; padding: 6px 8px; border-radius: 6px; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.needs-legend span { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; }
table.needs-grid { border-collapse: collapse; font-size: 12px; width: 100%; }
table.needs-grid th { position: sticky; top: 0; background: #f8fafc; z-index: 1; padding: 6px 4px; border-bottom: 1px solid var(--border); height: 92px; vertical-align: bottom; }
table.needs-grid th .rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 11px; color: var(--navy); }
table.needs-grid td { padding: 3px 6px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
table.needs-grid td.code-col, table.needs-grid th.code-col { text-align: left; min-width: 220px; max-width: 320px; white-space: normal; }
table.needs-grid td .nm { color: #475569; }
table.needs-grid td.cell { text-align: center; color: #cbd5e1; }
table.needs-grid td.cell.y { color: #15803d; font-size: 15px; }
table.needs-grid td.cell.r { color: #d97706; font-size: 15px; }
table.needs-grid td.stat { font-size: 11px; color: var(--muted); }
table.needs-grid tr.cat td { background: #eef2f7; font-weight: 700; color: var(--navy); }
table.needs-grid tr.st-none td { background: #fef2f2; }
table.needs-grid tr.st-single td, table.needs-grid tr.st-restricted td { background: #fffbeb; }

/* Needs assessment — print to PDF */
.needs-print-head { display: none; }
@media print {
  body.print-needs { background: #fff; }
  body.print-needs .topbar, body.print-needs #view-admin > .container > h2, body.print-needs #view-admin > .container > .lead, body.print-needs #admin-notice, body.print-needs #view-admin .toolbar, body.print-needs .admin-list, body.print-needs #admin-form > h3, body.print-needs #admin-form > .lead, body.print-needs #handout-modal, body.print-needs #send-modal, body.print-needs #idle-warning { display: none !important; }
  body.print-needs .admin-layout { display: block !important; }
  body.print-needs .app { display: block !important; }
  body.print-needs .view:not(#view-admin) { display: none !important; }
  body.print-needs #view-admin .container { max-width: none; padding: 0; }
  body.print-needs #admin-form { border: none; box-shadow: none; padding: 0; }
  body.print-needs .needs-print-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--navy); padding-bottom: 8px; margin-bottom: 12px; }
  body.print-needs .needs-print-head img { height: 54px; }
  body.print-needs .needs-print-head .pt { font-size: 18px; font-weight: 800; color: var(--navy); }
  body.print-needs .needs-print-head .ps { font-size: 12px; color: #475569; }
  body.print-needs .needs-map { height: 320px; break-inside: avoid; }
  body.print-needs .leaflet-control-container .leaflet-top { display: none; }
  body.print-needs table.needs-grid th { position: static; height: auto; }
  body.print-needs table.needs-grid th .rot { writing-mode: horizontal-tb; transform: none; font-size: 9px; }
  body.print-needs table.needs-grid, body.print-needs table.needs { font-size: 10px; }
  body.print-needs div[style*="max-height:70vh"] { max-height: none !important; overflow: visible !important; border: none !important; }
  body.print-needs h4 { break-after: avoid; }
  body.print-needs tr { break-inside: avoid; }
  @page { size: letter; margin: 0.5in; }
}

/* Print backgrounds/colors even when the browser's "Background graphics" box is unchecked */
@media print {
  *, *::before, *::after { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }
  .needs-tile, .needs-tile .n, table.needs td, table.needs-grid td, table.needs-grid tr.cat td, table.needs .bar .fill, .tag, .handout, .handout * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  table.needs-grid tr.st-none td { background: #fee2e2 !important; }
  table.needs-grid tr.st-single td, table.needs-grid tr.st-restricted td { background: #fef3c7 !important; }
  table.needs-grid td.cell.y { color: #15803d !important; } table.needs-grid td.cell.r { color: #d97706 !important; }
  .needs-tile.bad .n { color: #dc2626 !important; } .needs-tile.warn .n { color: #d97706 !important; } .needs-tile.good .n { color: #16a34a !important; }
}

/* Needs grid — organization-colored dots */
table.needs-grid td.cell .dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: var(--c); vertical-align: middle; }
table.needs-grid td.cell .dot.ring { background: #fff; border: 3px solid var(--c); width: 9px; height: 9px; }
table.needs-grid th .sw { display: block; width: 14px; height: 14px; border-radius: 3px; margin: 0 auto 4px; }
.org-tag { border: none; }
@media print { table.needs-grid td.cell .dot, table.needs-grid th .sw, .org-tag { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } }

/* Discover resources */
.sugg { border: 1px solid var(--border); border-left: 4px solid var(--teal); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.sugg.changed { border-left-color: #f59e0b; }
.sugg .n { font-weight: 700; font-size: 15px; }
.sugg .a { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.sugg .d { font-size: 13.5px; margin: 4px 0; }
.sugg .why { font-size: 13.5px; margin: 6px 0; background: #eef6fb; padding: 6px 8px; border-radius: 6px; }
.sugg .src { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sugg .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.nav button .pill { background: #f59e0b; color: #1f2937; }
