/* NS Real Estate — «Ночной залив». Все цвета в токенах: бренд меняется одним набором. */
@font-face { font-family: 'Geologica'; font-weight: 300 600; font-display: swap;
  src: url('/fonts/geologica-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Geologica'; font-weight: 300 600; font-display: swap;
  src: url('/fonts/geologica-latin-ext.woff2') format('woff2');
  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; }
@font-face { font-family: 'Geologica'; font-weight: 300 600; font-display: swap;
  src: url('/fonts/geologica-latin.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 {
  --bg: #F3F4F8; --surface: #FFFFFF; --input: #F8F9FC; --ink: #0E1730; --muted: #58627E; --line: #DDE1EB;
  --primary: #15234A; --on-primary: #F4EEDC; --accent: #94700F; --accent-soft: #F3EAD2;
  --ok: #1F7050; --ok-bg: #E0F0E8; --warn: #8A5A0A; --warn-bg: #F5EBD6; --err: #B0352B; --err-bg: #F8E2DF;
  --disabled: #D9DDE8; --on-disabled: #7A849A;
  --pad: 22px; --gap: 18px; --field-h: 56px; --r-field: 16px; --r-card: 18px; --r-chip: 12px; --r-small: 14px;
  --shadow-toast: 0 12px 32px -8px rgba(0,0,0,.35); --shadow-soft: 0 8px 24px -10px rgba(0,0,0,.25);
  --font: 'Geologica', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --app-h: 100dvh; --app-top: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1020; --surface: #121B33; --input: #0E162B; --ink: #EEF1F8; --muted: #9AA4BF; --line: #26314F;
    --primary: #E8D6A4; --on-primary: #0A1020; --accent: #E2C472; --accent-soft: #2B2A22;
    --ok: #74CFA4; --ok-bg: #12291F; --warn: #F0BE62; --warn-bg: #2B2516; --err: #F59286; --err-bg: #3A1C1E;
    --disabled: #1F2943; --on-disabled: #6E789A;
    --shadow-toast: 0 12px 32px -8px rgba(0,0,0,.7); --shadow-soft: 0 8px 24px -10px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Каркас экрана: шапка / скролл / низ ---------- */
#app { position: fixed; left: 0; right: 0; top: var(--app-top); height: var(--app-h); display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto; background: var(--bg); }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.safe-top { padding-top: env(safe-area-inset-top); flex: none; padding-bottom: 1px; transition: box-shadow .15s; position: relative; z-index: 1; background: var(--bg); }
.safe-top.scrolled { box-shadow: 0 1px 0 var(--line); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }
.fade-bottom { position: sticky; bottom: 0; height: 48px; margin-top: -48px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg)); }
.bottom { flex: none; background: var(--bg); border-top: 1px solid var(--line);
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); position: relative; z-index: 2; }
.keyboard-open .bottom { padding-bottom: 12px; }

/* ---------- Шапка ---------- */
.hdr { padding: 4px var(--pad) 0; display: flex; flex-direction: column; gap: 12px; }
.hdr-row { display: flex; align-items: center; gap: 12px; }
.hdr-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.hdr-title { font-size: 14px; font-weight: 500; color: var(--accent); white-space: nowrap; border-radius: 6px;
  padding: 2px 6px; margin: -2px -6px; transition: background-color .15s, opacity .15s; }
.hdr-title.hl { background: var(--accent-soft); }
.hdr-title.fade { opacity: 0; }
.hdr-name { font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hdr-count { display: flex; flex-direction: column; align-items: flex-end; }
.hdr-count small { font-size: 11px; color: var(--muted); }
.hdr-count b { font-size: 20px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 48px; display: flex; align-items: center; justify-content: center; margin-right: -10px; border-radius: 12px; position: relative; }
.progress { height: 2px; background: var(--line); border-radius: 1px; overflow: hidden; }
.progress > i { display: block; height: 2px; background: var(--accent); width: 0; transition: width .15s ease-out; }
.progress.reset > i { transition: none; }
.hdr-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-height: 16px; }
.net { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ok); font-weight: 500; }
.net::before { content: ''; width: 7px; height: 7px; border-radius: 4px; background: currentColor; }
.net.off { color: var(--warn); }
.dot-badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Форма ---------- */
.form { padding: 20px var(--pad) 24px; display: flex; flex-direction: column; gap: var(--gap); }
.form-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
h1 { font-size: 26px; font-weight: 500; margin: 0; letter-spacing: -.01em; }
.sq-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); display: flex; align-items: center; justify-content: center; position: relative; flex: none; }
.sq-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 14px; font-weight: 600; color: var(--muted); }
.cat-field { gap: 8px; }
.input { height: var(--field-h); border-radius: var(--r-field); background: var(--input); border: 1px solid var(--line);
  padding: 0 14px; font-size: 17px; width: 100%; outline: none; transition: border-color .15s; }
.input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
.input:focus, textarea:focus { border-color: var(--accent); }
.input.invalid, textarea.invalid { border: 1.5px solid var(--err); }
.err-text { font-size: 13px; color: var(--err); }
textarea.input { height: auto; min-height: 72px; padding: 12px 14px; font-size: 16px; line-height: 1.4; resize: none; overflow: hidden; display: block; }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.chip { min-height: 48px; padding: 6px 12px; border-radius: var(--r-chip); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); display: flex; align-items: center; text-align: left; font-size: 14px; line-height: 1.2; font-weight: 500;
  transition: background-color .12s, color .12s, border-color .12s; }
.chip[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chips.invalid .chip:not([aria-checked="true"]) { border-color: var(--err); }

.phone-row { display: flex; gap: 8px; }
.cc-btn { height: var(--field-h); border-radius: var(--r-field); background: var(--input); border: 1px solid var(--line);
  padding: 0 10px 0 12px; display: flex; align-items: center; gap: 6px; font-size: 17px; flex: none; }
.cc-btn .flag { font-size: 20px; line-height: 1; }
.phone-row .input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.x-btn { width: 48px; height: var(--field-h); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; margin-left: -4px; }
.link-btn { height: 40px; display: flex; align-items: center; font-size: 15px; font-weight: 500; color: var(--accent); align-self: flex-start; margin-top: -8px; }

/* ---------- Кнопки ---------- */
.btn { height: 60px; width: 100%; border-radius: 18px; background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 600; transition: background-color .15s, transform .08s; }
.btn:active { transform: scale(.985); }
.btn[aria-disabled="true"] { background: var(--disabled); color: var(--on-disabled); }
.btn-s { height: 48px; border-radius: var(--r-small); padding: 0 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-s.pri { background: var(--primary); color: var(--on-primary); }
.btn-s.out { border: 1px solid var(--line); background: var(--surface); font-weight: 500; }
.btn-s.danger { color: var(--err); }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }

/* ---------- Баннеры ---------- */
.banner { background: var(--accent-soft); border-radius: var(--r-card); padding: 6px 6px 6px 16px; display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 1.35; }
.banner > span { flex: 1; }
.banner .txt-btn { height: 48px; padding: 0 12px; font-size: 15px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.dup { background: var(--warn-bg); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.4; }
.dup .muted { color: var(--muted); }
.dup .btn-s.pri { flex: 1.4; }

/* ---------- Голосовая заметка ---------- */
.rec-idle { height: var(--field-h); border-radius: var(--r-field); border: 1px dashed var(--line); display: flex; align-items: center; gap: 10px; padding: 0 14px; font-size: 16px; font-weight: 500; width: 100%; text-align: left; }
.rec-idle .hint { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.rec-card { border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.rec-card.warn { border-color: var(--warn); }
.rec-card.denied { background: var(--err-bg); border: 0; padding: 16px; gap: 8px; }
.rec-card p { margin: 0; font-size: 15px; line-height: 1.45; }
.rec-denied-head { display: flex; gap: 10px; align-items: flex-start; color: var(--err); font-size: 15px; font-weight: 600; line-height: 1.35; }
.rec-denied-help { font-size: 14px; line-height: 1.45; padding-left: 30px; }
.rec-time { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--err); box-shadow: 0 0 0 4px var(--err-bg); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--err-bg); } }
.rec-time b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-card.warn .rec-time b { color: var(--warn); }
.rec-time span { font-size: 15px; color: var(--muted); }
.rec-warn-text { font-size: 14px; line-height: 1.4; color: var(--warn); }
.wave { height: 36px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.wave i { width: 3px; flex: none; border-radius: 2px; background: var(--accent); min-height: 3px; }
.wave i.empty { background: var(--line); }
.stop-sq { width: 12px; height: 12px; border-radius: 2px; background: currentColor; }
.player { display: flex; align-items: center; gap: 12px; }
.play { width: 48px; height: 48px; border-radius: 24px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; flex: none; }
.track { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.track > i { display: block; height: 4px; background: var(--accent); width: 0; }
.player .num { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* ---------- Тосты ---------- */
.toast-wrap { position: absolute; left: var(--pad); right: var(--pad); bottom: calc(100% + 12px); pointer-events: none; display: flex; flex-direction: column; gap: 8px; }
.toast { border-radius: var(--r-card); padding: 14px 16px; display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.4;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-toast);
  animation: toast-in .2s ease-out; }
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast.ok { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.toast.ok .msg { font-weight: 600; }
.toast .msg { flex: 1; }
.toast .cheer { font-size: 14px; opacity: .8; white-space: nowrap; }
.toast .wdot { width: 8px; height: 8px; border-radius: 4px; background: var(--warn); flex: none; align-self: flex-start; margin-top: 7px; }
.toast .eicon { color: var(--err); }
.toast.title { box-shadow: var(--shadow-soft); font-size: 14px; }
.toast.title .muted { color: var(--muted); }
.toast.title b { color: var(--accent); font-weight: 600; }
.toast-top { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: var(--pad); right: var(--pad); max-width: 516px; margin: 0 auto; z-index: 40; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Листы / меню / диалоги ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(5, 10, 25, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade-in .15s; }
.overlay.top { align-items: flex-start; background: transparent; }
@keyframes fade-in { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 86vh; background: var(--surface); border-radius: 24px 24px 0 0; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .5; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 4px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px var(--pad); flex: none; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.sheet-search { margin: 0 var(--pad) 8px; position: relative; flex: none; }
.sheet-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sheet-search .input { padding-left: 42px; height: 48px; }
.sheet-list { overflow-y: auto; padding: 0 0 12px; overscroll-behavior: contain; }
.sheet-sec { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px var(--pad) 4px; text-transform: uppercase; letter-spacing: .04em; }
.row-btn { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 var(--pad); text-align: left; font-size: 16px; }
.row-btn:active, .row-btn.sel { background: var(--input); }
.row-btn .flag { font-size: 22px; }
.row-btn .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-btn .code { color: var(--muted); font-variant-numeric: tabular-nums; }
.menu { margin: calc(env(safe-area-inset-top) + 56px) 12px 0 auto; width: min(280px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-toast); padding: 6px; animation: fade-in .12s; }
.menu .row-btn { padding: 0 12px; border-radius: 12px; min-height: 48px; font-size: 16px; gap: 12px; }
.menu .row-btn .meta { margin-left: auto; font-size: 13px; color: var(--muted); }
.menu .row-btn .meta.acc { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.dialog { width: calc(100% - 24px); max-width: 420px; background: var(--surface); border-radius: 24px; padding: 22px; margin: auto auto calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px; animation: sheet-in .2s ease-out; }
.dialog h2 { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.3; }
.dialog p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }

/* ---------- Мои заявки ---------- */
.topbar { display: flex; align-items: center; gap: 4px; padding: 0 var(--pad) 0 6px; height: 52px; flex: none; }
.topbar h1 { font-size: 26px; }
.back { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.list-wrap { padding: 8px var(--pad) 24px; display: flex; flex-direction: column; gap: var(--gap); }
.pending-card { background: var(--warn-bg); border-radius: var(--r-card); padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 12px; }
.pending-card > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pending-card b { font-size: 15px; font-weight: 600; }
.pending-card small { font-size: 13px; color: var(--muted); }
.sec-title { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: -8px; }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; min-width: 0; }
.item-meta .cat { overflow: hidden; text-overflow: ellipsis; }
.pill { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.pending { color: var(--warn); background: var(--warn-bg); }
.pill.sending { color: var(--muted); background: var(--input); }
.pill.sent { color: var(--ok); background: var(--ok-bg); }
.pill.error { color: var(--err); background: var(--err-bg); }
.retry { height: 36px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--err); color: var(--err); font-size: 13px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; font-size: 16px; line-height: 1.5; }

/* ---------- Вход / сообщения ---------- */
.intro { flex: 1; display: flex; flex-direction: column; padding: 32px var(--pad) 0; gap: 20px; overflow-y: auto; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; letter-spacing: .02em; }
.greet { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.greet small { font-size: 17px; color: var(--muted); }
.greet h1 { font-size: 36px; line-height: 1.15; font-weight: 500; text-wrap: balance; }
.greet h1 em { font-style: normal; color: var(--accent); }
.intro > p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.a2hs { margin-top: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.a2hs-head { display: flex; gap: 12px; align-items: flex-start; }
.a2hs-head b { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; }
.a2hs-head button { width: 32px; height: 32px; margin: -6px -6px 0 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.seg { display: flex; background: var(--input); border-radius: 12px; padding: 3px; border: 1px solid var(--line); }
.seg button { flex: 1; text-align: center; padding: 8px; font-size: 14px; color: var(--muted); border-radius: 10px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.steps { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.4; }
.steps div { display: flex; gap: 10px; align-items: center; }
.steps span { width: 22px; height: 22px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.intro-bottom { padding: 16px var(--pad) calc(16px + env(safe-area-inset-bottom)); flex: none; }
.msg-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--warn-bg); color: var(--warn); display: flex; align-items: center; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
