/* ============================================================
   EHSS iOS prototype — Liquid Glass design system (iOS 26)
   Clean / white / blue accent. SF Pro system font.
   ============================================================ */

:root {
  --blue: #007AFF;          /* systemBlue — primary accent (tweakable) */
  --blue-press: #0063CC;
  --red: #FF3B30;           /* emergency */
  --orange: #FF9500;        /* warning */
  --amber: #FF9F0A;
  --green: #34C759;         /* safe / confirmed */
  --yellow: #FFCC00;
  --purple: #AF52DE;
  --teal: #30B0C7;

  --bg-grouped: #F2F2F7;    /* systemGroupedBackground */
  --bg-elevated: #FFFFFF;
  --bg-secondary: #FFFFFF;

  --label: #000000;
  --label-2: rgba(60,60,67,0.60);
  --label-3: rgba(60,60,67,0.30);
  --label-4: rgba(60,60,67,0.18);
  --separator: rgba(60,60,67,0.16);
  --separator-opaque: #C6C6C8;
  --fill-1: rgba(120,120,128,0.20);
  --fill-2: rgba(120,120,128,0.16);
  --fill-3: rgba(120,120,128,0.12);
  --fill-4: rgba(120,120,128,0.08);

  --r-card: 22px;
  --r-row: 12px;
  --r-control: 14px;

  --sf: -apple-system, "SF Pro Text", "SF Pro Display", "SF Pro",
        system-ui, "Helvetica Neue", "Segoe UI", Roboto, sans-serif;

  --safe-top: 62px;
  --tabbar-h: 84px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-grouped: #101216;
  --bg-elevated: #1C1E24;
  --bg-secondary: #17191F;
  --label: #F5F7FA;
  --label-2: rgba(235,238,245,0.68);
  --label-3: rgba(235,238,245,0.38);
  --label-4: rgba(235,238,245,0.22);
  --separator: rgba(235,238,245,0.14);
  --separator-opaque: #343842;
  --fill-1: rgba(235,238,245,0.18);
  --fill-2: rgba(235,238,245,0.13);
  --fill-3: rgba(235,238,245,0.10);
  --fill-4: rgba(235,238,245,0.07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sf);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #babfc7;
  background:
    radial-gradient(1200px 800px at 20% -10%, #e9edf3 0%, transparent 60%),
    radial-gradient(1000px 900px at 110% 110%, #dfe4ec 0%, transparent 55%),
    #cdd3dc;
  color: var(--label);
  overflow: hidden;
}

[data-theme="dark"] body {
  background:
    radial-gradient(900px 700px at 20% -10%, #242C39 0%, transparent 60%),
    radial-gradient(900px 800px at 110% 110%, #151A24 0%, transparent 55%),
    #090B10;
}

[data-theme="dark"] .role-bg {
  background: linear-gradient(180deg, #151821 0%, #0F1218 100%);
}

[data-theme="dark"] .phone-screen,
[data-theme="dark"] .fullscreen-app {
  background: var(--bg-grouped);
}

/* RTL */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .row-chevron { transform: scaleX(-1); }
[dir="rtl"] .nav-back-chevron { transform: scaleX(-1); }

/* ============================================================
   Stage + device scaling
   ============================================================ */
#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 40px;
}
.stage-inner {
  display: flex; align-items: center; justify-content: center;
  gap: 44px;
  transform-origin: center center;
}

/* ============================================================
   iPhone device frame  (393 x 852 logical)
   ============================================================ */
.phone {
  --w: 393px; --h: 852px;
  width: var(--w); height: var(--h);
  position: relative;
  border-radius: 56px;
  background: #000;
  padding: 4px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 30px 60px -10px rgba(20,28,46,0.45),
    0 0 0 4px #1b1d22,
    0 0 0 5px #303338,
    0 0 0 11px #0c0d0f;
  flex-shrink: 0;
}
.phone-screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 52px;
  overflow: hidden;
  background: var(--bg-grouped);
}
.dynamic-island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 126px; height: 36px; border-radius: 20px;
  background: #000; z-index: 200;
  transition: width .35s cubic-bezier(.2,.9,.3,1), height .35s cubic-bezier(.2,.9,.3,1);
}
.dynamic-island.alert {
  width: 250px; height: 44px; border-radius: 22px;
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
}
.dynamic-island.alert .di-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 8px var(--red); animation: dipulse 1s infinite;
}
.dynamic-island.alert .di-text { color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .2px; }
.dynamic-island.alert .di-time { color: var(--red); font-size: 13px; font-weight: 700; margin-left: auto; font-variant-numeric: tabular-nums; }
@keyframes dipulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* status bar */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--safe-top);
  z-index: 150; display: flex; align-items: flex-start; justify-content: space-between;
  padding: 19px 32px 0; pointer-events: none;
}
.statusbar .sb-time { font-size: 16px; font-weight: 600; letter-spacing: .2px; font-variant-numeric: tabular-nums; }
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.statusbar.light .sb-time, .statusbar.light svg { color: #fff; fill: #fff; }
.nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* home indicator */
.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px; z-index: 210;
  background: rgba(0,0,0,0.28); pointer-events: none;
}
.home-indicator.light { background: rgba(255,255,255,0.85); }

/* ============================================================
   Screen + scroll
   ============================================================ */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg-grouped); }
.screen.plain { background: var(--bg-elevated); }
.scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--safe-top) + 44px);
}
.scroll::-webkit-scrollbar { width: 0; height: 0; }
.scroll.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 8px); }
.content-pad { padding: 0 16px; }
.section-gap { height: 18px; }

/* ============================================================
   Navigation bar — Liquid Glass, large title
   ============================================================ */
.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 120;
  padding-top: var(--safe-top);
  transition: background .2s, backdrop-filter .2s;
}
.nav.scrolled {
  background: rgba(249,249,251,0.72);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 0.5px solid var(--separator);
}
.nav-inline {
  height: 44px; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 0 8px;
}
.nav-inline .nav-title { font-size: 17px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.nav.scrolled .nav-inline .nav-title { opacity: 1; }
.nav-leading, .nav-trailing { position: absolute; display: flex; align-items: center; gap: 2px; }
.nav-leading { left: 8px; } .nav-trailing { right: 8px; }
.nav-btn {
  color: var(--blue); font-size: 17px; font-weight: 400;
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  display: flex; align-items: center; gap: 3px; font-family: var(--sf);
}
.nav-btn.bold { font-weight: 600; }
.nav-btn:active { opacity: .4; }
.nav-large { padding: 4px 16px 8px; }
.nav-large .lt { font-size: 34px; font-weight: 700; letter-spacing: 0.37px; line-height: 41px; }
.nav-large .lt-sub { font-size: 15px; color: var(--label-2); margin-top: 2px; }

/* glass circular nav pill (back / icons) */
.glass-pill {
  height: 36px; min-width: 36px; border-radius: 999px; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 4px; cursor: pointer; color: var(--blue);
  background: rgba(255,255,255,0.55);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0.5px 0.5px 0.5px rgba(255,255,255,0.7),
              inset 0 0 0 0.5px rgba(0,0,0,0.05);
}
.glass-pill:active { transform: scale(0.94); }

/* ============================================================
   Liquid Glass Tab Bar (floating)
   ============================================================ */
.tabbar {
  position: absolute; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 130;
  height: 64px; border-radius: 32px;
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 6px;
  background: rgba(252,252,253,0.62);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow:
    0 8px 30px rgba(20,28,46,0.16),
    0 1px 2px rgba(0,0,0,0.06),
    inset 0.5px 0.5px 1px rgba(255,255,255,0.9),
    inset 0 0 0 0.5px rgba(255,255,255,0.5);
}
.tab {
  flex: 1; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; cursor: pointer;
  color: var(--label-2); position: relative; border-radius: 24px;
}
.tab .tab-ico { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.tab .tab-label { font-size: 10px; font-weight: 500; letter-spacing: .1px; }
.tab.active { color: var(--blue); }
.tab .tab-badge {
  position: absolute; top: 6px; left: 56%; min-width: 16px; height: 16px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  box-shadow: 0 0 0 2px rgba(252,252,253,0.9);
}

/* ============================================================
   Grouped lists
   ============================================================ */
.list-header {
  font-size: 13px; color: var(--label-2); text-transform: uppercase;
  letter-spacing: .2px; padding: 16px 16px 7px 16px; font-weight: 400;
}
.list-footer { font-size: 13px; color: var(--label-2); padding: 7px 16px 0; line-height: 1.35; }
.ios-list { background: var(--bg-elevated); border-radius: var(--r-card); overflow: hidden; }
.ios-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px;
  padding: 10px 16px; position: relative; background: var(--bg-elevated);
  font-size: 17px; cursor: default;
}
.ios-row.tappable { cursor: pointer; }
.ios-row.tappable:active { background: var(--fill-4); }
.ios-row:not(:last-child)::after {
  content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: 0.5px;
  background: var(--separator);
}
.ios-row.inset-sep:not(:last-child)::after { left: 60px; }
.row-ico {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 17px; line-height: 1.25; }
.row-sub { font-size: 13px; color: var(--label-2); margin-top: 1px; }
.row-detail { color: var(--label-2); font-size: 17px; }
.row-chevron { color: var(--label-3); flex-shrink: 0; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  font-family: var(--sf); border: none; cursor: pointer;
  font-size: 17px; font-weight: 600; border-radius: var(--r-control);
  padding: 15px 18px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; transition: transform .08s, filter .12s, opacity .12s; width: 100%;
}
.btn:active { transform: scale(0.975); }
.btn-filled { background: var(--blue); color: #fff; }
.btn-filled:active { background: var(--blue-press); }
.btn-tinted { background: color-mix(in srgb, var(--blue) 14%, white); color: var(--blue); }
.btn-gray { background: var(--fill-3); color: var(--label); }
.btn-red { background: var(--red); color: #fff; }
.btn-red-tinted { background: color-mix(in srgb, var(--red) 12%, white); color: var(--red); }
.btn-green { background: var(--green); color: #fff; }
.btn-plain { background: none; color: var(--blue); font-weight: 400; }
.btn-lg { padding: 17px 20px; font-size: 18px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ============================================================
   Cards / status
   ============================================================ */
.card {
  background: var(--bg-elevated); border-radius: var(--r-card);
  padding: 16px; box-shadow: 0 1px 2px rgba(20,28,46,0.04);
}
.card-tap { cursor: pointer; transition: transform .1s; }
.card-tap:active { transform: scale(0.985); }
.hairline { height: 0.5px; background: var(--separator); margin: 12px -16px; }

/* status pill / badge */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--fill-3); color: var(--label-2); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.green { background: color-mix(in srgb, var(--green) 16%, white); color: #1c7d3d; }
.pill.red { background: color-mix(in srgb, var(--red) 14%, white); color: #c4271d; }
.pill.orange { background: color-mix(in srgb, var(--orange) 16%, white); color: #9a5a00; }
.pill.blue { background: color-mix(in srgb, var(--blue) 14%, white); color: var(--blue); }
.pill.gray { background: var(--fill-3); color: var(--label-2); }
.pill.sm { padding: 3px 8px; font-size: 12px; }

.kv { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 16px; }
.kv:not(:last-child) { border-bottom: 0.5px solid var(--separator); }
.kv .k { color: var(--label-2); }
.kv .v { font-weight: 500; text-align: right; }

/* segmented control */
.segmented {
  display: flex; background: var(--fill-3); border-radius: 9px; padding: 2px; gap: 2px;
}
.segmented .seg {
  flex: 1; text-align: center; padding: 7px 10px; border-radius: 7px;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--label);
  transition: background .15s; white-space: nowrap;
}
.segmented .seg.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12); font-weight: 600; }

/* toggle */
.switch { width: 51px; height: 31px; border-radius: 999px; background: var(--fill-1); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch.on { background: var(--green); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.25); transition: transform .2s; }
.switch.on .knob { transform: translateX(20px); }

/* form fields */
.field { width: 100%; font-family: var(--sf); font-size: 17px; border: none; background: transparent; outline: none; color: var(--label); padding: 12px 16px; }
.field::placeholder { color: var(--label-3); }
textarea.field { resize: none; min-height: 88px; line-height: 1.4; }
.select-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; }
.select-row .sel-val { color: var(--label-2); display: flex; align-items: center; gap: 4px; }

/* ============================================================
   ID badge
   ============================================================ */
.badge-card {
  border-radius: 26px; padding: 24px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #1c3a6e 0%, #2a5298 55%, #3a6fc4 100%);
  box-shadow: 0 16px 40px -12px rgba(20,40,90,0.5);
}
.badge-photo { width: 76px; height: 76px; border-radius: 18px; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 600; }
.badge-glass-strip {
  background: rgba(255,255,255,0.14); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 14px; padding: 12px 14px;
}

/* QR */
.qr { width: 168px; height: 168px; border-radius: 16px; background: #fff; padding: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

/* ============================================================
   Sheets / modals
   ============================================================ */
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.4); z-index: 300; opacity: 0; animation: fade .25s forwards; }
@keyframes fade { to { opacity: 1; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 310;
  background: var(--bg-grouped); border-radius: 16px 16px 0 0;
  max-height: 92%; display: flex; flex-direction: column;
  transform: translateY(100%); animation: sheetup .38s cubic-bezier(.2,.9,.25,1) forwards;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
}
@keyframes sheetup { to { transform: translateY(0); } }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 8px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 12px; }
.sheet-title { font-size: 17px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 0 16px 24px; }
.sheet-body::-webkit-scrollbar { width: 0; }

/* center alert dialog (iOS UIAlertController) */
.dialog {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.9);
  width: 270px; background: rgba(248,248,250,0.94);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-radius: 14px; z-index: 320; overflow: hidden; text-align: center;
  animation: dialogin .3s cubic-bezier(.2,.9,.25,1) forwards;
}
@keyframes dialogin { to { transform: translate(-50%,-50%) scale(1); } }
.dialog-body { padding: 19px 16px 16px; }
.dialog-title { font-size: 17px; font-weight: 600; }
.dialog-msg { font-size: 13px; margin-top: 4px; line-height: 1.35; }
.dialog-actions { display: flex; flex-direction: column; border-top: 0.5px solid var(--separator); }
.dialog-actions.horiz { flex-direction: row; }
.dialog-act { padding: 12px; font-size: 17px; color: var(--blue); cursor: pointer; flex: 1; }
.dialog-act.horiz-sep { border-left: 0.5px solid var(--separator); }
.dialog-act.bold { font-weight: 600; }
.dialog-act.destructive { color: var(--red); }
.dialog-act + .dialog-act { border-top: 0.5px solid var(--separator); }

/* ============================================================
   Banners / toasts
   ============================================================ */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px;
}
.banner.warn { background: color-mix(in srgb, var(--orange) 14%, white); color: #8a4f00; }
.banner.red { background: color-mix(in srgb, var(--red) 12%, white); color: #c4271d; }
.banner.green { background: color-mix(in srgb, var(--green) 14%, white); color: #1c7d3d; }
.banner.blue { background: color-mix(in srgb, var(--blue) 12%, white); color: var(--blue); }
.banner .b-ico { flex-shrink: 0; }
.banner .b-text { font-size: 14px; line-height: 1.3; font-weight: 500; }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--tabbar-h) + 18px); transform: translateX(-50%);
  z-index: 340; background: rgba(40,40,44,0.92); color: #fff; padding: 12px 18px;
  border-radius: 14px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3); animation: toastin .3s ease, fade .3s;
  max-width: 86%; text-align: center;
}
@keyframes toastin { from { transform: translateX(-50%) translateY(12px); opacity: 0; } }

/* ============================================================
   Emergency full-screen alarm
   ============================================================ */
.alarm {
  position: absolute; inset: 0; z-index: 400; display: flex; flex-direction: column;
  color: #fff; overflow: hidden;
  background: linear-gradient(165deg, #3a0a06 0%, #7d130b 45%, #b21f12 100%);
}
.alarm::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(circle at 50% 38%, rgba(255,80,60,0.55), transparent 60%);
  animation: alarmglow 1.1s ease-in-out infinite;
}
@keyframes alarmglow { 0%,100% { opacity: .35; } 50% { opacity: .9; } }
.alarm-flash { position: absolute; inset: 0; background: rgba(255,59,48,0.0); z-index: 1; animation: alarmflash 1.1s steps(1) infinite; pointer-events: none; }
@keyframes alarmflash { 0%,49% { background: rgba(255,255,255,0); } 50%,99% { background: rgba(255,255,255,0.06); } }
.alarm-inner { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; padding: 92px 24px 28px; }
.alarm-pulse-ring {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 18px; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.14);
}
.alarm-pulse-ring::after { content:""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7); animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.alarm-cat { font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .9; text-align: center; }
.alarm-type { font-size: 42px; font-weight: 800; letter-spacing: -0.5px; text-align: center; line-height: 1.02; margin: 6px 0 2px; }
.alarm-loc { font-size: 17px; text-align: center; opacity: .92; }
.alarm-timer { font-size: 64px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 14px 0; text-shadow: 0 2px 20px rgba(0,0,0,0.3); }
.alarm-sound { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto; padding: 7px 14px; border-radius: 999px; background: rgba(0,0,0,0.25); font-size: 13px; font-weight: 600; }
.alarm-sound .bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.alarm-sound .bars i { width: 3px; background: #fff; border-radius: 2px; animation: sound .7s ease-in-out infinite; }
.alarm-sound .bars i:nth-child(2){ animation-delay:.15s } .alarm-sound .bars i:nth-child(3){ animation-delay:.3s } .alarm-sound .bars i:nth-child(4){ animation-delay:.45s }
@keyframes sound { 0%,100%{ height: 4px } 50%{ height: 14px } }
.alarm-detail { background: rgba(0,0,0,0.22); border-radius: 18px; padding: 4px 16px; margin-top: auto; }
.alarm-detail .kv { border-color: rgba(255,255,255,0.15); }
.alarm-detail .kv:not(:last-child) { border-bottom: 0.5px solid rgba(255,255,255,0.15); }
.alarm-detail .k { color: rgba(255,255,255,0.7); }
.alarm-detail .v { color: #fff; }
.alarm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.btn-ack { background: #fff; color: #b21f12; font-weight: 700; }
.btn-reject { background: rgba(0,0,0,0.28); color: #fff; }

/* focused (critical-alert card) alarm variant */
.alarm-backdrop {
  position: absolute; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(20,6,4,0.55);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  animation: fade .25s; overflow: hidden;
}
.alarm-backdrop::before {
  content:""; position:absolute; inset:0; background: radial-gradient(circle at 50% 40%, rgba(255,59,48,0.35), transparent 65%);
  animation: alarmglow 1.1s ease-in-out infinite;
}
.alarm-card {
  position: relative; z-index: 1; width: 100%; max-width: 340px; background: rgba(252,252,253,0.92);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  border-radius: 26px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,0.45);
  animation: dialogin .35s cubic-bezier(.2,.9,.25,1);
}
.alarm-card-head { background: linear-gradient(135deg, #c4271d, #ff3b30); color: #fff; padding: 22px 20px 18px; text-align: center; position: relative; }
.alarm-card-body { padding: 16px; }
.alarm-card .alarm-timer { font-size: 48px; color: #fff; margin: 8px 0 4px; }

/* ============================================================
   Role selector
   ============================================================ */
.role-bg { position: absolute; inset: 0; background: linear-gradient(180deg, #f7f8fa 0%, #eef1f6 100%); display: flex; flex-direction: column; }
.role-card {
  display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--bg-elevated);
  border-radius: 18px; cursor: pointer; box-shadow: 0 1px 3px rgba(20,28,46,0.06);
  transition: transform .1s;
}
.role-card:active { transform: scale(0.98); }
.role-card.compact { padding: 12px; border-radius: 14px; box-shadow: 0 1px 2px rgba(20,28,46,0.05); }
.role-card.selected { box-shadow: inset 0 0 0 2px var(--blue), 0 2px 8px rgba(0,122,255,.12); }
.role-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.role-card.compact .role-ico { width: 40px; height: 40px; border-radius: 10px; }
.role-name { font-size: 17px; font-weight: 600; }
.role-desc { font-size: 13px; color: var(--label-2); margin-top: 2px; }
.role-radio { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--separator); background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-card.selected .role-radio { background: var(--blue); border-color: var(--blue); }

/* ============================================================
   Misc helpers
   ============================================================ */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-6 { gap: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.muted { color: var(--label-2); }
.t-13 { font-size: 13px; } .t-15 { font-size: 15px; } .t-17 { font-size: 17px; } .t-20 { font-size: 20px; }
.t-22 { font-size: 22px; } .t-26 { font-size: 26px; } .t-28 { font-size: 28px; }
.fw6 { font-weight: 600; } .fw7 { font-weight: 700; }
.center { text-align: center; }
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-20{margin-top:20px}
.mb-8{margin-bottom:8px}
.stat-num { font-size: 30px; font-weight: 700; line-height: 1; }
.stat-num.tabnum { font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--label-2); margin-top: 5px; }

/* zone board */
.zone-card { background: var(--bg-elevated); border-radius: 16px; padding: 14px; cursor: pointer; position: relative; transition: transform .1s; }
.zone-card:active { transform: scale(0.98); }
.zone-card.alert-zone { box-shadow: inset 0 0 0 2px var(--red); }
.risk-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* progress bars */
.bar-track { height: 8px; border-radius: 4px; background: var(--fill-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; color: var(--label-2); gap: 10px; }

/* demo control panel (outside phone) */
.demo-panel {
  width: 296px; flex-shrink: 0; background: rgba(28,30,36,0.92); color: #fff;
  border-radius: 22px; padding: 18px; align-self: stretch; max-height: 852px;
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 30px 60px -10px rgba(20,28,46,0.45);
}
.demo-panel::-webkit-scrollbar { width: 0; }
.demo-panel h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: rgba(255,255,255,0.5); font-weight: 700; }
.demo-panel .dp-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.demo-panel .dp-sub { font-size: 12px; color: rgba(255,255,255,0.55); line-height: 1.4; }
.dp-group { background: rgba(255,255,255,0.06); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.dp-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; padding: 5px 6px; border-radius: 9px; }
.dp-toggle:hover { background: rgba(255,255,255,0.05); }
.dp-radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.4); flex-shrink: 0; position: relative; }
.dp-toggle.active .dp-radio { border-color: var(--blue); }
.dp-toggle.active .dp-radio::after { content:""; position: absolute; inset: 3px; border-radius: 50%; background: var(--blue); }
.dp-toggle.active { background: rgba(10,132,255,0.14); }
.dp-btn { width: 100%; padding: 10px; border-radius: 11px; border: none; cursor: pointer; font-family: var(--sf); font-size: 14px; font-weight: 600; background: rgba(255,255,255,0.12); color: #fff; }
.dp-btn:hover { background: rgba(255,255,255,0.18); }
.dp-btn.primary { background: var(--blue); }
.dp-btn.danger { background: rgba(255,59,48,0.9); }
.dp-hint { font-size: 11px; color: rgba(255,255,255,0.4); }

@media (max-width: 700px) { .demo-panel { display: none; } }

/* ============================================================
   Full-screen (frameless) display mode — for showing on a real phone
   ============================================================ */
.fullscreen-app {
  position: fixed; inset: 0; overflow: hidden; background: var(--bg-grouped);
  --safe-top: calc(env(safe-area-inset-top, 0px) + 16px);
}
/* floating controls button (full mode) */
.full-fab {
  position: absolute; z-index: 145; right: 14px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px));
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--blue);
  background: rgba(252,252,253,0.7);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 16px rgba(20,28,46,0.18), inset 0.5px 0.5px 1px rgba(255,255,255,0.9), inset 0 0 0 0.5px rgba(0,0,0,0.05);
}
.full-fab:active { transform: scale(0.92); }
.device-fab { display: none; }
@media (max-width: 700px) { .device-fab { display: flex; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); } }
/* controls drawer (full mode) reuses .demo-panel */
.demo-panel.drawer {
  display: flex !important; position: absolute; top: 0; right: 0; bottom: 0; z-index: 360;
  width: min(330px, 86vw); max-height: none; height: 100%; border-radius: 20px 0 0 20px;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  animation: drawerin .32s cubic-bezier(.2,.85,.3,1);
}
@keyframes drawerin { from { transform: translateX(100%); } }
.dp-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.14); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dp-seg { display: flex; gap: 6px; background: rgba(255,255,255,0.08); border-radius: 11px; padding: 4px; margin-top: 8px; }
.dp-seg .s { flex: 1; text-align: center; padding: 9px 6px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: rgba(255,255,255,0.6); display: flex; align-items: center; justify-content: center; gap: 6px; }
.dp-seg .s.active { background: var(--blue); color: #fff; }

/* fade-in for screen content */
.fade-in { animation: fadein .28s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* pushed detail screen (slide from right) */
.pushed { z-index: 260; box-shadow: -8px 0 30px rgba(0,0,0,0.10); animation: slidein .34s cubic-bezier(.2,.85,.3,1); }
@keyframes slidein { from { transform: translateX(100%); } }

/* method tiles */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.method-tile {
  background: var(--bg-elevated); border-radius: 18px; padding: 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px; transition: transform .1s; min-height: 104px;
  box-shadow: 0 1px 2px rgba(20,28,46,0.05);
}
.method-tile:active { transform: scale(0.97); }
.method-tile .m-ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.method-tile .m-name { font-size: 16px; font-weight: 600; }
.method-tile .m-sub { font-size: 12px; color: var(--label-2); margin-top: -4px; }
.method-tile.full { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }

/* action tiles (home) */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-tile {
  border-radius: 18px; padding: 16px; cursor: pointer; color: #fff; transition: transform .1s;
  display: flex; flex-direction: column; justify-content: space-between; min-height: 92px;
}
.action-tile:active { transform: scale(0.97); }
.action-tile .a-name { font-size: 16px; font-weight: 600; margin-top: 10px; }

/* hero status */
.hero {
  border-radius: 24px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 12px 30px -10px rgba(20,40,90,0.4);
}
.hero.green { background: linear-gradient(155deg, #1c8a4b 0%, #34c759 100%); }
.hero.orange { background: linear-gradient(155deg, #b96a00 0%, #ff9500 100%); }
.hero.red { background: linear-gradient(155deg, #8a1109 0%, #ff3b30 100%); }
.hero.gray { background: linear-gradient(155deg, #4a4f57 0%, #6b7280 100%); }
.hero.blue { background: linear-gradient(155deg, #1c3a6e 0%, #2a6fd0 100%); }
.hero-glass { background: rgba(255,255,255,0.16); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 14px; padding: 10px 12px; }

/* avatar */
.avatar { border-radius: 50%; background: linear-gradient(135deg, #5b7fb4, #34518a); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }

/* content media placeholder */
.media-ph { width: 100%; border-radius: 16px; background: linear-gradient(135deg, #e7ebf1, #d6dde7); display: flex; align-items: center; justify-content: center; color: var(--label-3); }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }

/* response table */
.resp-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; position: relative; }
.resp-row:not(:last-child)::after { content:""; position:absolute; left:16px; right:0; bottom:0; height:.5px; background: var(--separator); }

/* segmented scroll chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; }
.chips::-webkit-scrollbar { height: 0; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--fill-3); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; color: var(--label); }
.chip.active { background: var(--blue); color: #fff; }

/* admin sidebar tabs (mobile pill row) */
.admin-tabs { display: flex; gap: 6px; padding: 4px; background: var(--fill-3); border-radius: 12px; }
.admin-tabs .at { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--label-2); }
.admin-tabs .at.active { background: #fff; color: var(--label); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
