/* Фирменный стиль vantron — палитра, шрифты и формы взяты с сайта vantron (Сайт/vantron-site.html) */
:root {
  /* палитра сайта */
  --black: #0a0806;
  --black-2: #151009;
  --white: #fbf9f4;
  --white-2: #ede7da;
  --ink-b: #f5f1e8;
  --ink-b-soft: #a89c86;
  --ink-w: #1c1712;
  --ink-w-soft: #6b5c48;
  --line-b: rgba(245, 241, 232, 0.14);
  --line-w: rgba(28, 23, 18, 0.14);
  --gold: #cf9f4f;
  --gold-ink: #20160a;
  --gold-deep: #7a5719; /* золото для текста на светлом фоне */
  --f-sans: Tahoma, Verdana, "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Courier New", Courier, "Liberation Mono", monospace;

  /* светлая тема (как белые секции сайта) */
  --bg: var(--white);
  --surface: #fffdf8;
  --surface-2: var(--white-2);
  --surface-3: #e2d9c6;
  --text: var(--ink-w);
  --muted: var(--ink-w-soft);
  --border: var(--line-w);
  --accent: var(--gold);
  --accent-text: var(--gold-deep);
  --accent-soft: rgba(207, 159, 79, 0.16);
  --on-accent: var(--gold-ink);
  --danger: #b0372c;
  --danger-soft: rgba(189, 62, 50, 0.12);
  --warn: #8a5d0f;
  --warn-soft: rgba(207, 159, 79, 0.2);
  --ok: #4b6f3a;
  --ok-soft: rgba(87, 126, 68, 0.14);
  --p1: #a89c86;
  --p2: var(--gold);
  --p3: #d9822b;
  --p3-text: #9c5512;
  --p4: #bd3e32;
  --bubble-them: var(--white-2);
  --shadow: none;

  /* навигация всегда тёмная, как шапка сайта */
  --nav-bg: rgba(10, 8, 6, 0.92);
  --nav-text: var(--ink-b-soft);

  --radius: 12px;
  --radius-sm: 7px;
  --nav-w: 248px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 56px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* тёмная тема (как чёрные секции сайта) */
    --bg: var(--black);
    --surface: var(--black-2);
    --surface-2: #1f1810;
    --surface-3: #2b2217;
    --text: var(--ink-b);
    --muted: var(--ink-b-soft);
    --border: var(--line-b);
    --accent-text: var(--gold);
    --accent-soft: rgba(207, 159, 79, 0.14);
    --danger: #e0675b;
    --danger-soft: rgba(189, 62, 50, 0.2);
    --warn: #d5b56d;
    --warn-soft: rgba(213, 181, 109, 0.14);
    --ok: #8ad39a;
    --ok-soft: rgba(87, 126, 68, 0.22);
    --p3-text: #e39a4e;
    --p4: #e0675b;
    --bubble-them: var(--surface-2);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1 { font-size: 30px; line-height: 1.08; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
a { color: var(--accent-text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--f-mono); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

input, textarea, select, button { font: inherit; color: inherit; }
input, textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px; /* iOS не зумит поля от 16px */
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

/* Кнопки — как на сайте: радиус 7px, золото с тёмным текстом */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn-primary:hover { border-color: var(--gold); box-shadow: 0 10px 24px rgba(207, 159, 79, 0.45); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-text); padding: 8px 10px; }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-strong { font-weight: 800; }
.btn-small { min-height: 32px; padding: 4px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-danger-ghost { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { border-color: var(--danger); }
.btn-icon-text svg { width: 18px; height: 18px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* «Надзаголовок» сайта: моно, капс, золотой квадратик */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; background: var(--gold); flex: none; }

/* ---------- Бренд ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1; }
.brand .mark { flex: none; display: block; width: 36px; height: 36px; background: var(--gold); overflow: hidden; }
.brand .mark img { display: block; width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand .word { font-family: var(--f-sans); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; color: var(--ink-b); }
.brand .word .brand-dot { color: var(--gold); }
.brand .brand-tag { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.brand-lg { gap: 16px; }
.brand-lg .mark { width: 56px; height: 56px; }
.brand-lg .word { font-size: 36px; }
.brand-lg .brand-tag { font-size: 12px; }

/* ---------- Splash / вход ---------- */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--black); color: var(--ink-b); z-index: 50; }
.splash img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.94); opacity: 0.7; } }

.login {
  min-height: 100%; display: grid; place-items: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  background: var(--black); color: var(--ink-b);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--black-2); border: 1px solid var(--line-b);
  border-radius: var(--radius); padding: 32px 24px; display: grid; gap: 16px;
}
.login-card .brand { margin-bottom: 6px; }
.login .eyebrow { color: var(--gold); }
.login-card p { margin: 0; }
.login-card .muted { color: var(--ink-b-soft); font-family: var(--f-mono); }
.login input { background: var(--black); border-color: var(--line-b); color: var(--ink-b); }
.login .btn:not(.btn-primary) { color: var(--ink-b); border-color: rgba(245, 241, 232, 0.3); }
.login .btn:not(.btn-primary):hover { border-color: rgba(245, 241, 232, 0.7); }
.pair-login { margin-top: 2px; border-top: 1px dashed var(--line-b); padding-top: 12px; }
.pair-login summary { cursor: pointer; color: var(--gold); font-family: var(--f-mono); font-size: 14px; list-style: none; padding: 6px 0; }
.pair-login summary::-webkit-details-marker { display: none; }
.pair-login summary::before { content: "> "; }
.pair-login form { margin-top: 10px; }
.dev-login { border-top: 1px dashed var(--line-b); padding-top: 14px; }
.form-error { color: #e0675b; margin: 0; font-size: 14px; }

/* ---------- Раскладка ---------- */
.app { height: 100%; display: flex; }
.main { flex: 1; min-width: 0; height: 100%; overflow: hidden; }
.view { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(16px + var(--safe-top)) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--nav-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-b);
}
.nav-brand, .nav-foot { display: none; }
.nav-item {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--nav-text); text-decoration: none; font-family: var(--f-mono); font-size: 11px;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--gold); }
.nav-badge {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 4px;
  background: #bd3e32; color: #fff; font: 700 11px/18px var(--f-sans); text-align: center;
}
.nav-badge-warn { background: var(--gold); color: var(--gold-ink); }

@media (min-width: 900px) {
  .nav {
    position: static; flex-direction: column; justify-content: flex-start; gap: 2px;
    width: var(--nav-w); height: 100%; padding: 22px 14px; border-top: 0; border-right: 1px solid var(--line-b);
    background: var(--black); backdrop-filter: none;
  }
  .nav-brand { display: flex; padding: 2px 8px 26px; }
  .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm); font-size: 15px; color: var(--ink-b-soft);
    border-left: 2px solid transparent;
  }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-item:hover { color: var(--ink-b); background: rgba(245, 241, 232, 0.04); }
  .nav-item.active { color: var(--ink-b); background: rgba(207, 159, 79, 0.12); border-left-color: var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
  .nav-item.active svg { color: var(--gold); }
  .nav-badge { position: static; margin-left: auto; }
  .nav-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 8px 0; font-size: 14px; color: var(--ink-b-soft); border-top: 1px solid var(--line-b); }
  .view { padding: 32px 36px 40px; }
  .view > * { max-width: 920px; margin-left: auto; margin-right: auto; }
}

/* ---------- Аватары (квадратные, как знак бренда) ---------- */
.avatar {
  --c: var(--gold);
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 5px;
  background: var(--c); color: var(--gold-ink); font: 700 11px/1 var(--f-sans); letter-spacing: -0.02em;
}
.avatar-lg { width: 36px; height: 36px; font-size: 14px; border-radius: var(--radius-sm); }
.avatar-all { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }

/* ---------- Задачи ---------- */
.tasks-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: transparent; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--muted); }
.chip b { font: 600 13px var(--f-mono); color: var(--muted); }
.chip.active { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.chip.active b { color: var(--gold-ink); opacity: 0.75; }
.chip.chip-danger b { color: var(--danger); }
.chip.chip-danger.active { background: var(--p4); border-color: var(--p4); color: #fff; }
.chip.chip-danger.active b { color: #fff; }
@media (min-width: 900px) { .chips { margin: 0; padding: 0; flex-wrap: wrap; } }

.tasks-tools { display: flex; gap: 8px; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { padding-left: 36px; }
.tasks-tools select { width: auto; }

.quick-add {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius); padding: 3px 14px; margin-bottom: 22px;
  transition: border-color 0.15s;
}
.quick-add:focus-within { border-color: var(--gold); border-style: solid; }
.quick-add svg { color: var(--gold); }
.quick-add input { background: transparent; padding: 10px 0; border: 0; box-shadow: none !important; font-family: var(--f-mono); font-size: 15px; }
.quick-add input::placeholder { text-overflow: ellipsis; }

.group { margin-bottom: 22px; }
.group-title {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 9px;
  font: 600 12px var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.group-title::before { content: ""; width: 7px; height: 7px; background: var(--muted); opacity: 0.6; }
.group-title .count { opacity: 0.7; }
.group-overdue .group-title { color: var(--danger); }
.group-overdue .group-title::before { background: var(--danger); opacity: 1; }
.group-today .group-title { color: var(--accent-text); }
.group-today .group-title::before { background: var(--gold); opacity: 1; }
.group-cards { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px; cursor: pointer; position: relative;
  transition: background 0.15s;
}
.task + .task::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; border-top: 1px dashed var(--border); }
.task:hover { background: var(--accent-soft); }
.task.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(207, 159, 79, 0.35); } }

.check {
  --pc: var(--p2);
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 5px;
  border: 2px solid var(--pc); background: transparent; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.check svg { width: 14px; height: 14px; stroke-width: 3; }
.check:hover { background: color-mix(in srgb, var(--pc) 18%, transparent); color: var(--pc); }
.check:active { transform: scale(0.88); }
.check.done { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.p1 { --pc: var(--p1); } .p2 { --pc: var(--p2); } .p3 { --pc: var(--p3); } .p4 { --pc: var(--p4); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 700; word-wrap: break-word; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.task-notes { color: var(--muted); font: 13px var(--f-mono); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted); font: 12px var(--f-mono); white-space: nowrap;
}
.tag svg { width: 13px; height: 13px; }
.tag-overdue { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.tag-soon { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-progress { background: transparent; color: var(--accent-text); border: 1px solid var(--gold); }
.tag-p3 { background: rgba(217, 130, 43, 0.14); color: var(--p3-text); font-weight: 700; }
.tag-p4 { background: var(--danger-soft); color: var(--p4); font-weight: 700; }
.task-side { display: flex; align-items: center; gap: 6px; margin-top: 1px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); font-family: var(--f-mono); }
.empty-icon { font-size: 36px; margin-bottom: 10px; }

/* ---------- Окно редактора ---------- */
.sheet {
  border: 1px solid var(--border); padding: 0; margin: auto; width: min(560px, 100%); max-height: min(92vh, 900px);
  background: var(--bg); color: var(--text); border-radius: var(--radius); box-shadow: 0 50px 90px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(10, 8, 6, 0.55); backdrop-filter: blur(3px); }
.sheet[open] { animation: sheet-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); display: flex; flex-direction: column; }
.sheet form { display: flex; flex-direction: column; min-height: 0; height: 100%; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (max-width: 640px) {
  .sheet { margin: auto 0 0; width: 100%; max-width: 100%; max-height: calc(100% - var(--safe-top) - 12px); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-family: var(--f-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-body { padding: 18px 16px; overflow-y: auto; display: grid; gap: 18px; padding-bottom: calc(20px + var(--safe-bottom)); }
.input-title { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; background: transparent; padding: 4px 0; border-radius: 0; border: 0; border-bottom: 1px solid var(--border); }
.input-title:focus { background: transparent; border-color: var(--gold); box-shadow: none; }

.field { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.field legend, .legend {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 11.5px var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); padding: 0; margin-bottom: 8px;
}
.field legend::before, .legend::before { content: ""; width: 6px; height: 6px; background: var(--gold); }
label.field .legend { margin-bottom: 0; }
.due-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.due-quick button { border: 1px solid var(--border); background: transparent; border-radius: var(--radius-sm); padding: 5px 11px; font-size: 14px; cursor: pointer; }
.due-quick button:hover { border-color: var(--muted); }
.due-quick button.active { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 700; }
.field .row input[type="date"] { flex: 1.3; min-width: 0; }
.field .row input[type="time"] { flex: 1; min-width: 0; }

.segmented { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; background: var(--surface); }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px 4px; border-radius: 5px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segmented input:checked + span { background: var(--gold); color: var(--gold-ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); }
.seg-priority label:nth-child(3) input:checked + span { background: var(--p3); color: #fff; }
.seg-priority label:nth-child(4) input:checked + span { background: var(--p4); color: #fff; }
.seg-priority label:nth-child(1) input:checked + span { background: var(--surface-3); color: var(--text); }
.task-meta { margin: 0; font-family: var(--f-mono); }

/* ---------- Чат ---------- */
.view-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.view-chat > * { width: 100%; }
.chat-head {
  margin: 0; padding: calc(10px + var(--safe-top)) 16px 10px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.chat-peer { display: flex; align-items: center; gap: 12px; }
.chat-peer .name { font-weight: 800; font-size: 16px; }
.chat-peer .status { font: 12px var(--f-mono); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chat-peer .status.online { color: var(--ok); }
.chat-peer .status.online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chat-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px 8px; overscroll-behavior: contain; }
.load-more { display: flex; margin: 0 auto 8px; }
.chat-list { display: flex; flex-direction: column; gap: 2px; }
.day-sep {
  align-self: center; margin: 14px 0 8px; padding: 2px 10px;
  font: 11.5px var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 5px;
}
.msg { display: flex; max-width: min(78%, 560px); }
.msg.mine { align-self: flex-end; }
.msg + .msg:not(.cont) { margin-top: 6px; }
.bubble {
  padding: 7px 12px 6px; border-radius: var(--radius); background: var(--bubble-them); border: 1px solid var(--border);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; position: relative;
}
.msg.mine .bubble { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.msg.mine .bubble a { color: var(--gold-ink); }
.msg:not(.mine) .bubble { border-bottom-left-radius: 3px; }
.msg.mine .bubble { border-bottom-right-radius: 3px; }
.msg.cont:not(.mine) .bubble { border-top-left-radius: 3px; }
.msg.cont.mine .bubble { border-top-right-radius: 3px; }
.bubble .meta { float: right; margin: 6px 0 -4px 10px; font: 11px var(--f-mono); opacity: 0.65; display: inline-flex; align-items: center; gap: 2px; user-select: none; }
.bubble .meta svg { width: 15px; height: 15px; stroke-width: 2.4; }
.msg.pending .bubble { opacity: 0.65; }
.msg.failed .bubble { background: var(--p4); border-color: var(--p4); color: #fff; cursor: pointer; }
.typing { display: inline-flex; gap: 4px; padding: 11px 14px; border-radius: var(--radius); background: var(--bubble-them); border: 1px solid var(--border); margin-top: 6px; }
.typing span { width: 6px; height: 6px; background: var(--gold); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 12px calc(8px + var(--tabbar-h) + var(--safe-bottom));
  border-top: 1px solid var(--border); background: var(--surface);
}
.composer textarea { resize: none; max-height: 160px; min-height: 42px; border-radius: var(--radius); padding: 9px 14px; line-height: 1.4; background: var(--bg); }
.send {
  flex: none; width: 42px; height: 42px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: var(--gold); color: var(--gold-ink); display: grid; place-items: center;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
}
.send svg { stroke-width: 2.6; }
.send:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(207, 159, 79, 0.45); }
.send:disabled { opacity: 0.35; cursor: default; }
.send:active:not(:disabled) { transform: scale(0.9); }
/* Когда открыта клавиатура на телефоне — прячем нижнее меню */
body.keyboard .nav { display: none; }
body.keyboard .composer { padding-bottom: 8px; }

@media (min-width: 900px) {
  /* шапка, лента и поле ввода чата — на всю ширину, содержимое по центру */
  .view-chat > * { max-width: none; margin: 0; }
  .chat-head { padding: 16px max(36px, calc((100% - 920px) / 2)); }
  .chat-scroll { padding: 16px max(36px, calc((100% - 920px) / 2)); }
  .composer { padding: 12px max(36px, calc((100% - 920px) / 2)) 16px; }
}

.push-hint { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid rgba(207, 159, 79, 0.35); font: 13.5px var(--f-mono); }
.push-hint .btn { margin-left: auto; flex: none; }

/* ---------- Настройки ---------- */
.settings { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.card p { margin: 0; }
.card .muted { font-family: var(--f-mono); }
.status-line { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.dot { width: 8px; height: 8px; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pair-code { font: 700 34px/1 var(--f-mono); letter-spacing: 0.2em; text-align: center; padding: 14px; background: var(--black); color: var(--gold); border-radius: var(--radius-sm); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-family: var(--f-mono); font-size: 14px; }
.ios-share { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; }

/* ---------- Уведомление внизу ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); transform: translateX(-50%);
  background: var(--black); color: var(--ink-b); border: 1px solid var(--line-b); padding: 11px 16px; border-radius: var(--radius-sm);
  font: 14px var(--f-mono); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  z-index: 100; max-width: calc(100% - 32px); display: flex; gap: 14px; align-items: center;
  animation: toast-in 0.2s ease-out;
}
.toast button { background: none; border: 0; color: var(--gold); font: 700 14px var(--f-mono); cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (min-width: 900px) { .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
