/* Texans On Mission — palette lifted from texansonmission.org.
   Navy #003d6a and gold #fcb415 are the two dominant brand colors on the
   public site; the warm off-white #f3f1ef is its page ground. */

:root {
  --navy: #003d6a;
  --navy-dark: #002a4a;
  --navy-soft: #e6edf3;
  --blue: #005a9d;
  --gold: #fcb415;
  --gold-light: #fdc447;
  --gold-soft: #fef3d8;
  --red: #c1272d;
  --red-soft: #fbeaea;
  --green: #2f7d4f;
  --green-soft: #e7f3ec;

  --paper: #f3f1ef;
  --surface: #ffffff;
  --surface-2: #faf9f8;
  --line: #e2ddd8;
  --line-strong: #cfc8c1;
  --text: #293238;
  --text-2: #55606a;
  --muted: #8998a0;

  --radius: 10px;
  --topbar-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 2px 8px rgba(41,50,56,.07), 0 8px 24px rgba(41,50,56,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--blue); }

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 900;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  background: var(--gold); color: var(--navy); font-weight: 800; letter-spacing: .04em;
  padding: 5px 9px; border-radius: 6px; font-size: 13px;
}
.brand-name { font-weight: 650; font-size: 15px; color: #fff; }
@media (max-width: 560px) { .brand-name { display: none; } }

.nav { display: flex; align-items: center; gap: 3px; }
.nav a, .linkish {
  color: rgba(255,255,255,.82); text-decoration: none; font-size: 14px; font-weight: 550;
  padding: 8px 11px; border-radius: 8px; background: none; border: 0;
  font-family: var(--font); cursor: pointer;
}
.nav a:hover, .linkish:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav a.on { color: var(--navy); background: var(--gold); font-weight: 650; }
.inline { display: inline; margin: 0; }

.nav-badge {
  display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 5px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-align: center;
}

/* ---------- layout ---------- */

.centered {
  min-height: calc(100vh - var(--topbar-h));
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 380px; text-align: center; }
.card.wide { max-width: 1100px; }

.page { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; color: var(--navy); }
h2 { font-size: 17px; margin: 28px 0 10px; color: var(--navy); }
.sub { color: var(--text-2); font-size: 14px; margin: 0 0 22px; line-height: 1.5; }
.muted { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.code-big { font-size: 52px; font-weight: 800; color: var(--navy); }

/* ---------- forms ---------- */

label { display: block; font-size: 13px; font-weight: 650; margin: 14px 0 5px; color: var(--navy); }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; font-size: 16px; /* 16px stops iOS zoom */
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-family: var(--font);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0,61,106,.15);
}
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff; border: 0; border-radius: var(--radius);
  padding: 12px 18px; font-size: 15px; font-weight: 650; cursor: pointer;
  text-decoration: none; font-family: var(--font); width: 100%; margin-top: 18px;
}
.btn:hover { background: var(--navy-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.gold:hover { background: var(--gold-light); }
.btn.secondary { background: var(--surface); color: var(--navy); border: 1px solid var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; margin: 0; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.danger:hover { background: var(--red-soft); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.checkline { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; }
.checkline input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--navy); }
.checkline label { margin: 0; font-weight: 500; font-size: 14px; color: var(--text); }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.foot-links { margin-top: 20px; text-align: center; font-size: 14px; }
.foot-links a { color: var(--text-2); text-decoration: none; }
.foot-links a:hover { color: var(--navy); text-decoration: underline; }

/* ---------- flashes ---------- */

.flashes { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px);
           left: 50%; transform: translateX(-50%); z-index: 1200; width: min(92vw, 440px); }
.flash {
  padding: 12px 15px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); animation: drop .25s ease;
}
.flash-ok { border-left: 4px solid var(--green); }
.flash-error { border-left: 4px solid var(--red); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- badges / tables ---------- */

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge-active { background: var(--green-soft); color: var(--green); }
.badge-pending { background: var(--gold-soft); color: #96690a; }
.badge-suspended { background: var(--red-soft); color: var(--red); }
.badge-admin { background: var(--navy-soft); color: var(--navy); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); font-size: 12px; text-transform: uppercase;
     letter-spacing: .05em; color: var(--text-2); }
tr:last-child td { border-bottom: 0; }
td select, td input { padding: 6px 8px; font-size: 13px; width: auto; }
code.codechip {
  background: var(--navy-soft); color: var(--navy); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 6px; font-size: 13px; font-weight: 600;
}

/* ---------- map page ---------- */

body.map-body { overflow: hidden; }
#map { position: absolute; inset: calc(var(--topbar-h) + env(safe-area-inset-top)) 0 0 0; background: #dfe6ea; }

.map-panel {
  position: absolute; z-index: 800; background: rgba(255,255,255,.96);
  border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
}
.layer-panel { top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px); right: 12px; padding: 10px; width: 196px; }
.layer-panel h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
                  letter-spacing: .07em; color: var(--muted); }
.layer-btn {
  display: block; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 3px;
  background: none; border: 1px solid transparent; color: var(--text-2);
  border-radius: 8px; font-size: 13px; font-weight: 550; cursor: pointer; font-family: var(--font);
}
.layer-btn:hover { background: var(--surface-2); color: var(--navy); }
.layer-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.overlay-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; color: var(--text-2); }
.overlay-row input { accent-color: var(--navy); width: 16px; height: 16px; }
.panel-sep { height: 1px; background: var(--line); margin: 8px 0; }

.status-panel { bottom: 14px; left: 12px; padding: 12px 14px; max-width: 265px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; color: var(--text-2); }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--green);
            animation: pulse 2s infinite; flex: none; }
.dot-off { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47,125,79,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(47,125,79,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,125,79,0); }
}

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

/* Leaflet popup restyled as a contact bubble */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.leaflet-popup-content { margin: 0; width: 252px !important; }
.leaflet-popup-tip { background: var(--surface); border: 1px solid var(--line); }
.leaflet-popup-close-button { color: var(--muted) !important; padding: 8px 8px 0 0 !important; }

.bubble { padding: 14px 16px; }
.bubble-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; color: var(--navy); }
.bubble-title { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.bubble-unit {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; margin-bottom: 10px;
  color: #fff;
}
.bubble-contact { display: block; font-size: 13.5px; padding: 6px 0; text-decoration: none;
                  color: var(--blue); border-top: 1px solid var(--line); }
.bubble-age { font-size: 11.5px; color: var(--muted); margin-top: 9px;
              border-top: 1px solid var(--line); padding-top: 8px; }
.bubble-actions { margin-top: 10px; }

.person-dot { border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 5px rgba(41,50,56,.5); }
.person-dot.self { box-shadow: 0 0 0 4px rgba(252,180,21,.55), 0 1px 5px rgba(41,50,56,.5); }
.person-dot.stale { opacity: .45; }

/* ---------- landing ---------- */

.landing { min-height: 100vh; display: flex; flex-direction: column;
           align-items: center; justify-content: center; text-align: center; padding: 40px 20px;
           background: linear-gradient(170deg, var(--navy) 0%, #00294a 100%); }
.landing .brand-mark { font-size: 20px; padding: 10px 14px; }
.landing h1 { font-size: 34px; margin: 22px 0 10px; letter-spacing: -.02em; color: #fff; }
.landing p { color: rgba(255,255,255,.8); font-size: 16px; max-width: 460px;
             line-height: 1.6; margin: 0 0 28px; }
.landing .row .btn { width: auto; min-width: 150px; }
.landing .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.landing .btn.secondary:hover { background: rgba(255,255,255,.1); }

.install-tip {
  margin-top: 34px; font-size: 13px; color: rgba(255,255,255,.72);
  border: 1px dashed rgba(255,255,255,.3); border-radius: 10px;
  padding: 12px 16px; max-width: 400px; line-height: 1.55;
}

/* ---------- misc ---------- */

.consent-box {
  background: var(--gold-soft); border: 1px solid var(--gold);
  border-radius: 10px; padding: 14px 16px; margin: 18px 0; font-size: 13.5px; line-height: 1.55;
  color: #6b4a05;
}
.steps { list-style: none; padding: 0; margin: 20px 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0;
            border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.step-mark { width: 22px; height: 22px; border-radius: 50%; flex: none; font-size: 12px;
             display: flex; align-items: center; justify-content: center; font-weight: 700; }
.step-done { background: var(--green); color: #fff; }
.step-todo { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); }

/* ---------- brand mark ---------- */

.brand-logo { width: 34px; height: 34px; color: #fff; --mark-halo: var(--navy); flex: none; }
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-dot { color: var(--muted); font-weight: 500; }
.topbar .brand-dot { color: rgba(255,255,255,.6); }
.landing .brand-logo { width: 96px; height: 96px; --mark-halo: #00294a; }
.auth-logo { width: 64px; height: 64px; color: var(--navy); --mark-halo: #fff;
             margin: 0 auto 14px; }
.auth-logo svg { width: 100%; height: 100%; display: block; }
.tagline { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
           color: var(--muted); margin-top: 6px; }
.landing .tagline { color: rgba(255,255,255,.65); letter-spacing: .1em; }

/* ---------- conversation list ---------- */

.conv-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
             background: var(--surface); }
.conv-row { display: flex; align-items: center; gap: 12px; padding: 13px 15px;
            text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.conv-row:last-child { border-bottom: 0; }
.conv-row:hover { background: var(--surface-2); }
.conv-row.unread { background: var(--navy-soft); }
.conv-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 8px; }
.conv-name { font-weight: 650; font-size: 15px; }
.conv-preview { font-size: 13px; color: var(--text-2); margin-top: 2px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-muted { font-size: 14px; opacity: .6; }

/* ---------- thread ---------- */

body.chat-body { overflow: hidden; }
.chat-wrap {
  position: absolute; inset: calc(var(--topbar-h) + env(safe-area-inset-top)) 0 0 0;
  display: flex; flex-direction: column; background: var(--paper);
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex: none;
}
.chat-back { font-size: 26px; line-height: 1; text-decoration: none; color: var(--navy);
             padding: 0 4px; }
.chat-title { font-weight: 700; font-size: 16px; color: var(--navy);
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12px; color: var(--muted); }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 14px;
               -webkit-overflow-scrolling: touch; }
.msg { margin-bottom: 12px; display: flex; flex-direction: column;
       align-items: flex-start; max-width: 78%; }
.msg.mine { margin-left: auto; align-items: flex-end; }
.msg.system { max-width: 100%; align-items: center; margin: 16px auto; }
.msg-sender { font-size: 11.5px; font-weight: 700; color: var(--muted);
              margin: 0 0 3px 3px; }
.msg-bubble {
  background: var(--surface); border: 1px solid var(--line);
  padding: 9px 13px; border-radius: 16px 16px 16px 4px;
  font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.msg.mine .msg-bubble { background: var(--navy); color: #fff; border-color: var(--navy);
                        border-radius: 16px 16px 4px 16px; }
.msg-bubble.urgent { border-color: var(--red); border-width: 2px; }
.msg.mine .msg-bubble.urgent { background: var(--red); border-color: var(--red); }
.urgent-tag {
  display: block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--red); margin-bottom: 3px;
}
.msg.mine .urgent-tag { color: #ffd9db; }
.msg-time { font-size: 11px; color: var(--muted); margin: 3px 4px 0; }
.msg-system { font-size: 12.5px; color: var(--muted); background: var(--surface-2);
              border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; }

.chat-compose { flex: none; background: var(--surface); border-top: 1px solid var(--line);
                padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose textarea {
  flex: 1; resize: none; max-height: 140px; padding: 10px 12px;
  border-radius: 20px; font-size: 16px; line-height: 1.4; font-family: var(--font);
}
.chat-compose .btn.small { margin: 0; padding: 10px 16px; border-radius: 20px; }
.urgent-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
                color: var(--text-2); margin-bottom: 7px; }
.urgent-check input { width: 15px; height: 15px; accent-color: var(--red); }

/* ---------- people picker modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1300; background: rgba(41,50,56,.45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 18px 50px rgba(41,50,56,.25);
}
.modal .linkish { font-size: 24px; line-height: 1; color: var(--muted); padding: 0 6px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.chip input { width: 15px; height: 15px; accent-color: var(--navy); }
.chip.chosen { background: var(--navy-soft); border-color: var(--navy); color: var(--navy);
               font-weight: 600; }
.chip-count { color: var(--muted); font-size: 11.5px; }
.chip-x { background: none; border: 0; color: inherit; font-size: 16px; line-height: 1;
          cursor: pointer; padding: 0 0 0 2px; }

.people-results { max-height: 220px; overflow-y: auto; margin-top: 6px; }
.person-row {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  font-size: 14px; font-family: var(--font); cursor: pointer; color: var(--text);
}
.person-row:hover { background: var(--surface-2); }

/* ---------- icon picker ---------- */

.icon-field { display: flex; align-items: center; gap: 8px; }
.icon-field.compact { gap: 4px; }
.icon-input { font-size: 20px; text-align: center; }
.icon-field .icon-input { max-width: 90px; }
.icon-preview { font-size: 24px; }
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px; margin-top: 12px; max-height: 320px; overflow-y: auto;
}
.icon-cell {
  font-size: 24px; line-height: 1; padding: 9px 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
}
.icon-cell:hover { background: var(--navy-soft); border-color: var(--navy); }

/* ---------- places ---------- */

.filter-card { padding: 18px 20px; }
.filter-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px;
}
.filter-grid label { margin-top: 0; }

.place-prompt {
  top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px); left: 50%;
  transform: translateX(-50%); padding: 11px 16px; font-size: 14px;
  display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--navy);
}
.place-prompt .linkish { color: var(--red); font-size: 13px; padding: 4px 8px; }

.place-pin {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg); border: 2px solid #fff; font-size: 15px;
  box-shadow: 0 2px 6px rgba(41,50,56,.45);
}
.place-pin span { transform: rotate(45deg); }

/* ---------- overflow discipline ----------
   Nothing may push the page wider than the viewport; narrow phones in the
   field are the primary target. */

html, body { max-width: 100%; overflow-x: hidden; }
.centered, .landing, .page { width: 100%; }
/* Cap against the viewport itself, not the parent — a parent that has been
   stretched by any descendant can't then push content off-screen. */
.card { max-width: min(460px, calc(100vw - 32px)); }
.card.narrow { max-width: min(380px, calc(100vw - 32px)); }
.card.wide  { max-width: min(1100px, calc(100vw - 32px)); }
.landing p, .install-tip { max-width: min(460px, calc(100vw - 40px)); }
.tagline { max-width: 100%; letter-spacing: .05em; }
.row > * { min-width: 0; }
.modal { max-width: min(460px, calc(100vw - 36px)); }
.table-wrap { max-width: 100%; }
.page { max-width: min(1000px, 100vw); }

/* real logo assets replace the drawn placeholder mark */
.brand-logo img { width: 34px; height: 34px; display: block; border-radius: 7px; }
.auth-logo img  { width: 64px; height: 64px; display: block; margin: 0 auto;
                  border-radius: 13px; }
.auth-logo { width: auto; height: auto; }
.landing-logo { width: min(330px, 84vw); height: auto; display: block;
                margin: 0 auto 10px; background: #fff; padding: 18px 22px;
                border-radius: 16px; box-shadow: 0 10px 34px rgba(0,0,0,.32); }

/* An element with the `hidden` attribute must stay hidden even when a class
   sets its display. `.modal-backdrop { display: flex }` was beating the
   browser default `[hidden] { display: none }`, so modals could never close. */
[hidden] { display: none !important; }

/* ---------- map search ---------- */

.search-panel {
  top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px); left: 12px;
  width: min(300px, calc(100vw - 24px)); padding: 0;
}
.search-panel input[type=search] {
  width: 100%; border: 0; background: transparent; padding: 11px 34px 11px 13px;
  font-size: 15px; border-radius: 12px;
}
.search-panel input[type=search]:focus { outline: none; box-shadow: none; }
.search-clear {
  position: absolute; right: 8px; top: 8px; width: 24px; height: 24px;
  border: 0; background: var(--surface-2); border-radius: 50%; cursor: pointer;
  color: var(--text-2); font-size: 15px; line-height: 1;
}
.search-results {
  border-top: 1px solid var(--line); max-height: 320px; overflow-y: auto;
  border-radius: 0 0 12px 12px;
}
.search-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; font-family: var(--font); color: var(--text);
}
.search-row:last-child { border-bottom: 0; }
.search-row:hover, .search-row.active { background: var(--navy-soft); }
.search-row.offline { opacity: .62; }
.search-icon { font-size: 17px; flex: none; width: 22px; text-align: center; }
.search-text { min-width: 0; flex: 1; }
.search-label { font-size: 14px; font-weight: 600; white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; }
.search-sub { font-size: 12px; color: var(--text-2); white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 12px 13px; font-size: 13px; color: var(--muted); }

@media (max-width: 620px) {
  /* keep the search box clear of the layer panel on a phone */
  .layer-panel { top: auto; bottom: 14px; right: 12px; width: 168px; }
  .status-panel { bottom: 14px; left: 12px; max-width: calc(100vw - 200px); }
}
