/* Спільний вигляд сторінок KyivAlert: кольори Material 3 (світла й темна тема), шрифт Rubik, елементи.
   Тема: <html data-theme="light|dark"> (ставить скрипт у <head>); без скрипту - як у системі. */

@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/rubik-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/rubik-latin-400-normal.woff2) format("woff2"); 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: "Rubik"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/rubik-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/rubik-latin-500-normal.woff2) format("woff2"); 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: "Rubik"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/rubik-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/rubik-latin-600-normal.woff2) format("woff2"); 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; }

/* ---------- кольори: світла тема ---------- */
:root {
  color-scheme: light;
  --primary: #2C5BB8; --on-primary: #FFFFFF;
  --primary-container: #DAE2FF; --on-primary-container: #0B2A63;
  --secondary-container: #DCE2F9; --on-secondary-container: #151B2C;
  --tertiary-container: #FFD8E4; --on-tertiary-container: #31111D;
  --surface: #F9F9FF; --on-surface: #1A1B21; --on-surface-variant: #44464F;
  --sc-lowest: #FFFFFF; --sc-low: #F3F3FA; --sc: #EDEDF4; --sc-high: #E7E7EE; --sc-highest: #E1E2E9;
  --outline: #757780; --outline-variant: #C5C6D0;
  --error: #BA1A1A; --on-error: #FFFFFF; --error-container: #FFDAD6; --on-error-container: #93000A; --on-error-title: #410002;
  --inverse-surface: #2F3036; --inverse-on-surface: #F0F0F7; --inverse-primary: #B1C5FF;
  /* загроза на карті: 1 згадка - помаранчевий, 2 і більше - червоний */
  --threat-1: #F08C00; --threat-1-line: #D97E00; --threat-1-container: #FFDCC1; --on-threat-1-container: #6E3900;
  --threat-2: #E5372B; --threat-2-line: #C62D22; --threat-2-container: #FFDAD6; --on-threat-2-container: #93000A;
  /* повітряна тривога */
  --yellow: #F5C400; --yellow-line: #E8B400; --yellow-container: #FFE08B; --on-yellow-container: #3B2F00; --on-yellow-variant: #4D3D00;
  --red-line: #C62828; --red-container: #FFDAD6; --on-red-container: #410002; --on-red-variant: #93000A;
  --green: #1F7A35; --green-container: #C2EFC6; --on-green-container: #00210A;
  /* картка тривоги: жовтий і червоний рівні - однакові у світлій і темній темі (не затемнюються) */
  --ac-yellow-bg: #FFE08B; --ac-yellow-fg: #3B2F00; --ac-yellow-sub: #4D3D00; --ac-yellow-cookie: #F5C400; --ac-yellow-glyph: #3B2F00;
  --ac-red-bg: #FFDAD6; --ac-red-fg: #410002; --ac-red-sub: #93000A; --ac-red-cookie: #BA1A1A; --ac-red-glyph: #FFFFFF;
  --map-bg: #EEECF2; --label: #1A1B21; --label-halo: #FFFFFF;
  --float: #FFFFFF; --card: #FFFFFF; --ctx: #F3F3FA; --error-ico: #FFB4AB; --nav: #EDEDF4; --sheet: #F3F3FA; --page: #F3F3FA;
  --scrim: rgba(0, 0, 0, .32);
  --elev-1: 0 1px 2px rgba(0, 0, 0, .14), 0 1px 3px 1px rgba(0, 0, 0, .08);
  --elev-2: 0 1px 3px rgba(0, 0, 0, .12), 0 4px 10px rgba(0, 0, 0, .10);
  --elev-3: 0 4px 8px 3px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .18);
  --font: "Rubik", Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

/* ---------- кольори: темна тема ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #B1C5FF; --on-primary: #002C70;
  --primary-container: #0E4396; --on-primary-container: #DAE2FF;
  --secondary-container: #3E4759; --on-secondary-container: #DCE2F9;
  --tertiary-container: #633B48; --on-tertiary-container: #FFD8E4;
  --surface: #121318; --on-surface: #E2E2E9; --on-surface-variant: #C5C6D0;
  --sc-lowest: #0D0E13; --sc-low: #1A1B21; --sc: #1E1F25; --sc-high: #292A2F; --sc-highest: #33353A;
  --outline: #8F9099; --outline-variant: #44464F;
  --error: #FFB4AB; --on-error: #690005; --error-container: #93000A; --on-error-container: #FFDAD6; --on-error-title: #FFDAD6;
  --inverse-surface: #E2E2E9; --inverse-on-surface: #2F3036; --inverse-primary: #2C5BB8;
  --threat-1: #FFB062; --threat-1-line: #FFB062; --threat-1-container: #4D2A00; --on-threat-1-container: #FFDCC1;
  --threat-2: #FF6B5E; --threat-2-line: #FF6B5E; --threat-2-container: #5C1A14; --on-threat-2-container: #FFDAD6;
  --yellow: #F2C94C; --yellow-line: #F2C94C; --yellow-container: #554400; --on-yellow-container: #FFE08B; --on-yellow-variant: #F5DD9A;
  --red-line: #FF8A80; --red-container: #93000A; --on-red-container: #FFDAD6; --on-red-variant: #FFDAD6;
  --green: #7DDA8B; --green-container: #10391A; --on-green-container: #C2EFC6;
  --map-bg: #141318; --label: #E2E2E9; --label-halo: #000000;
  --float: #292A2F; --card: #1E1F25; --ctx: #121318; --error-ico: #690005; --nav: #1E1F25; --sheet: #1A1B21; --page: #121318;
  --scrim: rgba(0, 0, 0, .5);
  --elev-1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px 1px rgba(0, 0, 0, .3);
  --elev-2: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 10px rgba(0, 0, 0, .35);
  --elev-3: 0 4px 8px 3px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .5);
}
/* без скрипту (або до нього) - як у системі */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --primary: #B1C5FF; --on-primary: #002C70; --primary-container: #0E4396; --on-primary-container: #DAE2FF;
    --secondary-container: #3E4759; --on-secondary-container: #DCE2F9;
    --surface: #121318; --on-surface: #E2E2E9; --on-surface-variant: #C5C6D0;
    --sc-lowest: #0D0E13; --sc-low: #1A1B21; --sc: #1E1F25; --sc-high: #292A2F; --sc-highest: #33353A;
    --outline: #8F9099; --outline-variant: #44464F;
    --error: #FFB4AB; --on-error: #690005; --error-container: #93000A; --on-error-container: #FFDAD6;
    --map-bg: #141318;
  }
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: var(--font); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--on-surface); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
/* поля, заповнені браузером автоматично (логін, пароль), - без жовтої чи блакитної заливки браузера */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--on-surface); caret-color: var(--on-surface);
  transition: background-color 600000s 0s, color 600000s 0s;
}
input:autofill { filter: none; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; display: block; }
.ico.s18 { width: 18px; height: 18px; } .ico.s20 { width: 20px; height: 20px; } .ico.s16 { width: 16px; height: 16px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 24px; border: 0; border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 500;
  letter-spacing: .1px; text-decoration: none; background: var(--primary); color: var(--on-primary);
  position: relative; overflow: hidden;
}
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.btn:hover::after { opacity: .08; } .btn:active::after { opacity: .12; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
.btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.danger { background: transparent; color: var(--error); box-shadow: inset 0 0 0 1px var(--outline-variant); }
.btn.block { width: 100%; }

.icon-btn {
  width: 48px; height: 48px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 0;
  border-radius: 24px; background: transparent; color: var(--on-surface-variant); cursor: pointer; position: relative;
}
.icon-btn::after { content: ""; position: absolute; inset: 4px; border-radius: 20px; background: currentColor; opacity: 0; transition: opacity .15s; }
.icon-btn:hover::after { opacity: .08; } .icon-btn:active::after { opacity: .12; }

/* ---------- сегментовані кнопки ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); min-height: 40px;
  border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 10px;
  border: 0; border-left: 1px solid var(--outline); background: transparent; color: var(--on-surface);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; line-height: 1.2; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.seg button[aria-pressed="true"]::before {
  content: ""; width: 14px; height: 9px; flex: none; border-left: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor;
  transform: rotate(-45deg) translate(1px, -2px);
}

/* ---------- перемикач ---------- */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--sc-highest); box-shadow: inset 0 0 0 2px var(--outline);
  transition: background .2s; }
.switch .thumb { position: absolute; left: 8px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline);
  transition: left .2s, width .2s, height .2s, top .2s, background .2s; }
.switch input:checked + .track { background: var(--primary); box-shadow: none; }
.switch input:checked + .track .thumb { left: 24px; top: 4px; width: 24px; height: 24px; background: var(--on-primary); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled { cursor: default; } .switch input:disabled + .track { opacity: .38; }

/* ---------- списки налаштувань (групи по 24 / 4 px) ---------- */
.group { display: flex; flex-direction: column; gap: 2px; margin: 0 0 24px; padding: 0; list-style: none; }
.group > * { background: var(--card); border-radius: 4px; }
.group > :first-child { border-top-left-radius: 24px; border-top-right-radius: 24px; }
.group > :last-child { border-bottom-left-radius: 24px; border-bottom-right-radius: 24px; }
.group-title { margin: 0 4px 8px 16px; font-size: 14px; font-weight: 500; color: var(--primary); letter-spacing: .1px; }
.row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 16px; }
.row.col { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px 16px; }
.row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .t1 { font-size: 16px; line-height: 22px; }
.row .t2 { font-size: 14px; line-height: 19px; color: var(--on-surface-variant); }
button.row, a.row, label.row { width: 100%; border: 0; text-align: left; color: inherit; text-decoration: none; cursor: pointer; font: inherit; }
button.row:hover, a.row:hover, label.row:hover { background: color-mix(in srgb, var(--on-surface) 5%, var(--card)); }
.row .lead { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container); }
.row .chev-r { flex: none; color: var(--on-surface-variant); }

/* ---------- значок ---------- */
.badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--error); color: var(--on-error);
  font-size: 11px; font-weight: 500; line-height: 16px; text-align: center; }

/* ---------- діалог ---------- */
.dlg-backdrop { position: fixed; inset: 0; z-index: 3000; background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.dlg { width: 100%; max-width: 440px; max-height: min(640px, 88vh); display: flex; flex-direction: column;
  background: var(--sc-high); color: var(--on-surface); border-radius: 28px; padding: 24px 0 12px; box-shadow: var(--elev-3); }
.dlg h3 { margin: 0 24px 16px; font-size: 24px; font-weight: 400; line-height: 32px; }
.dlg .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 0; }

/* ---------- поле вводу ---------- */
.field { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 16px; border-radius: 28px;
  background: var(--sc-highest); color: var(--on-surface-variant); }
.field input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; color: var(--on-surface); font-size: 16px; outline: none; }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.field input::placeholder { color: var(--on-surface-variant); }
