/* SPDX-License-Identifier: LicenseRef-Skylight-Proprietary */
/* Copyright (c) 2026 Problem Assassins, LLC. See license.md. */
/* Skylight brand tokens, copied as they are from brand.json: the logo's own colours, the UI roles, map colours, radius and fonts. */
:root {
  --logo-sky: #ABCFE5;
  --logo-gold: #F1BE52;
  --logo-gold-on-cream: #FAC95C;
  --logo-cream: #F7ECCC;
  --logo-purple: #391A5C;
  --logo-frame-light: #DCE8F0;
  --logo-frame-shadow: #BBCAD8;
  --logo-outline-mark: #000000;
  --logo-outline-word: #FFFFFF;
  --ui-text: #22123A;
  --ui-text-muted: #5E5670;
  --ui-heading: #391A5C;
  --ui-surface: #FFFFFF;
  --ui-canvas: #F2F7FB;
  --ui-sky-band: #ABCFE5;
  --ui-border: #D3E0EA;
  --ui-border-strong: #7F8FA0;
  --ui-primary: #391A5C;
  --ui-primary-hover: #4C2779;
  --ui-on-primary: #FFFFFF;
  --ui-accent: #F1BE52;
  --ui-on-accent: #22123A;
  --ui-focus-ring: #7B4FC0;
  --ui-success: #1E6B45;
  --ui-success-bg: #DDF2E6;
  --ui-warning: #7A4D00;
  --ui-warning-bg: #FBEFCF;
  --ui-danger: #A3231A;
  --ui-danger-bg: #FCE3E0;
  --ui-link-on-sky: #22123A;
  --map-person: #2B6CA3;
  --map-person-stroke: #FFFFFF;
  --map-leader: #391A5C;
  --map-leader-stroke: #F1BE52;
  --map-match-line: #A86E00;
  --map-match-line-casing: #FFFFFF;
  --map-unmatched: #6F7682;
  --map-unmatched-stroke: #FFFFFF;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Inter, self-hosted (SIL OFL, public/fonts/OFL-Inter.txt): the open face closest to the look Eric pointed us to */
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Variable-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Variable-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #F6F7F9;
  --surface: var(--ui-surface);
  --text: var(--ui-text);
  --heading: var(--ui-heading);
  --muted: var(--ui-text-muted);
  --line: #E3E7ED;
  --line-strong: var(--ui-border-strong);
  --accent: var(--ui-primary);
  --accent-hover: var(--ui-primary-hover);
  --accent-ink: var(--ui-on-primary);
  --focus: var(--ui-focus-ring);
  --warn: var(--ui-warning);
  --warn-bg: var(--ui-warning-bg);
  --ok: var(--ui-success);
  --ok-bg: var(--ui-success-bg);
  --error: var(--ui-danger);
  --error-bg: var(--ui-danger-bg);
  --radius: 12px;
  --nav-width: 232px;
  --nav-active-bg: #F1ECF8;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  /* the coloured frame around the app in the logo's sky, easing into a soft purple; the white page sits inside it */
  --frame: linear-gradient(90deg, var(--logo-sky) 0%, #BCC6EA 55%, #CDBFE6 100%);
  --frame-gap: 12px;
  --frame-radius: var(--radius-lg);
  --on-frame: var(--ui-text);
  --on-frame-hover: rgba(255, 255, 255, .55);
  font-family: var(--font-body);
  font-feature-settings: "cv11", "ss01";
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* the owner app grows with its page, so the sticky top bar stays put however far a long page scrolls */
body:has(> #app) { height: auto; min-height: 100%; }
body { background: var(--frame) var(--logo-sky); color: var(--text); font-size: 15px; line-height: 1.55; letter-spacing: -0.003em; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--heading); font-weight: 700; letter-spacing: -0.02em; }
h3, h4 { font-weight: 650; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.2em; }
[hidden] { display: none !important; }

.bar { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 56px; background: var(--frame) var(--logo-sky); position: sticky; top: 0; z-index: 1000; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: .2px; flex: none; }
/* Eric's wordmark as he sent it; 26px high keeps it above its 88px minimum width */
.brand img { display: block; height: 26px; width: auto; }
.title { color: var(--on-frame); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding-left: 12px; border-left: 1px solid rgba(34, 18, 58, .25); }
.bar .signout { flex: none; margin-left: auto; background: none; border: 0; color: var(--on-frame); min-height: 44px; min-width: 44px; padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.bar .signout:hover { color: var(--text); background: var(--on-frame-hover); }
.menu-btn { display: none; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -8px; border: 0; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
.menu-btn:hover { background: var(--on-frame-hover); }

/* The side menu: always beside the page on a wide screen, a drawer behind the Menu button below 960px */
.sidenav { position: fixed; top: 56px; left: 0; bottom: 0; width: var(--nav-width); z-index: 990; display: flex; flex-direction: column; gap: 2px; padding: 4px 12px 16px; background: transparent; overflow-y: auto; }
.sidenav button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: var(--on-frame); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; }
.sidenav button:hover { background: var(--on-frame-hover); color: var(--text); }
/* the tab you are on: a white pill with a gold edge from the logo */
.sidenav button[aria-current="page"] { background: var(--surface); color: var(--ui-primary); font-weight: 650; box-shadow: inset 3px 0 0 var(--logo-gold), 0 1px 2px rgba(34, 18, 58, .12); }
#nav:not([hidden]) ~ #app { margin-left: var(--nav-width); }
.nav-scrim { position: fixed; inset: 0; z-index: 1001; background: rgba(34, 18, 58, .32); }
@media (max-width: 959px) {
  .menu-btn:not([hidden]) { display: inline-flex; }
  .sidenav { top: 0; z-index: 1002; width: min(288px, 86vw); padding-top: 20px; background: linear-gradient(180deg, var(--logo-sky) 0%, #CDBFE6 100%) var(--logo-sky); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .sidenav.open { transform: none; visibility: visible; transition: transform .2s ease; }
  #nav:not([hidden]) ~ #app { margin-left: var(--frame-gap); }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 420px) { .title { padding-left: 8px; } }
@media (prefers-reduced-motion: reduce) { .sidenav, .sidenav.open { transition: none; } }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: #fff; font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:not(:disabled):not([aria-disabled="true"]):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:not(:disabled):not([aria-disabled="true"]):hover, .btn.quiet:not(:disabled):not([aria-disabled="true"]):hover { background: var(--bg); }
.btn.quiet:not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--line-strong); }
.btn.quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; }
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
textarea { min-height: 180px; resize: vertical; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }

.gate { display: grid; place-items: center; min-height: calc(100vh - 56px - var(--frame-gap)); padding: 16px; margin: 0 var(--frame-gap) var(--frame-gap); background: var(--surface); border-radius: var(--frame-radius); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 440px; box-shadow: var(--shadow-card); }
.card h1 { font-size: 20px; margin: 0 0 8px; }
.card form { margin-top: 12px; }
.card form .btn { margin-top: 12px; width: 100%; }

/* the shared map is the white page itself: inset in the frame, its tiles clipped to the rounded corners */
.viewer { position: relative; height: calc(100% - 56px - var(--frame-gap)); margin: 0 var(--frame-gap) var(--frame-gap); border-radius: var(--frame-radius); overflow: hidden; background: var(--surface); isolation: isolate; }
#map, .map { width: 100%; height: 100%; }
.panel { position: absolute; top: 12px; right: 12px; z-index: 900; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: 260px; max-width: calc(100% - 24px); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.panel-toggle { width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.panel.closed .layers { display: none; }
.layers { padding: 0 8px 8px; max-height: 50vh; overflow: auto; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; margin: 0; font-weight: 500; cursor: pointer; border-radius: 6px; }
.layer-row input { width: 18px; height: 18px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* sign-up */
a.brand { color: inherit; text-decoration: none; }
.card.wide { max-width: 560px; }
.card h2 { font-size: 16px; margin: 24px 0 4px; }
.card p { margin: 8px 0; }
.card .alt { margin: 16px 0 0; text-align: center; }
.field-error { color: var(--error); font-size: 13px; margin: 4px 0 0; }
.field-error:empty { display: none; }
input[aria-invalid="true"] { border-color: var(--error); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-weight: 600; }
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow input { flex: 1; min-width: 0; }
.copyrow .btn { flex: none; min-width: 84px; min-height: 44px; }
/* a long value (a URL or a key) in its own bordered box, broken anywhere so it never widens the page */
.codebox { display: block; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; overflow-wrap: anywhere; word-break: normal; max-width: 100%; }
textarea.codebox { min-height: 44px; height: auto; resize: none; field-sizing: content; }
.keytable td:first-child { white-space: nowrap; width: 1%; }
.mono-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--bg); text-overflow: ellipsis; }
.btn.full { width: 100%; margin-top: 24px; }
@media (max-width: 640px) {
  .keytable tr, .keytable td { display: block; width: auto; }
  .keytable td:first-child { border-bottom: 0; padding-bottom: 0; font-weight: 600; }
  .keytable .mono { display: block; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; }
}
@media (max-width: 420px) {
  .copyrow { flex-direction: column; }
  .copyrow .btn { width: 100%; }
}

/* owner app */
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
/* the owner app's page: white with rounded corners, inset in the coloured frame beside the side menu */
#app.wrap { max-width: none; min-height: calc(100vh - 56px - var(--frame-gap)); margin: 0 var(--frame-gap) var(--frame-gap); background: var(--surface); border-radius: var(--frame-radius); box-shadow: 0 1px 3px rgba(34, 18, 58, .10); }
#app.wrap > section { max-width: 1100px; }
@media (min-width: 960px) { #app.wrap { padding: 28px 32px 56px; } #nav:not([hidden]) ~ #app.wrap { margin-left: var(--nav-width); } }
@media (max-width: 959px) { :root { --frame-gap: 8px; } }
@media (max-width: 480px) { :root { --frame-gap: 5px; --frame-radius: 12px; } #app.wrap { padding: 16px 12px 40px; } }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile h2, .section h2 { font-size: 16px; margin: 0 0 8px; }
.stat { font-size: 28px; font-weight: 700; }
.section { margin-top: 24px; }
.next { border-left: 4px solid var(--warn); background: var(--warn-bg); }
.list { display: grid; gap: 12px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-card); }
.item header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.item .meta { color: var(--muted); font-size: 13px; }
.item .from { margin: 8px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.item pre { white-space: pre-wrap; font: inherit; background: var(--bg); padding: 12px; border-radius: 8px; margin: 12px 0; }
.item .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 17px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--bg); color: var(--muted); text-transform: capitalize; letter-spacing: .02em; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill.pending, .pill.approved { background: var(--warn-bg); color: var(--warn); }
.pill.escalated { background: var(--error-bg); color: var(--error); }
.pill.sent { background: var(--ok-bg); color: var(--ok); }
.mailnote { margin: 6px 0; font-size: 14px; color: var(--warn); }
.mailnote.failed { font-weight: 700; }
.item .actions .btn { min-height: 44px; }
.item.just { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn); }
.item.focused { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.history > summary { cursor: pointer; padding: 11px 0; min-height: 44px; font-weight: 600; }
#unsentWrap h2, #unsureWrap h2 { margin-bottom: 4px; }
.item .confirm { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.item .confirm .mailnote { margin: 0 0 8px; }
/* the real control sits on the right, away from the button that opened the box */
.item .confirm .actions { justify-content: flex-end; }
.links { list-style: none; margin: 12px 0 0; padding: 0; }
.links li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.links .who { flex: 0 0 auto; max-width: 100%; overflow-wrap: anywhere; }
.links a { flex: 1 1 240px; min-width: 0; min-height: 44px; display: inline-flex; align-items: center; overflow-wrap: anywhere; word-break: break-all; }
#nextUp a { min-height: 44px; display: inline-flex; align-items: center; }
.links .btn { flex: none; }
.reason { color: var(--warn); font-weight: 500; }
.guess { margin: 8px 0 0; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.guess .src { display: block; margin-top: 2px; font-style: italic; }
.item .actions .why { flex: 1 1 220px; width: auto; min-width: 0; min-height: 44px; }
.trace { margin-top: 12px; border-top: 1px solid var(--line); min-width: 0; }
.trace summary { cursor: pointer; padding: 12px 0; min-height: 44px; color: var(--muted); font-weight: 600; font-size: 14px; }
.trace[open] summary { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.trace ol { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.trace ol > li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; }
.trace .n { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.trace .what { overflow-wrap: anywhere; min-width: 0; }
.trace .tool { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.trace .res { color: var(--muted); }
.trace li.warn .what { color: var(--warn); }
.trace li.end .what { font-weight: 600; }
.trace li.end .res { font-weight: 400; }
.trace ul { margin: 4px 0 0; padding-left: 18px; }
.mapbox { height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
/* Maps sub tabs: Territories and Published maps, a segmented control at the top of Maps */
.subtabs { display: flex; gap: 4px; max-width: 100%; margin: 0 0 16px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); width: fit-content; }
.subtabs [role="tab"] { flex: 1 1 auto; min-height: 44px; min-width: 44px; padding: 8px 18px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.subtabs [role="tab"]:hover { background: var(--bg); color: var(--text); }
.subtabs [role="tab"][aria-selected="true"] { background: var(--nav-active-bg); color: var(--ui-primary); font-weight: 600; }
@media (max-width: 420px) { .subtabs { width: 100%; } .subtabs [role="tab"] { padding: 8px 10px; } }

/* people map (Maps, then Published maps) */
.peoplemap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.pm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-bottom: 8px; }
.pm-bar h2 { font-size: 16px; margin: 0; }
.pm-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.pm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pm-legend i { display: inline-block; flex: none; }
.k-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--map-unmatched); }
.k-new { width: 14px; height: 14px; border-radius: 50%; background: var(--map-person); border: 2px solid var(--map-person-stroke); box-shadow: 0 0 0 1px var(--map-person); }
.k-pin { width: 12px; height: 12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--map-leader); border: 2px solid var(--map-leader-stroke); }
.k-line { width: 22px; height: 3px; background: var(--map-match-line); border-radius: 2px; }
.k-line.done { height: 2px; background: var(--map-unmatched); }
.pm-pick { width: auto; max-width: 100%; margin-left: auto; flex: 0 1 18rem; min-width: 0; }
.pm-pick + .pm-toggle { margin-left: 0; }
.pm-row.pick { border-left-color: var(--map-halo, #7B4FC0); }
.pm-popgroups { display: grid; gap: 6px; margin-top: 8px; }
.pm-popgroups .btn { width: 100%; font-size: 13px; }
.pm-toggle { margin: 0 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; font-weight: 600; cursor: pointer; }
.pm-toggle input { width: 20px; height: 20px; margin: 0; }
.pm-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.pm-map { height: 560px; }
.pm-side { height: 560px; overflow: auto; padding: 0 4px 0 0; min-width: 0; }
.pm-side h3 { font-size: 15px; margin: 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.pm-side h3.pm-off { margin-top: 20px; }
.pm-side h3 .count { margin: 0; font-weight: 600; }
.pm-side h4 { font-size: 14px; margin: 16px 0 6px; }
.pm-rows { display: grid; gap: 6px; }
.pm-row { display: grid; gap: 0; width: 100%; padding: 0 12px 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--map-person); border-radius: 8px; }
.pm-row.escalated { border-left-color: var(--error); }
.pm-row:hover, .pm-row:focus-within { border-color: var(--accent); border-left-color: inherit; }
.pm-row.escalated:hover, .pm-row.escalated:focus-within { border-left-color: var(--error); }
.pm-pick { display: grid; gap: 2px; text-align: left; width: 100%; min-height: 44px; padding: 8px 0 2px; background: none; color: inherit; border: 0; font: inherit; cursor: pointer; }
.pm-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* A status that says a draft is waiting on you: a link to that card in Approvals, big enough to tap. */
.status-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.status-link.pending { color: var(--warn); }
.status-link.escalated { color: var(--error); }
.status-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pm-rowstatus { font-size: 13px; justify-self: start; }
.needrows .status-link { color: var(--accent); font-weight: 500; }
.pm-name { font-weight: 600; overflow-wrap: anywhere; }
.pm-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.pm-back { margin-bottom: 8px; }
.pm-side .actions { margin: 8px 0 4px; }
.pm-status { margin: 0 0 6px; font-weight: 600; color: var(--warn); }
.pm-status.escalated { color: var(--error); }
.pm-status.sent { color: var(--ok); }
.pm-ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: rank; }
.pm-ranked li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; counter-increment: rank; }
.pm-ranked li::before { content: counter(rank); color: var(--muted); grid-row: span 2; }
.pm-ranked li .pm-sub { grid-column: 2; }
.pm-ranked li .pm-mi { grid-column: 3; grid-row: 1; font-variant-numeric: tabular-nums; font-weight: 600; }
.pm-ranked li.chosen { border-color: var(--accent); }
.pm-pin { background: none; border: 0; }
.pm-pin span { position: absolute; left: 9px; top: 6px; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--map-leader); border: 2px solid var(--map-leader-stroke); box-shadow: 0 2px 6px rgba(34,18,58,.28); }
.pm-pin span::after { content: ""; position: absolute; left: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--map-leader-stroke); }
.leaflet-tooltip.pm-label { font-size: 12px; font-weight: 600; line-height: 1.3; padding: 3px 8px; }
.pm-nolabels .leaflet-tooltip.pm-label, .pm-nomiles .leaflet-tooltip.pm-miles { display: none; }
/* A person's pin: a dot inside a wider target, so it can be tapped and reached with the keyboard. */
.pp-dot { background: none; border: 0; display: grid; place-items: center; border-radius: 50%; }
.pp-dot span { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--map-unmatched); border: 1.5px solid var(--map-unmatched-stroke); box-shadow: 0 0 0 .5px rgba(34,18,58,.3), 0 1px 2px rgba(34,18,58,.15); }
.pp-dot.new span, .pp-dot.escalated span { width: 18px; height: 18px; border: 2px solid var(--map-person-stroke); background: var(--map-person); box-shadow: 0 0 0 4px rgba(43,108,163,.18), 0 1px 3px rgba(34,18,58,.3); }
.pp-dot.escalated span { background: var(--ui-danger); }
.pp-dot:focus-visible, .pm-pin:focus-visible { outline: 3px solid var(--ui-focus-ring); outline-offset: 0; }
.pp-popup .leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.4; }
.pp { display: grid; gap: 4px; min-width: 0; }
.pp p { margin: 0; overflow-wrap: anywhere; }
.pp-name { font-size: 15px; color: var(--ui-heading); }
.pp-addr { color: var(--muted); }
.pp-k { font-weight: 600; }
.pp-k::after { content: ":"; }
.pp-contact { display: grid; }
.pp-popup a.pp-link { display: flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; text-decoration: underline; overflow-wrap: anywhere; }
.pp .pm-status { margin: 0; }
.pp-new { color: var(--muted); }
.terr-legend { margin: 0 0 8px; }
.pp-popup .pp-group { width: 100%; min-height: 44px; font-size: 13px; margin-top: 6px; }
.leaflet-tooltip.pm-miles { font-size: 11px; font-weight: 700; padding: 1px 5px; color: var(--text); border-color: var(--line); box-shadow: none; }
@media (max-width: 860px) {
  .pm-body { grid-template-columns: minmax(0, 1fr); }
  .pm-map { height: 400px; }
  .pm-side { height: auto; overflow: visible; padding: 0; }
  .pm-pick { flex: 1 1 100%; margin-left: 0; }
}
/* beside the side menu the page is narrower, so the list sits under the map until there is room for both */
@media (min-width: 960px) and (max-width: 1180px) {
  .pm-body { grid-template-columns: minmax(0, 1fr); }
  .pm-side { height: auto; overflow: visible; padding: 0; }
}
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--bg); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
/* owner app: with nine tabs the row no longer fits beside the wordmark and church name below this width, so the tabs go under it */
@media (max-width: 1100px) {
  .appbar { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .appbar .title { flex: 1 1 0; min-width: 0; }
  .appbar nav { margin-left: 0; width: 100%; flex-wrap: wrap; overflow-x: visible; }
}
@media (max-width: 640px) {
  .bar { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .bar nav { margin-left: 0; width: 100%; }
  /* owner app: the tabs wrap under the name so every one is on screen */
  .appbar .title { flex: 1 1 0; min-width: 0; }
  .appbar nav { flex-wrap: wrap; overflow-x: visible; gap: 4px; }
  .appbar nav button { padding: 8px 10px; }
  .viewer { height: calc(100% - 96px - var(--frame-gap)); }
  .mapbox { height: 380px; }
}
.routine h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.routine-when { margin: 2px 0 0; }
.routine-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.routine-what { margin: 12px 0 0; max-width: 44rem; }
.routine .routine-miles { margin-top: 16px; }
.lastrun { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 14px; overflow-wrap: anywhere; }
.lastrun.failed { color: var(--error); font-weight: 600; }
.readingnote { margin: 0 0 8px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; font-size: 14px; max-width: 40rem; overflow-wrap: anywhere; }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 4px; font-weight: 600; cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.docs { max-width: 44rem; }
.docs h1 { margin-top: 0; }
.docs h2 { margin: 28px 0 8px; font-size: 18px; }
.docs p, .docs li { line-height: 1.55; }
.docs-rule { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 36px; }
.docs-rule li + li { margin-top: 6px; }
.docs table { margin: 8px 0; background: var(--surface); }
.routines-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.routines-head h2 { margin: 0; }
.routine-new { margin-bottom: 12px; }
.routine-new h3 { margin-bottom: 4px; }
.routine-new #rnName { width: 100%; max-width: 40rem; min-height: 44px; }
.routine-new .routine-miles-row #rnKind { flex: 0 1 auto; max-width: 100%; }
.routine-new .routine-miles-row input, .routine-new .routine-miles-row select { min-height: 44px; }
.routine-sched { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.routine-sched legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.routine-sched .toggle.check { display: flex; width: fit-content; max-width: 100%; font-weight: 400; margin: 4px 0 0; }
.routine-sched label.sub { margin: 0 0 6px; font-weight: 400; }
.routine-sched [data-w="text"] { display: block; width: 100%; max-width: 28rem; min-height: 44px; font: inherit; }
.whenback { margin: 8px 0 0; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; font-size: 14px; max-width: 40rem; overflow-wrap: anywhere; }
.whenback.error { border-left-color: var(--error); color: var(--error); font-weight: 600; }
.whenback:empty { display: none; }
.whenhint { margin: 6px 0 0; font-size: 14px; max-width: 40rem; }
.readingnote.warn { border-left-color: var(--warn); }
.routine-more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
.routine-more > summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; color: var(--accent); width: fit-content; }
.routine-more > summary::-webkit-details-marker { display: none; }
.routine-more > summary::before { content: ""; width: 0; height: 0; margin-right: 10px; border-left: 6px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .15s; }
.routine-more[open] > summary::before { transform: rotate(90deg); }
.routine-new .routine-rule > .muted { max-width: 40rem; }
.routine-new .routine-rule textarea { min-height: 8rem; }
.routine-tz { margin: 0 0 12px; }
.routine-tz a { display: inline-flex; align-items: center; min-height: 44px; }
.churchset .cs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.churchset .cs-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.churchset .cs-label { font-size: .85rem; color: var(--muted); }
.churchset .cs-form { display: grid; gap: 8px; max-width: 480px; margin: 4px 0 8px; }
.churchset .cs-form input, .churchset .cs-form select { min-height: 44px; width: 100%; }
.churchset .cs-form .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.churchset .btn { min-height: 44px; }
.churchset .cs-data { border-top: 1px solid var(--ui-border); margin-top: 12px; padding-top: 8px; }
.churchset .cs-data h3 { font-size: 1rem; margin: 4px 0; }
.churchset .cs-data .toggle.check { display: flex; width: fit-content; max-width: 100%; }
.churchset .cs-help { margin: 0 0 8px 34px; font-size: .9rem; }
.churchset .cs-confirm { border: 1px solid var(--error); background: var(--error-bg); border-radius: 10px; padding: 12px; margin-top: 8px; max-width: 560px; }
.churchset .cs-confirm p { margin: 6px 0 10px; }
.churchset .cs-confirm .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.churchset .cs-confirm .btn.quiet { background: var(--ui-surface); }
.btn.danger:not(.secondary) { background: var(--error); border-color: var(--error); color: #fff; }
.btn.secondary.danger { color: var(--error); border-color: var(--error); }
.routine-new > .actions, .routine-delete .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.routine-delete { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.routine-delete > .actions { margin-top: 0; }
.routine-delete .confirm .go { background: var(--error); border-color: var(--error); }
@media (max-width: 480px) { .routine-new > .actions .btn, .routine-delete .actions .btn, .routines-head .btn { width: 100%; } }
.routine-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.routine-top > div { flex: 1 1 220px; min-width: 0; }
.routine-miles { margin-top: 4px; }
.routine-miles-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.routine-miles-row input { flex: 0 1 12rem; min-width: 8rem; }
.routine-miles-row select { flex: 0 1 20rem; min-width: 0; max-width: 100%; min-height: 44px; }
.routine-rule textarea { display: block; width: 100%; max-width: 40rem; min-height: 6.5rem; margin-bottom: 8px; font: inherit; resize: vertical; }
.routine-miles .muted { margin: 6px 0 0; font-size: 14px; }
.runnote { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 14px; overflow-wrap: anywhere; }
.runnote.busy { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.runnote.failed { color: var(--error); font-weight: 600; }
.spin { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.subhead { margin-top: 12px; scroll-margin-top: 12px; }
.subhead h2 { margin-bottom: 4px; }
.subhead p { margin: 0; }
#unsentWrap, #unsureWrap { scroll-margin-top: 12px; }
.guess .far { display: block; margin-top: 4px; color: var(--warn); }
/* Home and Approvals (next-action Home, collapsed approval cards) */
.syncline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.syncline .muted:empty { display: none; }
.homehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.homehead h1 { font-size: 22px; margin: 0; }
.homehead p { margin: 2px 0 0; }
.homehead p:empty { display: none; }
.needs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.needs h2 { font-size: 16px; margin: 0 0 4px; }
.needs > p { margin: 0; }
.needrows { list-style: none; margin: 0; padding: 0; }
.needrows li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.needrows li:first-child { border-top: 0; }
.needlabel { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.needrows .chip { flex: none; }
.needrows .chip.count { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.needrows .btn { flex: none; min-width: 96px; }
@media (min-width: 900px) { .needs { max-width: 66.666%; } }
details.item.draft { padding: 0; }
details.item.draft > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border-radius: var(--radius); }
details.item.draft > summary::-webkit-details-marker { display: none; }
details.item.draft > summary > header { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
details.item.draft > summary::after { content: ""; flex: none; width: 10px; height: 10px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); }
details.item.draft[open] > summary::after { transform: rotate(-135deg) translateY(-3px); }
details.item.draft > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.item.draft[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.draft-body { padding: 4px 16px 16px; }
.sm-layer { display: flex; align-items: center; gap: 8px; }
.sm-layer i { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 3px; }
.sm-items { margin: 0 0 8px; padding-left: 22px; }
.sm-items li { padding: 2px 0; overflow-wrap: anywhere; }
.leaflet-tooltip.terr-label { font-size: 12px; font-weight: 700; line-height: 1.3; padding: 2px 6px; background: rgba(255,255,255,.88); border-color: transparent; box-shadow: none; color: var(--text); white-space: nowrap; }
.leaflet-tooltip.terr-label::before { display: none; }
.privshare { margin-top: 12px; }
.privshare label { display: block; font-weight: 600; margin-bottom: 6px; }
.privshare p:empty { display: none; }
.privshare p { margin: 8px 0 0; }
.terr-label .tl-short { display: none; }
@media (max-width: 600px) {
  .terr-label .tl-full { display: none; }
  .terr-label .tl-short { display: inline; }
}

/* People page: everyone synced, a search box, and a tap that opens the person on the map. */
.pl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.pl-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.pl-head h2 .count { margin: 0; font-size: 15px; font-weight: 600; }
.pl-pick { flex: 0 1 260px; width: auto; min-width: 0; max-width: 100%; margin-left: auto; }
.pl-search { flex: 1 1 260px; max-width: 420px; margin-left: auto; }
.pl-pick + .pl-search { margin-left: 0; }
.pl-rows { display: grid; gap: 6px; }
.pl-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, .8fr); gap: 4px 16px; align-items: center; text-align: left; width: 100%; min-height: 44px; padding: 10px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--map-unmatched); border-radius: 8px; font: inherit; }
button.pl-row { cursor: pointer; }
button.pl-row:hover, button.pl-row:focus-visible { border-color: var(--accent); }
.pl-row.leader { border-left-color: var(--map-leader); }
.pl-row.pending { border-left-color: var(--map-person); }
.pl-row.escalated { border-left-color: var(--error); }
.pl-row.member { border-left-color: var(--ok); }
.pl-row.off { background: var(--bg); }
.pl-status { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.pl-status.leader { color: var(--heading); font-weight: 600; }
.pl-status.pending { color: var(--warn); font-weight: 600; }
.pl-status.escalated { color: var(--error); font-weight: 600; }
.pl-more { margin-top: 12px; }
.pl-more .btn { width: 100%; }
button.pl-row.off { background: var(--bg); }
.pl-empty h3 { margin: 0 0 4px; }
.pl-empty .btn { margin-top: 12px; }
.pl-back { margin-bottom: 12px; }
.pl-card-head { align-items: flex-start; margin-bottom: 8px; }
.pl-card-head h2 { margin: 0; }
.pl-card-head .pl-status { margin: 4px 0 0; }
.pl-fields { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 0 20px; margin: 0; }
.pl-field { display: contents; }
.pl-field dt, .pl-field dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); min-height: 44px; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; overflow-wrap: anywhere; }
.pl-field dt { color: var(--muted); font-size: 14px; }
.pl-field dd a { display: inline-flex; align-items: center; min-height: 44px; }
.linkbtn { background: none; border: 0; padding: 0; margin: 0; min-height: 44px; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; }
.pl-notes { margin: 0; padding-left: 20px; }
.pl-notes li { margin-bottom: 6px; }
@media (max-width: 640px) {
  .pl-fields { grid-template-columns: minmax(0, 1fr); }
  .pl-field dt { padding-bottom: 0; min-height: 0; border-top: 1px solid var(--line); }
  .pl-field dd { border-top: 0; padding-top: 2px; }
  .pl-card-head .btn { width: 100%; }
  .pl-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pl-search { max-width: none; margin-left: 0; }
  .pl-pick { flex: 1 1 100%; margin-left: 0; }
}

/* Accounts: add, reset, remove, link to a territory. */
.acctform { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; align-items: end; }
.acctform .actions { grid-column: 1 / -1; margin-top: 16px; }
/* A label with its (?) beside it: the 44 px (?) sits in the label's own line height, so fields stay level. */
.labelrow { display: flex; align-items: center; gap: 2px; margin: 12px 0 6px; }
.labelrow label { margin: 0; }
.labelrow .helptip { margin: -12px 0; }
.acct { padding: 12px 0; border-bottom: 1px solid var(--line); }
.acct:last-child { border-bottom: 0; }
.acct-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.acct-top > div { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.acct p { margin: 6px 0; }
.acct .actions { margin-top: 8px; }
.acct-reset { margin-top: 4px; }
.acct-edit { margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.acct-edit select:disabled { opacity: .7; }
.acct-pass { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; margin: 12px 0 0; padding: 8px 12px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.acct-pass legend { font-weight: 700; color: var(--heading); padding: 0 4px; }
.acct-pass p, .acct-edit .acct-hint { grid-column: 1 / -1; }
.acct-edit .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.item.person { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.item.person a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
/* Email an area (Maps page): draw or pick an area, then write to the people inside. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.areaemail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.ae-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.ae-head h2 { margin: 0 0 4px; }
.ae-head p { margin: 0; max-width: 60ch; }
.ae-start { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ae-start .ae-terrlabel { margin: 0; font-weight: 400; }
.ae-start select { width: auto; min-width: 220px; max-width: 100%; }
.ae-drawing { margin-top: 12px; padding: 12px; border: 2px dashed var(--ui-focus-ring); border-radius: var(--radius-md); }
.ae-hint { margin: 0 0 8px; font-weight: 600; }
.ae-drawing .actions, .ae-compose .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ae-drawcursor, .ae-drawcursor .leaflet-interactive { cursor: crosshair; }
.ae-picked { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; margin-top: 16px; }
.ae-who h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.ae-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 420px; overflow: auto; }
.ae-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ae-pname { display: flex; flex-direction: column; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.ae-sub { font-weight: 400; font-size: 13px; color: var(--muted); }
.ae-list .btn { flex: none; }
.ae-modes { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.ae-modes legend { font-weight: 700; margin-bottom: 6px; color: var(--heading); }
.ae-mode { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }
.ae-mode:has(input:checked) { border-color: var(--ui-primary); box-shadow: 0 0 0 1px var(--ui-primary); }
.ae-mode input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.ae-mode > span { display: flex; flex-direction: column; gap: 2px; }
.ae-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ae-wide { grid-column: 1 / -1; }
textarea.ae-short { min-height: 80px; }
.ae-result { margin-top: 16px; }
.ae-done-card h3 { margin-top: 0; }
@media (max-width: 1100px) { .ae-picked { grid-template-columns: 1fr; } .ae-list { max-height: 320px; } }
@media (max-width: 560px) { .ae-fields { grid-template-columns: 1fr; } .ae-start, .ae-start .btn, .ae-start select, .ae-start .ae-terrlabel { width: 100%; } }
/* While drawing, every tap on the map places a corner, even on a pin, a label or a dot. */
.ae-drawcursor .leaflet-marker-icon, .ae-drawcursor .leaflet-tooltip, .ae-drawcursor .leaflet-overlay-pane canvas, .ae-drawcursor .leaflet-overlay-pane svg { pointer-events: none; }

/* Reassign a person (person page and Approvals card) */
.pl-field dd .pl-reassign { margin-left: auto; min-height: 44px; }
.pl-field dd .pl-assigned { margin-right: 12px; }
.pl-reassign-box, .reassign-box { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.reassign-form { display: grid; gap: 8px; }
.reassign-form label { font-weight: 600; }
.reassign-form .ra-note { margin: 0; }
.reassign-form .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reassign-form .actions .btn { min-height: 44px; }
.ra-done { margin: 0; }
@media (max-width: 600px) {
  .pl-field dd .pl-reassign { margin-left: 0; margin-top: 8px; width: 100%; }
  .reassign-form .actions .btn, .item .actions .reassign { width: 100%; }
}
/* A person handed to you to decide (Approvals): the person, why, and the suggested leader */
.decide-note { white-space: pre-wrap; margin: 8px 0 12px; }
.decide { padding: 12px 0; border-top: 1px solid var(--line); }
.decide:first-of-type { border-top: 0; }
.decide p { margin: 0 0 8px; }
.decide-suggest { font-weight: 600; }
.decide .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.decide .actions .why { flex: 1 1 220px; min-height: 44px; }
@media (max-width: 600px) { .decide .actions .btn, .decide .actions .why { width: 100%; flex-basis: 100%; } }
/* Activity: one line per action, the time on the right (under it on a phone) */
.acthead { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; }
.acthead h1 { margin: 0; }
.seg { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.seg .btn.secondary[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"]) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.activity { list-style: none; margin: 16px 0 0; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.activity:empty { display: none; }
.activity li { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity li span { flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.activity time { color: var(--muted); font-size: 13px; white-space: nowrap; }
#activityMore { margin-top: 16px; }

/* Writing to one person: Email them, or Ask the person responsible to reach out (person page and map preview). */
.pe-actions { margin-top: 16px; }
.pe-choices { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.pe-choice { display: flex; flex-direction: column; min-width: 0; }
.pe-choice .btn { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.pe-why { margin: 4px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.pe-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.pe-form h3, .pe-done h3 { margin: 0 0 4px; }
.pe-form label { display: block; margin-top: 12px; font-weight: 600; }
.pe-form input, .pe-form textarea { width: 100%; box-sizing: border-box; min-height: 44px; font: inherit; }
.pe-form .actions, .pe-done .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pp-email { margin: 8px 0 4px; }
.pp-email .pe-choices { flex-direction: column; gap: 6px; }
.pp-email .btn { width: 100%; box-sizing: border-box; font-size: 14px; padding: 8px 10px; }
.pp-popup a.btn, .pp-popup a.btn:hover { color: var(--accent); text-decoration: none; }
.pp-popup .pe-why { font-size: 13px; margin: 2px 0 0; }
@media (max-width: 640px) {
  .pe-choices { flex-direction: column; }
  .pe-choice .btn, .pe-form .actions .btn, .pe-done .actions .btn { width: 100%; }
}

/* Webhooks for your assistant (Connect tab) */
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--error-bg); color: var(--error); }
.pill.off { background: var(--bg); color: var(--muted); }
.hook { border-top: 1px solid var(--line); padding: 12px 0; }
.hook-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.hook-url { overflow-wrap: anywhere; min-width: 0; font-weight: 600; }
.hook-events-line { margin: 6px 0; }
.hook-deliveries { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.hook-deliveries li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.hook-deliveries li > span:nth-child(2) { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.hook-secret { margin: 8px 0; }
.hook-add { border-top: 1px solid var(--line); padding-top: 12px; }
.hook-events { border: 0; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; }
.hook-events legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.hook-events label { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 400; cursor: pointer; }
.hook-events input { width: 20px; height: 20px; flex: none; }

/* the (?) next to a control: opens on hover, tap, click or Enter/Space; 44px to tap, a 28px circle to see */
.helptip { position: relative; display: inline-flex; align-items: center; }
.helptip-btn { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 700; color: var(--accent); }
.helptip-btn::before { content: ''; position: absolute; z-index: -1; width: 28px; height: 28px; border: 1px solid var(--accent); border-radius: 50%; }
.helptip-btn:hover::before, .helptip-btn[aria-expanded="true"]::before { background: var(--bg); }
.helptip-text { position: absolute; top: calc(100% + 4px); right: 0; z-index: 1000; width: max-content; max-width: min(320px, calc(100vw - 32px)); padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12); font-size: 14px; font-weight: 400; line-height: 1.4; }
.helptip-text[hidden] { display: none; }

/* Territories: add, rename, redraw, delete, assign (territories-admin.js) */
.ta { margin-top: 16px; display: grid; gap: 12px; }
.ta-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; background: var(--surface); }
.ta-form h3 { margin: 0; }
.ta-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; display: grid; gap: 0; }
.ta-field { display: grid; gap: 4px; max-width: 420px; }
.ta-field input, .ta-field select { min-height: 44px; }
.ta-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 400; cursor: pointer; }
.ta-form fieldset legend { font-weight: 600; padding: 0 4px; }
.ta-field label { margin: 0; }
.ta-check input { width: 22px; height: 22px; }
.ta-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ta-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.ta-info { display: grid; gap: 2px; min-width: 0; }
.ta-draw { margin-bottom: 12px; display: grid; gap: 8px; position: sticky; top: 0; z-index: 500; }
.ta-draw .ta-hint { margin: 0; }
.ta-corner { background: #391A5C; border: 3px solid #FFFFFF; border-radius: 50%; box-shadow: 0 0 0 1px #391A5C; }
@media (max-width: 600px) {
  .ta-row .ta-acts .btn, .ta-form .ta-acts .btn, .ta-draw .ta-acts .btn { flex: 1 1 40%; }
}
.ta-form .ta-err { margin: 0; }
.ta-form .ta-err:empty { display: none; }
.ta-loc { display: grid; gap: 12px; }

/* Maps: a quiet basemap with thin, refined controls, matching the rest of the app */
.leaflet-container { font-family: var(--font-body); background: #F5F7F8; }
/* every map is its own stacking context, so its panes and controls (Leaflet goes up to 1000) never paint over the top bar, the drawer or its scrim */
.leaflet-container { isolation: isolate; z-index: 0; }
.leaflet-control-attribution { white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .leaflet-control-attribution { font-size: 10px; padding: 0 4px; } }
.leaflet-bar { border: 1px solid var(--line) !important; border-radius: 10px !important; box-shadow: var(--shadow-card) !important; overflow: hidden; }
.leaflet-bar a { width: 36px !important; height: 36px !important; line-height: 34px !important; color: var(--text) !important; border-bottom-color: var(--line) !important; font-weight: 500; }
.leaflet-touch .leaflet-bar a { width: 44px !important; height: 44px !important; line-height: 42px !important; }
.leaflet-bar a:hover { background: var(--bg) !important; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); border: 1px solid var(--line); }
.leaflet-popup-content { font-size: 14px; line-height: 1.5; }
.leaflet-popup-tip { box-shadow: none; border: 1px solid var(--line); }
.leaflet-control-attribution { font-size: 11px; color: var(--muted); background: rgba(255, 255, 255, .85) !important; border-top-left-radius: 8px; }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-tooltip { font-family: var(--font-body); border-radius: 8px; border-color: var(--line); box-shadow: var(--shadow-card); }

/* ---------- Skylight Agent (agent-chat.js) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[data-panel="agent"] { max-width: 820px; }
[data-panel="agent"] > h1 { margin: 0 0 4px; }
[data-panel="agent"] > p.muted { margin: 0 0 16px; }
.agent-log { display: grid; gap: 12px; margin-bottom: 12px; }
.agent-log:empty { display: none; }
.agent-you { justify-self: end; max-width: 85%; background: var(--nav-active-bg); color: var(--text); border-radius: var(--radius) var(--radius) 4px var(--radius); padding: 10px 14px; }
.agent-you p { margin: 0; overflow-wrap: anywhere; }
.agent-turn { padding: 14px 16px; }
.agent-who { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-primary); margin-bottom: 6px; }
.agent-steps { margin: 0 0 8px; }
.agent-steps summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.agent-steps ol { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 6px; }
.agent-step { display: flex; gap: 8px; align-items: baseline; font-size: 14px; line-height: 1.4; }
.agent-step-mark { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: #E6F4EA; color: #1E6B34; }
.agent-step.failed .agent-step-mark { background: #FCE8E6; color: var(--error); }
.agent-answer { margin: 4px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.agent-working { margin: 4px 0 0; }
.agent-note { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--bg); border-radius: 4px; font-size: 14px; }
.agent-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.agent-links .btn { min-height: 44px; text-decoration: none; }
.agent-form { display: flex; gap: 8px; align-items: flex-end; }
.agent-form textarea { min-height: 52px; resize: vertical; flex: 1; }
.agent-form .btn { flex: none; min-width: 88px; min-height: 52px; }
.agent-new { margin-top: 8px; }
.agent-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.agent-example { min-height: 44px; padding: 10px 14px; text-align: left; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); cursor: pointer; line-height: 1.35; }
.agent-example:hover { border-color: var(--ui-primary); background: var(--nav-active-bg); }
.agent-can { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; }
.agent-group h3 { font-size: 14px; margin: 0 0 4px; }
.agent-group ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.agent-can:not(.all) li.more { display: none; }
.agent-can.all li.count { display: none; }
.agent-group li.count { list-style: none; margin-left: -18px; font-size: 13px; }
.agent-all { margin-top: 12px; }
.agent-hint { margin: -4px 0 8px; font-size: 14px; }
#agentEmpty h2 { font-size: 16px; margin: 20px 0 8px; }
@media (max-width: 640px) {
  .agent-examples { grid-template-columns: 1fr; }
  .agent-form { flex-direction: column; align-items: stretch; }
  .agent-form .btn { width: 100%; min-height: 44px; }
  .agent-you { max-width: 92%; }
}

/* Share links waiting for approval (share-approvals.js) */
#shareWaiting .subhead { margin-top: 24px; }
.share-wait h3 { margin: 0 0 8px; font-size: 1rem; overflow-wrap: anywhere; }
.share-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; }
.share-facts dt { color: var(--muted, #5b6472); }
.share-facts dd { margin: 0; overflow-wrap: anywhere; }
.share-wait .check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; margin: 0 0 8px; }
.share-wait .check input { width: 20px; height: 20px; }
@media (max-width: 480px) { .share-facts { grid-template-columns: 1fr; gap: 0; } .share-facts dd { margin-bottom: 8px; } .share-wait .actions .btn { flex: 1 1 auto; } }
.share-wait .error:empty { display: none; }
