* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0e1116; color: #e7eaf0;
  font-size: 16px; line-height: 1.4;
}
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
          env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- Header ---------- */
.m-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1rem;
  background: #161b22; border-bottom: 1px solid #2a313c;
}
.m-brand { display: flex; flex-direction: column; min-width: 0; }
.m-logo { font-weight: 800; letter-spacing: 0.08em; color: #f4a259;
          font-size: 1.3rem; line-height: 1; }
.m-tag { font-size: 0.72rem; color: #9ca3af; margin-top: 0.18rem;
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-toggle {
  font-size: 0.78rem; color: #f4a259; text-decoration: none;
  border: 1px solid #2a313c; padding: 0.35rem 0.6rem; border-radius: 6px;
  flex-shrink: 0;
}

/* ---------- Stack of sidebar-style sections ---------- */
.m-stack { padding: 0.5rem 0.85rem 1rem; }

.m-section {
  background: transparent;
  margin-top: 0.85rem;
}
.m-section:first-child { margin-top: 0.5rem; }
.m-section h2 {
  margin: 0 0 0.4rem;
  padding-bottom: 0.3rem;
  font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: #9ca3af; border-bottom: 1px solid #2a313c;
}

/* Lists (Active risk, NWS warnings) */
.m-list .m-item {
  background: #1f242c; border: 1px solid #2a313c; border-radius: 6px;
  padding: 0.55rem 0.7rem; margin-bottom: 0.45rem;
}
.m-list .m-item .title { font-weight: 700; }
.m-list .m-item .meta  { color: #9ca3af; font-size: 0.78rem; margin-top: 0.2rem; }
.m-empty { color: #6b7280; font-style: italic; font-size: 0.92rem; }
.m-hint  { color: #9ca3af; font-size: 0.88rem; margin: 0.2rem 0; }

/* Find-shelter result cards */
.m-shelter {
  background: #1f242c; border: 1px solid #2a313c; border-radius: 8px;
  padding: 0.65rem 0.75rem; margin-bottom: 0.45rem;
}
.m-shelter.recommended { background: #0a3d2e; border-color: #19744f; }
.m-shelter .title { font-weight: 700; }
.m-shelter .actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.m-shelter .actions a {
  flex: 1; text-align: center; text-decoration: none; color: #161b22;
  background: #f4a259; padding: 0.5rem; border-radius: 6px;
  font-size: 0.85rem; font-weight: 700;
}
.m-shelter .actions a.secondary {
  background: transparent; color: #f4a259; border: 1px solid #f4a259;
}

/* My location */
.m-local {
  background: #1f242c; border: 1px solid #2a313c; border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.m-local .city { font-weight: 700; font-size: 1.05rem; color: #e7eaf0; }
.m-local .conditions {
  display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.25rem;
}
.m-local .temp { font-size: 1.4rem; font-weight: 700; color: #f4a259; }
.m-local .desc { color: #cbd5e1; font-size: 0.88rem; }
.m-local .meta {
  color: #9ca3af; font-size: 0.78rem; margin-top: 0.4rem;
  display: grid; grid-template-columns: 1fr 1fr; row-gap: 0.18rem; column-gap: 0.5rem;
}
.m-local .meta b { color: #e7eaf0; font-weight: 600; }
.m-local-status { color: #9ca3af; font-style: italic; font-size: 0.92rem; }
.m-locate-btn {
  margin-top: 0.55rem; width: 100%;
  background: transparent; color: #f4a259;
  border: 1px solid #f4a259; padding: 0.55rem; border-radius: 6px;
  font-weight: 700; cursor: pointer; font-size: 0.95rem;
}
.m-locate-btn:active { background: rgba(244, 162, 89, 0.12); }

/* J.O.N.A.S. Agent Operations live feed (mirrors desktop) */
.m-ops-feed {
  background: #0e1116; border: 1px solid #2a313c; border-radius: 6px;
  padding: 0.45rem 0.55rem;
  min-height: 340px; max-height: 340px; flex-shrink: 0; overflow-y: scroll;
  font-size: 0.85rem;
}
.m-ops-feed .m-empty {
  text-align: center; padding: 0.6rem 0;
}
.m-ops-row {
  display: flex; gap: 0.45rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed #1f242c;
}
.m-ops-row:last-child { border-bottom: none; }
.m-ops-time {
  color: #6b7280; font-variant-numeric: tabular-nums;
  font-size: 0.74rem; white-space: nowrap; padding-top: 0.1rem;
}
.m-ops-dot {
  flex: 0 0 8px; width: 8px; height: 8px; margin-top: 0.45rem;
  border-radius: 50%; background: #60a5fa;
}
.m-ops-row.success .m-ops-dot { background: #22c55e; }
.m-ops-row.warn    .m-ops-dot { background: #f97316; }
.m-ops-row.error   .m-ops-dot { background: #ef4444; }
.m-ops-msg {
  flex: 1 1 auto; min-width: 0;
  color: #e7eaf0; word-wrap: break-word; line-height: 1.35;
}
.m-ops-action {
  display: inline-block; margin-right: 0.35rem;
  font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: #9ca3af; background: #1f242c; padding: 0 0.35rem; border-radius: 3px;
}
.m-ops-row.success .m-ops-action { color: #86efac; background: #052e16; }
.m-ops-row.warn    .m-ops-action { color: #fed7aa; background: #3a1f10; }
.m-ops-row.error   .m-ops-action { color: #fecaca; background: #3f1d1d; }

/* Footer */
.m-footer {
  margin: 1rem 0.85rem;
  color: #9ca3af; font-size: 0.72rem; text-align: center;
}

/* Phablets / small tablets get a centered narrow column */
@media (min-width: 600px) { body { max-width: 540px; margin: 0 auto; } }


/* ---------- FIND SHELTER: connection-aware guidance ---------- */
.m-shelter-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
  margin: 0.2rem 0 0.45rem;
}
.m-mode-btn {
  appearance: none; background: #1f242c; color: #e7eaf0;
  border: 1px solid #2a313c; border-radius: 8px;
  padding: 0.55rem 0.4rem; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.m-mode-btn[aria-pressed="true"] {
  background: #f4a259; color: #161b22; border-color: #f4a259;
}
.m-mode-btn .m-mode-icon { margin-right: 0.3rem; font-size: 1.05rem; }
.m-mode-detected {
  font-size: 0.74rem; color: #6b7280; font-style: italic;
  margin-bottom: 0.45rem; text-align: center;
}
.m-guidance {
  background: #1f242c; border: 1px solid #2a313c; border-radius: 8px;
  padding: 0.7rem 0.85rem; margin-bottom: 0.55rem;
}
.m-guidance .m-guidance-title {
  font-weight: 700; font-size: 1rem; margin-bottom: 0.35rem;
  color: #f4a259;
}
.m-guidance.warn .m-guidance-title { color: #ef4444; }
.m-guidance ul {
  margin: 0.25rem 0 0; padding-left: 1.1rem;
}
.m-guidance li {
  margin: 0.25rem 0; font-size: 0.92rem; line-height: 1.4;
}
.m-guidance li strong { color: #fde68a; }


/* Historic NWS warnings (mobile) - mirrors the agent ops feed */
.m-historic-feed {
  background: #0e1116; border: 1px solid #2a313c; border-radius: 6px;
  padding: 0.45rem 0.55rem;
  min-height: 260px; max-height: 260px; flex-shrink: 0; overflow-y: scroll;
  font-size: 0.85rem;
}
.m-historic-feed .m-empty { text-align: center; padding: 0.6rem 0; }
.m-hist-row {
  display: flex; gap: 0.45rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed #1f242c;
}
.m-hist-row:last-child { border-bottom: none; }
.m-hist-time {
  color: #6b7280; font-variant-numeric: tabular-nums;
  font-size: 0.74rem; white-space: nowrap; padding-top: 0.1rem;
  flex: 0 0 auto;
}
.m-hist-msg {
  flex: 1 1 auto; min-width: 0;
  color: #e7eaf0; word-wrap: break-word; line-height: 1.35;
}
.m-hist-event {
  display: inline-block; margin-right: 0.35rem;
  font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fecaca; background: #3f1d1d; padding: 0 0.35rem; border-radius: 3px;
}
.m-hist-event.watch { color: #fde68a; background: #3a2f10; }
.m-hist-area { color: #9ca3af; font-size: 0.78rem; margin-top: 0.15rem; }


/* Mobile community SAFE SHELTER AREA share controls */
.m-share-shelter-btn {
  display: block; width: 100%; margin-top: 0.6rem;
  background: #f4a259; color: #161b22;
  border: 1px solid #f4a259; border-radius: 8px;
  padding: 0.65rem 0.7rem;
  font-size: 0.92rem; font-weight: 700; cursor: pointer;
}
.m-share-shelter-btn:active { background: #e08e3a; border-color: #e08e3a; }
.m-share-shelter-btn:disabled { opacity: 0.6; cursor: progress; }
.m-share-shelter-status {
  margin-top: 0.4rem; min-height: 1em;
  font-size: 0.82rem; color: #9ca3af; font-style: italic;
}
.m-share-shelter-status.success { color: #86efac; font-style: normal; }
.m-share-shelter-status.error   { color: #fecaca; font-style: normal; }

.m-shelter.safe { background: #052e16; border-color: #22c55e; }
.m-shelter.safe .title { color: #86efac; }


/* Mobile collapsible Indoor/Outdoor guidance */
.m-guidance-details {
  border: 1px solid #2a313c; background: #1f242c;
  border-radius: 10px; margin-bottom: 0.55rem; overflow: hidden;
}
.m-guidance-details > summary {
  list-style: none; cursor: pointer;
  padding: 0.7rem 0.85rem;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 0.98rem; color: #f4a259;
  user-select: none;
}
.m-guidance-details > summary::-webkit-details-marker { display: none; }
.m-guidance-details > summary::after {
  content: "▾"; transition: transform 0.18s ease; color: #9ca3af;
}
.m-guidance-details[open] > summary::after { transform: rotate(180deg); }
.m-guidance-details.warn > summary { color: #ef4444; }
.m-guidance-details .m-guidance-summary-meta {
  font-weight: 500; color: #9ca3af; font-size: 0.78rem;
  margin-left: auto; margin-right: 0.4rem; font-style: italic;
}
.m-guidance-details > .m-guidance-body {
  padding: 0.6rem 0.85rem 0.85rem; border-top: 1px solid #2a313c;
}
.m-guidance-details > .m-guidance-body ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.m-guidance-details > .m-guidance-body li {
  margin: 0.25rem 0; font-size: 0.92rem; line-height: 1.4;
}
.m-guidance-details > .m-guidance-body li strong { color: #fde68a; }
