/* KC webview components. Values come from tokens.css only. */
* { box-sizing: border-box; }
html, body { margin: 0; overscroll-behavior: none; }
body { font: var(--t-body); letter-spacing: var(--ls-tight); color: var(--c-text); background: var(--c-bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; letter-spacing: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; letter-spacing: inherit; color: inherit; }
img.ic { display: block; }

/* screen shell */
.app { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--c-bg); overflow: hidden; }
.app__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* sticky bottom: button sits 8px above the home indicator, 16px when there is no safe area */
.app__footer { padding: var(--sp-3) var(--sp-4) max(var(--sp-4), calc(var(--safe-bottom) + var(--sp-2))); background: var(--c-surface); box-shadow: 0 -0.5px 0 var(--c-separator); }

.t-foot { font: var(--t-footnote); }
.t-sec { color: var(--c-text-secondary); }

.mt-2 { margin-top: var(--sp-2); } .mt-6 { margin-top: var(--sp-6); }

/* buttons: primary 48px r12 #008CFF · secondary #EAEAEB */
.btn { width: 100%; height: var(--h-button); border-radius: var(--r-s); font: var(--t-body-strong); display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.btn--primary { background: var(--c-primary); color: var(--c-text-on-accent); }
.btn--primary:active { background: var(--c-primary-pressed); }
.btn--secondary { background: var(--c-fill-secondary); color: var(--c-text); }

/* cards */
.card { background: var(--c-surface); border-radius: var(--r-s); box-shadow: var(--shadow-card); }

/* chips & segmented control */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { height: 36px; padding: 0 var(--sp-4); border-radius: var(--r-pill); background: var(--c-fill-secondary); font: 510 15px/18px var(--font); }
.chip[aria-pressed="true"] { background: var(--c-primary); color: var(--c-text-on-accent); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border-radius: 9px; background: var(--c-fill-segment); }
.segmented button { height: 32px; border-radius: 7px; font: 510 15px/18px var(--font); }
.segmented button[aria-pressed="true"] { background: var(--c-surface); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: var(--fw-semibold); }

/* toggle (iOS) */
.toggle { position: relative; width: 51px; height: 31px; flex: none; border-radius: var(--r-pill); background: var(--c-fill-secondary); transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); transition: transform .2s; }
.toggle[aria-checked="true"] { background: var(--c-success); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }

/* inputs */
.field { display: block; }
.field__label { font: var(--t-footnote); color: var(--c-text-secondary); margin-bottom: 6px; }
.input { width: 100%; height: var(--h-button); padding: 0 var(--sp-4); border-radius: var(--r-s); border: 1px solid transparent; background: var(--c-fill-secondary); outline: none; }
.input:focus { border-color: var(--c-primary); background: var(--c-surface); }
.input--error { border-color: var(--c-danger); background: var(--c-surface); }
.field__hint { font: var(--t-footnote); color: var(--c-text-secondary); margin-top: 6px; }
.field__hint--error { color: var(--c-danger); }

/* bottom sheet & modal */
.overlay { position: absolute; inset: 0; background: var(--c-overlay); z-index: 40; animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--c-surface); border-radius: var(--r-m) var(--r-m) 0 0; padding: var(--sp-2) var(--sp-6) calc(var(--sp-6) + var(--safe-bottom)); animation: up .25s ease-out; }
.sheet__handle { width: 36px; height: 5px; border-radius: 2.5px; background: var(--c-handle); margin: 0 auto var(--sp-5); }
.sheet__icon { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; margin-bottom: var(--sp-5); }
.sheet__icon img { width: 80px; height: 80px; }
.sheet__title { font: var(--t-title2); letter-spacing: var(--ls-normal); }
.sheet__text { font: var(--t-body); color: var(--c-text); margin-top: var(--sp-2); }
.sheet__actions { display: grid; gap: var(--sp-4); margin-top: var(--sp-6); }
/* centered system-style alert */
.overlay--alert { background: rgba(0, 0, 0, 0.35); }
.alert-dialog { position: absolute; left: 50%; top: 50%; z-index: 41; width: 270px; transform: translate(-50%, -50%); border-radius: 14px; background: var(--c-bg-alt); overflow: hidden; text-align: center; animation: fade .2s; }
.alert-dialog__body { padding: var(--sp-5) var(--sp-4) var(--sp-4); }
.alert-dialog__title { margin: 0; font: var(--t-headline); }
.alert-dialog__text { margin: var(--sp-1) 0 0; font: var(--t-footnote); }
.alert-dialog__actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 0.5px solid var(--c-separator); }
.alert-dialog__actions button { height: 44px; font: 400 17px/22px var(--font); color: var(--c-primary); }
.alert-dialog__actions button + button { border-left: 0.5px solid var(--c-separator); }
.alert-dialog__actions .is-danger { color: var(--c-danger-system); font-weight: var(--fw-semibold); }
.alert-dialog__actions .is-primary { font-weight: var(--fw-semibold); }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* toast */
.toast { position: absolute; left: var(--sp-4); right: var(--sp-4); bottom: calc(var(--sp-6) + var(--safe-bottom)); z-index: 60; display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-s); background: #343137; color: #fff; font: var(--t-body); box-shadow: var(--shadow-toast); animation: toast .25s ease-out; }
.toast--error { background: var(--c-danger); }
.toast--success { background: #343137; }
@keyframes toast { from { transform: translateY(16px); opacity: 0; } }

/* map */
.map-wrap { position: relative; flex: 1; min-height: 0; }
.map { position: absolute; inset: 0; }
.map-top { position: absolute; top: var(--sp-3); left: var(--sp-3); right: var(--sp-3); z-index: 5; display: grid; gap: var(--sp-2); }

.pin-center { position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -100%); pointer-events: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--sp-3); border-radius: var(--r-pill); background: var(--c-surface); box-shadow: var(--shadow-float); font: var(--t-footnote-strong); }

.btn--danger { background: var(--c-danger); color: #fff; }

.picker-pin { width: 36px; height: 48px; }

.grow { flex: 1; min-width: 0; }
.is-disabled { opacity: .45; pointer-events: none; }

/* how the service works (a sheet): radar art on top, bullets with tinted icons, a warning card, the button */
.onb__art { display: block; flex: none; height: 180px; background: #EEF6FF; overflow: hidden; }
.onb__art svg { display: block; width: 100%; height: 100%; }
.onb__content { display: flex; flex-direction: column; gap: var(--sp-5); padding: var(--sp-5) var(--sp-5) 0; }
.onb__title { margin: 0; font: 700 28px/34px var(--font); letter-spacing: var(--ls-tight); }
.onb__items { display: flex; flex-direction: column; gap: var(--sp-4); }
.onb__item { display: flex; gap: 14px; align-items: flex-start; }
.onb__icon { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c-primary-tint); color: var(--c-primary); }
.onb__item-title { font: 590 16px/21px var(--font); }
.onb__item-text { font: var(--t-body); color: var(--c-text-secondary); margin-top: 2px; }
.onb__warn { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 14px var(--sp-4); border-radius: var(--r-s); background: #FDF4DC; color: #343137; font: var(--t-body); }
.onb__warn-icon { display: inline-flex; flex: none; margin-top: 1px; color: #8A6100; }

.kd-input { display: grid; gap: var(--sp-2); }
.kd-input__label { font: 400 14px/18px var(--font); color: var(--c-text-secondary); }
.kd-input__box { height: 42px; display: flex; align-items: center; padding: 0 var(--sp-3); border-radius: var(--r-xs); border: 1px solid var(--c-fill-secondary); background: var(--c-surface); font: 510 15px/18px var(--font); width: 100%; text-align: left; color: var(--c-text); }

.kd-input__box:disabled { background: #E7E7E9; color: #ABABB0; cursor: default; }
.kd-input__box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; color: inherit; }

/* address autocomplete: suggestions in flow under the field, at most ~6 rows, scrollable */
.ac__input:disabled { color: #ABABB0; -webkit-text-fill-color: #ABABB0; }
.kd-input__box.is-disabled { background: #E7E7E9; }
.ac__list { display: none; max-height: 288px; overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-xs); background: var(--c-surface); box-shadow: var(--shadow-card), 0 0 0 1px var(--c-fill-secondary); }
.ac__list.is-open { display: block; }
.ac__row { display: block; width: 100%; text-align: left; padding: 12px var(--sp-3); min-height: 48px; font: 510 15px/20px var(--font); color: var(--c-text); }
.ac__row + .ac__row { border-top: 1px solid var(--c-fill-secondary); }
.ac__sub { display: block; font: var(--t-footnote); color: var(--c-text-secondary); margin-top: 2px; }
.ac__note { padding: 14px var(--sp-3); font: var(--t-footnote); color: var(--c-text-secondary); }
.form-title { font: var(--t-title2); margin: 0; }
.form-actions { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-2); }

/* notification schedule */
.times { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-4); }
.times input[type="time"] { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; color: inherit; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days .chip { padding: 0; }


/* alert banner: drones yellow, missiles red, the all-clear green; the time in bold */
.alert-banner { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-3) 14px; border-radius: var(--r-m); background: #FDF4DC; color: #343137; }
.alert-banner--red { background: #FDECEB; }
.alert-banner--green { background: #E8F6EA; }
.alert-banner--float { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16); }
.alert-banner__icon { width: 36px; height: 36px; flex: none; display: block; }
.alert-banner__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.alert-banner__title { font: 590 15px/20px var(--font); }
.alert-banner__sub { font: var(--t-footnote); color: #5C5240; }
.alert-banner--red .alert-banner__sub { color: #6B4744; }
.alert-banner--green .alert-banner__sub { color: #3F5543; }
.alert-banner__sub b { font-weight: var(--fw-semibold); color: #343137; }
.alert-banner__link { flex: none; display: inline-flex; align-items: center; gap: 2px; font: 590 15px/20px var(--font); color: #343137; }
.alert-banner__chev { display: inline-flex; }

/* sheets over the map: «Мої адреси», the empty state, how the service works */
.overlay--sheet { background: rgba(0, 0, 0, 0.35); }
.bsheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; max-height: calc(100% - 96px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--c-surface); border-radius: 20px 20px 0 0; padding: var(--sp-2) var(--sp-4) max(var(--sp-4), calc(var(--safe-bottom) + var(--sp-2))); animation: up .25s ease-out; }
.bsheet__handle { width: 36px; height: 5px; border-radius: 3px; background: #C7C7CC; margin: 0 auto var(--sp-3); }
.bsheet__body { display: flex; flex-direction: column; gap: 14px; }
.bsheet--list { background: var(--c-bg); }
.bsheet__head { display: flex; align-items: center; gap: var(--sp-3); }
.bsheet__title { flex: 1; margin: 0; font: 700 22px/28px var(--font); letter-spacing: var(--ls-tight); }
.bsheet__count { font: var(--t-footnote); color: var(--c-text-secondary); }
.bsheet__close { align-self: flex-end; margin: -10px -8px -8px 0; }
.bsheet--about { padding: 0 0 max(var(--sp-4), calc(var(--safe-bottom) + var(--sp-2))); overflow-x: hidden; }
.bsheet--about .bsheet__handle { display: none; }
.bsheet--about .bsheet__body { gap: 0; }
.bsheet--empty { padding-left: var(--sp-6); padding-right: var(--sp-6); }

/* feed state cards (stale / lost) */
.info-card { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-m); background: var(--c-surface); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16); }
.info-card__icon { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c-bg-alt); color: var(--c-text-secondary); }
.info-card--lost .info-card__icon { background: var(--c-danger-tint); color: var(--c-danger); }
.info-card__title { font: var(--t-body-strong); }
.info-card__text { font: var(--t-footnote); color: var(--c-text-secondary); }

/* «Радар» switch card */
.radar-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.radar-card__title { font: var(--t-body-strong); }
.radar-card__sub { font: var(--t-footnote); color: var(--c-text-secondary); }

/* point rows: status dot with a halo, name, status chip, chevron */
.prows { padding: 0 var(--sp-3) 0 var(--sp-4); }
.prow { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 68px; padding: 14px 0; text-align: left; }
.prow + .prow { border-top: 1px solid var(--c-fill-secondary); }
.prow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.prow__main .chip-status { margin-top: 6px; }
.prow__addr { font: var(--t-footnote); color: var(--c-text-secondary); }
.prow__title { font: var(--t-headline); }
.prow__side { font: var(--t-footnote); color: var(--c-text-secondary); }
.prow__chev { flex: none; display: inline-flex; color: var(--c-text-secondary); opacity: .7; }
.sdot { width: 16px; height: 16px; flex: none; margin: 5px; border-radius: 50%; background: var(--c-success); box-shadow: 0 0 0 5px rgba(86, 200, 101, 0.15); }
.sdot--alarm { background: var(--c-danger); box-shadow: 0 0 0 5px rgba(239, 58, 58, 0.15); }
.sdot--watch { background: var(--c-warning); box-shadow: 0 0 0 5px rgba(246, 196, 70, 0.18); }
.chip-status { display: inline-flex; align-items: center; max-width: 100%; height: 22px; padding: 0 var(--sp-2); border-radius: 11px; font: var(--t-footnote-strong); white-space: nowrap; }
.chip-status__keep { flex: none; }
.chip-status__cut { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip-status--alarm { background: #FDECEB; color: #C4261D; }
.chip-status--watch { background: #FDF4DC; color: #7A5600; }
.chip-status--none { background: #E8F6EA; color: #2A7A3B; }

/* bezeled button and its icon */
.btn--bezeled { background: var(--c-primary-tint); color: var(--c-primary); font: 590 16px/21px var(--font); }
.btn--danger-bezeled { background: rgba(239, 58, 58, 0.08); color: #E42B22; font: 590 16px/21px var(--font); }
.btn__icon { display: inline-flex; }

/* no points yet (a sheet) */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty__art { display: block; width: 120px; height: 120px; }
.empty__title { margin: var(--sp-5) 0 0; font: 700 22px/28px var(--font); letter-spacing: var(--ls-tight); }
.empty__sub { margin: var(--sp-2) 0 0; font: var(--t-body); color: var(--c-text-secondary); }
.empty__quick { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-6); }
.empty .btn { margin-top: 40px; align-self: stretch; }
.empty__note { margin: var(--sp-3) 0 0; font: var(--t-footnote); color: var(--c-text-secondary); }
.chip-add { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--c-fill-secondary); background: var(--c-surface); display: inline-flex; align-items: center; gap: 6px; font: var(--t-body); }
.chip-add__icon { display: inline-flex; color: var(--c-primary); }
.chip-add__icon svg { width: 16px; height: 16px; }

/* map view: floating cards over the map */
.map-bottom { position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: max(var(--sp-3), calc(var(--safe-bottom) + var(--sp-2))); z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.map-bottom > * { pointer-events: auto; }
.fab-pill { height: var(--h-button); padding: 0 var(--sp-5); border-radius: 24px; background: var(--c-surface); color: var(--c-primary); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16); display: inline-flex; align-items: center; gap: var(--sp-2); font: 590 16px/21px var(--font); white-space: nowrap; }

.float-card { width: 100%; display: flex; flex-direction: column; gap: 14px; padding: var(--sp-4); border-radius: 20px; background: var(--c-surface); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16); }
.float-card__head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.float-card__title { margin: 0; font: var(--t-headline); }
.float-card__sub { display: block; font: var(--t-footnote); color: var(--c-text-secondary); }
.link { flex: none; color: var(--c-primary); font: 590 15px/22px var(--font); }
.icon-btn { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c-bg-alt); color: var(--c-text-secondary); }
.focus-card__disc { width: 44px; height: 44px; flex: none; display: block; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.tile { display: flex; flex-direction: column; padding: 10px var(--sp-3); border-radius: var(--r-s); background: var(--c-bg); }
.tile[hidden] { display: none; }
.tile__v { font: 700 20px/25px var(--font); font-variant-numeric: tabular-nums; }
.tile__k { font: 400 12px/16px var(--font); color: var(--c-text-secondary); }
.shelter-card__disc { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c-primary-tint); color: var(--c-primary); }
.shelter-card__addr { font: var(--t-body); margin-top: 2px; }
.shelter-card .float-card__sub { margin-top: 2px; }

/* map markers */
/* no position here: it would override .maplibregl-marker { position: absolute } and stack markers in flow */
.mpin { --mc: var(--c-success); width: 18px; height: 18px; }
.mpin--alarm { --mc: #EF3A3A; }
.mpin--watch { --mc: #D9A300; }
.mpin__dot { position: absolute; inset: 0; border-radius: 50%; background: #fff; border: 3px solid var(--mc); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.mpin__dot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--mc); }
.mpin__label { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); padding: 2px 8px; border-radius: var(--r-pill); background: #fff; color: #343137; font: var(--t-footnote-strong); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16); white-space: nowrap; }
/* maplibre owns the marker element's transform (position); rotate/scale only the inner icon */
.tmark { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.tmark[data-level="none"] { width: 26px; height: 26px; }
.tmark[data-kind="missile"] { width: 32px; height: 32px; box-shadow: 0 0 0 8px rgba(239, 58, 58, 0.15), 0 2px 6px rgba(0, 0, 0, 0.25); }
.tmark img { width: 100%; height: 100%; display: block; --rot: 0deg; transform: rotate(var(--rot)); }
.tmark[data-level="alarm"][data-kind="drone"] { animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,58,58,.6); } 70% { box-shadow: 0 0 0 14px rgba(239,58,58,0); } 100% { box-shadow: 0 0 0 0 rgba(239,58,58,0); } }
/* «R км» on a zone edge */
.rpill { height: 20px; padding: 0 7px; border-radius: 10px; display: inline-flex; align-items: center; background: #EF3A3A; color: #fff; font: 590 12px/16px var(--font); white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); pointer-events: none; }
.rpill--watch { background: #F6C446; color: #343137; }
.rpill--none { background: var(--c-success); }
.rpill--primary { background: var(--c-primary); }
/* picked shelter: a blue pin with a white house */
.spin { position: relative; width: 32px; height: 40px; pointer-events: none; }
.spin svg { display: block; }
.spin__icon { position: absolute; left: 8px; top: 6px; color: #fff; display: inline-flex; }

/* point form */
.form-head { flex: none; height: var(--h-nav); display: grid; place-items: center; background: var(--c-surface); border-bottom: 1px solid var(--c-fill-secondary); }
.form-head .form-title { font: var(--t-headline); }
.form-map { flex: none; height: 260px; }
.form-map__hint { position: absolute; left: 0; right: 0; bottom: var(--sp-3); z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.form-map__hint .pill { background: rgba(52, 49, 55, 0.88); color: #fff; box-shadow: none; }
.form-body { display: grid; gap: var(--sp-5); padding: var(--sp-5) var(--sp-4) var(--sp-6); }
.form-section { display: grid; gap: var(--sp-2); }
.form-section__label { font: var(--t-footnote); color: var(--c-text-secondary); }
.addr-fields { display: grid; gap: var(--sp-3); }
.nc { display: grid; gap: 14px; padding: 14px var(--sp-4) var(--sp-4); }
.nc__head { display: flex; align-items: center; gap: var(--sp-3); }
.nc__title { display: block; font: var(--t-body-strong); }
.nc__sub { display: block; font: var(--t-footnote); color: var(--c-text-secondary); }
.nc__settings { display: grid; gap: 14px; }
.nc__settings[hidden] { display: none; }
.nc__block { display: grid; gap: var(--sp-2); padding-top: 14px; border-top: 1px solid var(--c-fill-secondary); }
.nc__label { font: var(--t-body-strong); }
.nc__hint { margin: 0; font: var(--t-footnote); color: var(--c-text-secondary); }

