/* Beistand web app: the same palette and type as the Android app. */
@font-face { font-family: "Atkinson"; src: url("/web/fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/web/fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #F5F4F0; --surface: #FFFFFF; --surface2: #EBE9E3; --seg-sel: #FFFFFF;
  --text: #16181D; --muted: #545A64; --line: #DDD9D0;
  --accent: #0F766E; --accent-text: #0F766E; --accent-soft: #D7EFEC;
  --danger: #B3261E; --danger-fill: #B3261E; --off-track: #8A8F98;
  --map: #E7E3DA; --warn-soft: #FFF1C7; --warn-text: #5C4300; --toast-bg: #16181D; --toast-text: #FFFFFF;
  --scale: 1;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101113; --surface: #1B1D21; --surface2: #262A30; --seg-sel: #3A3F47;
  --text: #F3F2EE; --muted: #A7ADB6; --line: #33373E;
  --accent: #0F766E; --accent-text: #5EEAD4; --accent-soft: #12302D;
  --danger: #FF8A80; --danger-fill: #B3261E; --off-track: #5A5F68;
  --map: #22252A; --warn-soft: #3A2E0A; --warn-text: #FFD66B; --toast-bg: #F3F2EE; --toast-text: #101113;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(16px * var(--scale)); background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.3;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
[tabindex="-1"]:focus { outline: none; }  /* headings get focus for screen readers when a screen opens */
[hidden] { display: none !important; }    /* also for elements whose class sets a display */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- page frame: one phone-wide column, full height, safe areas */
#app { min-height: 100dvh; display: flex; justify-content: center; }
.screen {
  width: 100%; max-width: 560px; height: 100dvh; display: flex; flex-direction: column;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.top-inset { height: env(safe-area-inset-top); flex: none; }
.bottom-inset { height: env(safe-area-inset-bottom); flex: none; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 16px 20px 24px; }
.col { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; align-items: center; justify-content: center; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; }
.gap14 { gap: 14px; } .gap16 { gap: 16px; } .gap18 { gap: 18px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt22 { margin-top: 22px; }

/* ---- type */
.title { font-weight: 700; margin: 0; line-height: 1.15; }
.t15 { font-size: .9375rem; } .t16 { font-size: 1rem; } .t17 { font-size: 1.0625rem; } .t18 { font-size: 1.125rem; }
.t19 { font-size: 1.1875rem; } .t20 { font-size: 1.25rem; } .t21 { font-size: 1.3125rem; } .t22 { font-size: 1.375rem; }
.t24 { font-size: 1.5rem; } .t26 { font-size: 1.625rem; } .t28 { font-size: 1.75rem; } .t30 { font-size: 1.875rem; }
.t32 { font-size: 2rem; } .t48 { font-size: 3rem; } .t60 { font-size: 3.75rem; } .t120 { font-size: 7.5rem; }
.bold { font-weight: 700; }
.muted { color: var(--muted); }
.accent { color: var(--accent-text); }
.danger { color: var(--danger); }
.caps { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: .875rem; }
.tnum { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }

/* ---- buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px;
  padding: 10px 18px; border-radius: 18px; border: 2px solid transparent; font-size: 1.1875rem; font-weight: 700;
  background: var(--accent); color: #fff; text-decoration: none;
}
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.dark { background: var(--text); color: var(--bg); }
.btn.danger { background: var(--danger-fill); color: #fff; }
.btn:disabled, .btn.disabled { opacity: .45; }
.btn:active { filter: brightness(.92); }
.text-btn { background: none; border: 0; padding: 10px 0; color: var(--accent-text); font-weight: 700; font-size: 1.0625rem; text-align: left; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 10px 6px 10px 0; color: var(--accent-text); font-weight: 700; font-size: 1.0625rem; }
.round-btn { width: 48px; height: 48px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.icon-circle { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; }
svg.icon { flex: none; display: block; }

/* ---- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.card.flat { border: 0; }
.divider { height: 1px; background: var(--line); flex: none; }
.banner { background: var(--warn-soft); color: var(--warn-text); border-radius: 16px; padding: 12px 14px; font-weight: 700; font-size: 1rem; border: 0; text-align: left; width: 100%; }
button.banner { cursor: pointer; }
.chip { border-radius: 999px; padding: 6px 10px; font-weight: 700; font-size: .9375rem; white-space: nowrap; }

/* ---- forms */
.field label { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.input { width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 1.125rem; }
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { min-height: 120px; resize: vertical; }
.error { color: var(--danger); font-weight: 700; min-height: 1.3em; }
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--accent); }

/* ---- alarm buttons (hold 1 s) */
.hold {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 120px;
  padding: 16px 20px; border: 0; border-radius: 28px; text-align: left; flex: 1 1 auto;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.hold .fill { position: absolute; inset: 0; width: 0; background: rgba(0, 0, 0, .26); pointer-events: none; }
.hold.l1 .fill { background: rgba(0, 0, 0, .16); }
.hold.holding .fill { width: 100%; transition: width 1s linear; }
.hold > *:not(.fill) { position: relative; }

/* ---- level band and alarm pages */
.band { padding: 16px 20px 20px; }
.blink { width: 14px; height: 14px; border-radius: 7px; flex: none; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.call { display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 12px 18px; border-radius: 22px; background: #fff; text-decoration: none; }
.map { height: 170px; border-radius: 20px; overflow: hidden; background: var(--map); border: 1px solid var(--line); position: relative; z-index: 0; }
.map.tall { height: 250px; }
.map.mid { height: 190px; }
.map-label { position: absolute; top: 12px; left: 12px; z-index: 500; background: rgba(0, 0, 0, .66); color: #fff; padding: 6px 10px; border-radius: 10px; font-weight: 700; font-size: .9375rem; }
.leaflet-container { font-family: inherit; background: var(--map); }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.initials { width: 44px; height: 44px; border-radius: 22px; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.outline-btn { display: flex; align-items: center; justify-content: center; min-height: 60px; border-radius: 20px; background: transparent; border: 2px solid; font-weight: 700; font-size: 1.1875rem; width: 100%; text-decoration: none; }
.white-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 68px; border-radius: 22px; background: #fff; border: 0; font-weight: 700; font-size: 1.375rem; width: 100%; }

/* ---- tab bar */
.tabbar { display: flex; gap: 10px; padding: 8px 20px 16px; background: var(--bg); }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 1.0625rem; }
.tab.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.dot { width: 10px; height: 10px; border-radius: 5px; flex: none; }

/* ---- settings rows */
.section { padding: 22px 4px 8px; color: var(--muted); }
.srow { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px 10px 16px; background: var(--surface); border: 0; width: 100%; text-align: left; color: var(--text); }
button.srow:active { background: var(--surface2); }
.srow .value { color: var(--muted); font-size: 1rem; text-align: right; }
.srow .value.good { color: var(--accent-text); font-weight: 700; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--seg-sel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--off-track); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 23px; }
.radio { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--off-track); display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.radio.on { background: var(--accent); border-color: var(--accent); }
.choice { min-height: 56px; padding: 6px 10px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; flex: 1; }
.choice[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-text); }
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 112px; padding: 16px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); flex: 1; text-align: left; color: var(--text); }
.option[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-text); }
.option:disabled { opacity: .45; }

/* ---- keypad */
.dots { display: flex; gap: 18px; justify-content: center; }
.dots span { width: 20px; height: 20px; border-radius: 10px; border: 2px solid var(--text); }
.dots span.on { background: var(--text); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keys button { height: 68px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-size: 1.875rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.keys button.plain { border: 0; background: transparent; }
.keys .empty { visibility: hidden; }

/* ---- photo frame */
.frame { min-height: 200px; padding: 20px; border-radius: 24px; border: 2px dashed var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.frame.good { border-color: var(--accent-text); }

/* ---- overlays */
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 40px); background: var(--toast-bg); color: var(--toast-text); padding: 14px 18px; border-radius: 16px; font-weight: 700; font-size: 1.0625rem; text-align: center; z-index: 1000; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 900; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 28px 28px 0 0; padding: 24px 20px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
