/* Доска идей. Продуктовый интерфейс: спокойная палитра, один акцент (зелёный чай), цвет статуса — только в точках и подчёркивании вкладки. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bg: #f2f0e9;
  --surface: #ffffff;
  --text: #1c2420;
  --accent: #2c6e49;
  --on-accent: #ffffff;
  --accent-text: #2c6e49;
  --danger: #b3261e;
  --warn: #8a5a00;
  --s-new: #b7791f;
  --s-in_progress: #3b6fb6;
  --s-done: #2c6e49;
  --s-postponed: #6b7770;
  --s-rejected: #b3261e;
  --shadow: 0 1px 2px rgb(20 30 24 / 0.06), 0 2px 8px -4px rgb(20 30 24 / 0.1);
  --shadow-lift: 0 2px 4px rgb(20 30 24 / 0.08), 0 10px 24px -10px rgb(20 30 24 / 0.22);
  --scrim: rgb(14 20 16 / 0.42);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181a;
    --surface: #1d2326;
    --text: #e8ece9;
    --accent: #7ac99a;
    --on-accent: #0c1f14;
    --accent-text: #8fd6ac;
    --danger: #ff8f86;
    --warn: #e5b24a;
    --s-new: #e0b04a;
    --s-in_progress: #7aa7e6;
    --s-done: #7ac99a;
    --s-postponed: #9aa6a0;
    --s-rejected: #ff8f86;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.35), 0 12px 28px -10px rgb(0 0 0 / 0.6);
    --scrim: rgb(0 0 0 / 0.6);
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181a;
  --surface: #1d2326;
  --text: #e8ece9;
  --accent: #7ac99a;
  --on-accent: #0c1f14;
  --accent-text: #8fd6ac;
  --danger: #ff8f86;
  --warn: #e5b24a;
  --s-new: #e0b04a;
  --s-in_progress: #7aa7e6;
  --s-done: #7ac99a;
  --s-postponed: #9aa6a0;
  --s-rejected: #ff8f86;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.35), 0 12px 28px -10px rgb(0 0 0 / 0.6);
  --scrim: rgb(0 0 0 / 0.6);
}

/* Производные цвета считаются от основных, поэтому тема Telegram (меняет только --bg/--surface/--text/--accent) подхватывается целиком. */
:root {
  --muted: color-mix(in srgb, var(--text) 70%, var(--surface));
  --line: color-mix(in srgb, var(--text) 14%, var(--surface));
  --line-strong: color-mix(in srgb, var(--text) 30%, var(--surface));
  --wash: color-mix(in srgb, var(--text) 5%, var(--bg));
  --hover: color-mix(in srgb, var(--text) 6%, var(--surface));
  --accent-wash: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --inverse-bg: color-mix(in srgb, var(--text) 92%, var(--surface));
  --inverse-text: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: color-mix(in srgb, var(--text) 32%, transparent) transparent;
  scrollbar-width: thin;
  accent-color: var(--accent);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

body:has(dialog[open]) { overflow: hidden; }

::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1 { font-size: 20px; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 600; }
ul, ol { padding: 0; list-style: none; }
img, video, audio { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 0.18em; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.muted { color: var(--muted); }
.label { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- Кнопки и поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--hover); }
.btn:active { background: color-mix(in srgb, var(--text) 10%, var(--surface)); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; pointer-events: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-primary:active { background: color-mix(in srgb, var(--accent) 78%, var(--text)); }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, var(--text)); }

.btn-icon { width: 38px; padding: 0; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13.5px; }

.btn[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; caret-color: var(--accent-text);
}
textarea { resize: vertical; line-height: 1.45; min-height: 72px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 45%, var(--surface)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--accent-text); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.stack { display: grid; gap: 6px; }

@media (min-width: 768px) {
  input, select, textarea { font-size: 14.5px; }
  .btn { font-size: 14.5px; }
}

/* ---------- Каркас страницы ---------- */

.page { max-width: 1680px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 0 4px; min-height: 56px; }
.top-tools { display: flex; align-items: center; gap: 4px; }
.net {
  font-size: 12.5px; color: var(--warn); padding: 4px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
}

.summary { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 2px 0 14px; }
.summary > div { display: flex; align-items: baseline; gap: 6px; }
.summary dt { color: var(--muted); font-size: 13.5px; }
.summary dd { font-size: 16px; font-weight: 650; }

.toolbar { display: grid; gap: 12px; padding-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.field-search { position: relative; display: block; flex: 1 1 260px; max-width: 420px; }
.field-search .icon { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.field-search input { padding-left: 36px; }
.btn-filters { display: none; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 650; line-height: 20px;
}
.filter-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.field { display: grid; gap: 4px; }
.filter-fields .field { min-width: 0; }
.filter-fields select { min-width: 130px; }
.filter-fields input[type="date"] { min-width: 130px; }

/* ---------- Вкладки (телефон) ---------- */

.tabs { display: none; }

/* ---------- Доска ---------- */

.board {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
  padding-bottom: 8px; align-items: start;
}

.col {
  display: flex; flex-direction: column; gap: 8px; min-height: 14rem; padding: 8px;
  border-radius: 12px; background: var(--wash); border: 1px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}
.col.drop-target { border-color: var(--accent-text); background: var(--accent-wash); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; }
.col-head h2 { font-size: 14px; font-weight: 650; }
.count {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 99px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.col-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col-empty { padding: 20px 8px; text-align: center; color: var(--muted); font-size: 13.5px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.s-new { background: var(--s-new); }
.dot.s-in_progress { background: var(--s-in_progress); }
.dot.s-done { background: var(--s-done); }
.dot.s-postponed { background: var(--s-postponed); }
.dot.s-rejected { background: var(--s-rejected); }

.idea {
  display: grid; gap: 6px; padding: 12px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}
.idea:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.idea[draggable="true"] { cursor: grab; }
.idea.dragging { opacity: 0.45; }
.idea.is-new-ai { border-style: dashed; }
.idea-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; }
.idea-id { font-weight: 600; }
.score {
  padding: 1px 8px; border-radius: 99px; background: var(--accent-wash); color: var(--accent-text);
  font-size: 12.5px; font-weight: 650;
}
.idea-link { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.idea-link:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.idea-title { font-size: 15px; line-height: 1.3; font-weight: 600; }
.idea-summary {
  font-size: 13.5px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.idea-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.pill { padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--text); font-size: 12px; }
.pill-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--surface)); }
.has-files { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.has-files .icon { width: 1.1em; height: 1.1em; }

/* ---------- Состояния: загрузка, пусто, ошибка ---------- */

.skeleton { pointer-events: none; }
.skeleton i {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 50%, var(--surface)) 50%, var(--line) 75%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton i:first-child { width: 30%; }
.skeleton i:nth-child(2) { width: 85%; height: 15px; }
.skeleton i:nth-child(3) { width: 65%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: 12px; padding: 56px 16px; text-align: center;
}
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 34rem; }

.gate { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.gate-box { display: grid; gap: 12px; justify-items: center; max-width: 30rem; text-align: center; }
.gate-box p { color: var(--muted); }
.gate-box p:empty { display: none; }

.form-error { color: var(--danger); font-size: 14px; }

/* ---------- Диалоги ---------- */

dialog { color: var(--text); background: var(--surface); padding: 0; border: 0; }
dialog::backdrop { background: var(--scrim); }

dialog.modal {
  width: min(520px, calc(100vw - 32px)); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lift); max-height: calc(100dvh - 32px); overflow: auto;
}
dialog.modal[open] { animation: pop 0.18s cubic-bezier(0.22, 1, 0.36, 1); }
.modal-form { display: grid; gap: 14px; padding: 20px; }
.modal-form > p { color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.voice-stage { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 0; border-radius: 12px; background: var(--wash); }
.voice-timer { font-size: 32px; font-weight: 650; letter-spacing: 0.02em; }
.voice-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); }
.voice-stage.is-rec .voice-dot { background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
#voice-preview { width: 100%; }

dialog.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(640px, 100vw); max-width: none;
  height: 100vh; height: 100dvh; max-height: none; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: -12px 0 40px -12px rgb(0 0 0 / 0.35); border-left: 1px solid var(--line);
}
dialog.drawer[open] { animation: slide 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes slide { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

dialog.lightbox { margin: auto; max-width: 100vw; max-height: 100dvh; background: transparent; overflow: visible; }
dialog.lightbox img { display: block; max-width: min(96vw, 1400px); max-height: 92dvh; border-radius: 8px; }
.lightbox-close { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; }

/* ---------- Карточка идеи ---------- */

.drawer-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.drawer-head .idea-id { font-size: 15px; color: var(--text); }
.status-now { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { display: grid; gap: 26px; padding: 18px 20px 40px; }
.drawer-body > section { display: grid; gap: 10px; min-width: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sec-head h3 { font-size: 14px; }

.inline {
  width: 100%; min-height: 0; padding: 4px 8px; margin: -4px -8px; width: calc(100% + 16px);
  border: 1px solid transparent; border-radius: 8px; background: transparent; resize: none; overflow: hidden;
}
.inline:hover { border-color: var(--line-strong); background: var(--hover); }
.inline:focus { background: var(--surface); border-color: var(--accent-text); }
.inline-title { font-size: 21px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
.inline-summary { font-size: 16px; line-height: 1.5; }
@media (min-width: 768px) { .inline-summary { font-size: 15px; } .inline-title { font-size: 21px; } }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 13.5px; }
.meta-row select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 14px; }

.retry-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--surface));
}
.retry-note p { flex: 1 1 14rem; font-size: 14px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
}
.seg button:hover { background: var(--hover); }
.seg button[aria-checked="true"] { background: var(--accent-wash); border-color: var(--accent-text); font-weight: 600; }
.seg button[disabled] { opacity: 0.55; cursor: default; }

.original, .ev-text, .refine-body, .transcript {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5;
}
.original { padding: 12px 14px; border-radius: 10px; background: var(--wash); max-width: 75ch; }

.files { display: grid; gap: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--wash); cursor: zoom-in; }
.thumb img { display: block; width: 112px; height: 112px; object-fit: cover; }
.media { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.media audio, .media video { width: 100%; border-radius: 8px; }
.media video { max-height: 320px; background: #000; }
.media-name { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.doc { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.too-large { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--wash); color: var(--muted); font-size: 14px; }
.transcript-box { display: grid; gap: 4px; }
.transcript-box textarea { min-height: 0; font-size: 15px; }
.transcript-note { font-size: 13px; color: var(--muted); }

.total { display: flex; align-items: baseline; gap: 8px; }
.total strong { font-size: 26px; line-height: 1; font-weight: 700; }
.total span { color: var(--muted); font-size: 13.5px; }
.criteria { display: grid; gap: 8px; }
.criterion { display: grid; grid-template-columns: minmax(0, 9rem) 1fr 2.4rem; align-items: center; gap: 10px; font-size: 14px; }
.criterion b { text-align: right; font-weight: 650; }
.bar { height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.bar i { display: block; height: 100%; width: calc(var(--v) * 10%); border-radius: 4px; background: var(--accent); }
.lists { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.lists h4 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.lists li { display: flex; gap: 8px; margin-top: 4px; }
.lists li .icon { margin-top: 0.2em; width: 1.05em; height: 1.05em; }
.lists .ok .icon { color: var(--accent-text); }
.lists .risk .icon { color: var(--warn); }
.verdict { max-width: 75ch; }
.next-step { padding: 10px 12px; border-radius: 10px; background: var(--accent-wash); max-width: 75ch; }
.next-step b { font-weight: 650; }
.stamp { font-size: 12.5px; color: var(--muted); }

.refinement { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.refinement + .refinement { margin-top: 0; }
.refine-body { max-width: 75ch; }
.refine-body h4 { font-size: 14px; margin-top: 10px; }
.refine-body h4:first-child { margin-top: 0; }
.wish-note { font-size: 13.5px; color: var(--muted); }
details.older > summary { cursor: pointer; padding: 8px 0; color: var(--muted); font-size: 13.5px; }
details.older { display: grid; gap: 8px; }

.compose-row { display: grid; gap: 8px; }
.compose-row .btn { justify-self: start; }
.wish-row { display: grid; gap: 4px; }

.timeline { display: grid; gap: 14px; }
.ev { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.ev-ico {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--wash); color: var(--muted);
}
.ev-ico .icon { width: 15px; height: 15px; }
.ev-main { display: grid; gap: 4px; min-width: 0; padding-top: 3px; }
.ev-line { font-size: 14px; overflow-wrap: anywhere; }
.ev-line b { font-weight: 600; }
.ev-time { font-size: 12.5px; color: var(--muted); }
.ev-text { padding: 8px 10px; border-radius: 8px; background: var(--wash); font-size: 14px; max-width: 75ch; }

.danger-zone { padding-top: 6px; border-top: 1px solid var(--line); }

/* ---------- Уведомления ---------- */

.toasts {
  position: fixed; z-index: 1000; left: 50%; translate: -50% 0;
  bottom: max(16px, env(safe-area-inset-bottom)); width: min(480px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; pointer-events: auto;
  background: var(--inverse-bg); color: var(--inverse-text); font-size: 14.5px; box-shadow: var(--shadow-lift);
  animation: pop 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.error { background: var(--danger); color: var(--surface); }
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast button {
  min-height: 32px; padding: 0 10px; border: 1px solid currentColor; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- Телефон ---------- */

@media (max-width: 767.98px) {
  .btn { min-height: 44px; padding: 0 12px; font-size: 15px; }
  .btn-icon { width: 44px; }
  .btn-sm { min-height: 44px; }
  input, select, textarea { min-height: 44px; }
  .seg button { min-height: 44px; }

  .top { min-height: 52px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .btn { white-space: normal; padding: 0 6px; gap: 6px; font-size: 14px; }
  .actions #btn-csv { grid-column: 1 / -1; }

  .field-search { max-width: none; flex: 1 1 0; }
  .btn-filters { display: inline-flex; }
  .filter-fields { display: none; width: 100%; display: none; grid-template-columns: 1fr 1fr; }
  .filter-fields.open { display: grid; }
  .filter-fields select, .filter-fields input[type="date"] { min-width: 0; }
  .filter-fields .field:first-child, .filter-fields .field:nth-child(2) { grid-column: auto; }
  #btn-reset { grid-column: 1 / -1; }

  dialog.drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding-left: 16px; }
  .drawer-body { padding: 16px 16px 40px; }

  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: 0; max-height: 92dvh; }
  .modal-form { padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1 1 auto; }
  .criterion { grid-template-columns: minmax(0, 7.5rem) 1fr 2.2rem; gap: 8px; }
  .thumb img { width: 96px; height: 96px; }
}

@media (min-width: 768px) {
  .toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
  .filter-bar { flex: 1 1 auto; justify-content: flex-end; }
}

@media (min-width: 768px) and (max-width: 1279.98px) {
  .filter-bar { flex-basis: 100%; justify-content: flex-start; }
  .field-search { flex: 0 1 240px; }
}

/* Ниже 1024 px пять колонок не умещаются — вместо них вкладки по статусам. */
@media (max-width: 1023.98px) {
  .tabs {
    position: sticky; top: 0; z-index: 3; display: flex; margin: 0 -16px; padding: 0 16px;
    overflow-x: auto; scroll-snap-type: x proximity; background: var(--bg); border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 48px; padding: 0 12px;
    border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted);
    font: inherit; font-weight: 550; white-space: nowrap; cursor: pointer; scroll-snap-align: center;
  }
  .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-text); font-weight: 650; }
  .tab .count { margin: 0; }

  .board { display: block; overflow: visible; padding-top: 12px; }
  .col { display: none; padding: 0; background: transparent; min-height: 0; }
  .col.is-active { display: flex; }
  .col-head { display: none; }
}

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