/* Helm — стили. Светлая и тёмная темы, адаптив для телефона. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-text: #075985;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #16a34a;
  --warn: #d97706;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 248px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --c-gray-bg: #f1f3f5;   --c-gray-fg: #4b5563;
  --c-blue-bg: #e0f2fe;   --c-blue-fg: #075985;
  --c-green-bg: #dcfce7;  --c-green-fg: #166534;
  --c-yellow-bg: #fef9c3; --c-yellow-fg: #854d0e;
  --c-orange-bg: #ffedd5; --c-orange-fg: #9a3412;
  --c-red-bg: #fee2e2;    --c-red-fg: #991b1b;
  --c-purple-bg: #ede9fe; --c-purple-fg: #5b21b6;
  --c-teal-bg: #ccfbf1;   --c-teal-fg: #115e59;
  --c-pink-bg: #fce7f3;   --c-pink-fg: #9d174d;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #1a2333;
  --line: #243045;
  --line-strong: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #38bdf8;
  --accent-soft: #0c2a3d;
  --accent-text: #7dd3fc;
  --danger: #f87171;
  --danger-soft: #3b1212;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);

  --c-gray-bg: #1f2937;   --c-gray-fg: #cbd5e1;
  --c-blue-bg: #0c2a3d;   --c-blue-fg: #7dd3fc;
  --c-green-bg: #0f2e1c;  --c-green-fg: #86efac;
  --c-yellow-bg: #332a0b; --c-yellow-fg: #fde68a;
  --c-orange-bg: #3a1d0b; --c-orange-fg: #fdba74;
  --c-red-bg: #3b1212;    --c-red-fg: #fca5a5;
  --c-purple-bg: #261a45; --c-purple-fg: #c4b5fd;
  --c-teal-bg: #0b2e2b;   --c-teal-fg: #5eead4;
  --c-pink-bg: #3a1028;   --c-pink-fg: #f9a8d4;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; font-weight: 700; font-size: 22px; color: var(--muted); letter-spacing: .04em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--panel) var(--sidebar), var(--bg) var(--sidebar)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; font-weight: 750; font-size: 17px; letter-spacing: .01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius-sm);
  text-align: left; cursor: pointer; color: var(--text); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .count.hot { color: var(--danger); font-weight: 650; }
.nav-item .lock { font-size: 11px; opacity: .6; }
.sidebar .spacer { flex: 1; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 span.t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .grow { flex: 1; }
.menu-btn { display: none; }
.content { padding: 20px 22px 80px; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #04131f; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 6px 8px; }
.btn.ai { border-color: transparent; background: linear-gradient(135deg, #0ea5e9, #8b5cf6); color: #fff; }
.btn.ai:hover { filter: brightness(1.08); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--panel);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--danger); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 11px; cursor: pointer; font-weight: 550; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { width: 34px; height: 20px; appearance: none; background: var(--line-strong); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

/* ---------- Метки ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.tag.c-gray { background: var(--c-gray-bg); color: var(--c-gray-fg); }
.tag.c-blue { background: var(--c-blue-bg); color: var(--c-blue-fg); }
.tag.c-green { background: var(--c-green-bg); color: var(--c-green-fg); }
.tag.c-yellow { background: var(--c-yellow-bg); color: var(--c-yellow-fg); }
.tag.c-orange { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.tag.c-red { background: var(--c-red-bg); color: var(--c-red-fg); }
.tag.c-purple { background: var(--c-purple-bg); color: var(--c-purple-fg); }
.tag.c-teal { background: var(--c-teal-bg); color: var(--c-teal-fg); }
.tag.c-pink { background: var(--c-pink-bg); color: var(--c-pink-fg); }
.ref { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); font-size: 12.5px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.due { font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.over { color: var(--danger); font-weight: 650; }
.due.soon { color: var(--warn); font-weight: 600; }
.due.today { color: var(--accent-text); font-weight: 650; }

/* ---------- Карточки и дашборд ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; font-weight: 700; }
.card-h .muted { font-weight: 500; }
.card-b { padding: 6px 16px 14px; }
.hello { margin: 2px 0 18px; }
.hello h2 { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; cursor: pointer; text-align: left; border: 1px solid var(--line); }
.stat:hover { border-color: var(--line-strong); }
.stat .n { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat.hot .n { color: var(--danger); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .wide { grid-column: 1 / -1; }
.dash > *, .stats > * { min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list li:first-child { border-top: 0; }
.list li:hover .ttl { color: var(--accent-text); }
.done-btn { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: none; cursor: pointer; flex-shrink: 0; padding: 0; display: grid; place-items: center; font-size: 11px; color: transparent; }
.done-btn:hover { border-color: var(--ok); color: var(--ok); }
.list .ttl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 520; }
.list .meta { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.empty { color: var(--muted); padding: 10px 0; }
.progress { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, #22c55e); border-radius: 999px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.banner .grow { flex: 1; }

.ai-out { font-size: 14px; line-height: 1.55; }
.ai-out h3 { font-size: 14.5px; margin: 14px 0 4px; }
.ai-out h3:first-child { margin-top: 2px; }
.ai-out ul, .ai-out ol { margin: 4px 0 8px; padding-left: 20px; }
.ai-out p { margin: 6px 0; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 4px 0 8px; padding-left: 20px; } .md h3 { margin: 10px 0 4px; font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Таблица ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .search { max-width: 220px; }
.toolbar .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--muted); }
.chip.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
table.grid th, table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { position: sticky; top: 0; background: var(--panel-2); font-size: 12px; color: var(--muted); font-weight: 650; cursor: pointer; user-select: none; white-space: nowrap; z-index: 1; }
table.grid th .arrow { opacity: .7; margin-left: 4px; }
table.grid tbody tr.rec { cursor: pointer; }
table.grid tbody tr.rec:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td { max-width: 380px; }
table.grid td .clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.grid td.primary { font-weight: 560; }
table.grid tr.done td.primary { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
table.grid tr.group td { background: var(--bg); font-weight: 700; font-size: 13px; padding-top: 14px; cursor: default; }
table.grid tr.total td { background: var(--panel-2); font-weight: 700; }
table.grid select.cell { border: 0; background: transparent; padding: 0; cursor: pointer; max-width: 160px; }
.add-row { padding: 10px 12px; color: var(--muted); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-weight: 550; }
.add-row:hover { color: var(--accent-text); background: var(--panel-2); }

/* ---------- Доска ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--panel-2); border-radius: var(--radius); padding: 10px; min-height: 120px; border: 1px solid transparent; }
.col.drop { border-color: var(--accent); background: var(--accent-soft); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 700; }
.col-h .n { color: var(--muted); font-weight: 550; font-size: 12.5px; }
.bcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.bcard:hover { border-color: var(--line-strong); }
.bcard.dragging { opacity: .5; }
.bcard .t { font-weight: 560; margin-bottom: 6px; }
.bcard .m { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.bcard.done .t { text-decoration: line-through; color: var(--muted); }

/* ---------- Панель записи ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 50; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel); z-index: 51; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .16s ease-out; border-left: 1px solid var(--line);
}
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-h .crumb { color: var(--muted); font-size: 13px; font-weight: 550; display: flex; gap: 6px; align-items: center; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.title-input { width: 100%; border: 0; background: transparent; font-size: 21px; font-weight: 720; padding: 4px 0 12px; resize: none; line-height: 1.3; }
.title-input:focus { outline: none; }
.props { display: grid; grid-template-columns: 170px 1fr; gap: 4px 14px; align-items: start; margin-bottom: 8px; }
.props > .k { color: var(--muted); font-size: 13px; padding-top: 8px; font-weight: 550; }
.props > .v .input { border-color: transparent; background: transparent; padding: 7px 8px; }
.props > .v .input:hover { background: var(--panel-2); }
.props > .v .input:focus { background: var(--panel); border-color: var(--accent); }
.props > .v.long { grid-column: 1 / -1; }
.props > .k.long { grid-column: 1 / -1; padding-top: 12px; }
.multi { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; }
.multi .ref button { border: 0; background: none; cursor: pointer; padding: 0 0 0 2px; color: var(--muted); }
.guide { background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 14px; margin: 4px 0 16px; font-size: 13.5px; }
.guide summary { cursor: pointer; font-weight: 650; color: var(--muted); }
.related h4 { margin: 18px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.save-state { font-size: 12px; color: var(--faint); }

/* ---------- Модальные окна ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center; padding: 9vh 16px 16px; background: rgba(15, 23, 42, .4); overflow-y: auto; animation: fade .12s; }
.modal { width: min(620px, 100%); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal.wide { width: min(860px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px 6px; }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 10px 20px 20px; }
.qi textarea { font-size: 16px; min-height: 110px; border: 0; padding: 4px 0; background: transparent; resize: none; }
.qi textarea:focus { box-shadow: none; }
.qi .bar { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; flex-wrap: wrap; }
.proposal { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.proposal .ph { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.proposal dl { display: grid; grid-template-columns: 140px 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.proposal dt { color: var(--muted); }
.proposal dd { margin: 0; white-space: pre-wrap; }
.mic.on { color: var(--danger); border-color: var(--danger); }

.fields-editor .frow { display: grid; grid-template-columns: 26px 1fr 150px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.fields-editor .frow:first-child { border-top: 0; }
.fields-editor .handle { display: flex; flex-direction: column; }
.fields-editor .handle button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; font-size: 11px; }

/* ---------- Настройки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.set-grid { display: grid; gap: 16px; max-width: 820px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: var(--mono); font-size: 15px; background: var(--panel-2); padding: 14px 18px; border-radius: 10px; }
.audit { font-size: 12.5px; }
.audit td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line); }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 28px; }
.auth-card .brand { padding: 0 0 18px; font-size: 22px; }
.auth-card .brand img { width: 34px; height: 34px; }
.auth-card h2 { margin: 0 0 4px; font-size: 19px; }
.auth-card p.lead { margin: 0 0 18px; color: var(--muted); }
.qr { display: block; margin: 8px auto 12px; border-radius: 10px; background: #fff; padding: 8px; width: 216px; height: 216px; }
.secret { font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; text-align: center; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp { font-family: var(--mono); font-size: 24px; letter-spacing: .3em; text-align: center; }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #111827; color: #f9fafb; padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 550; animation: fade .15s; pointer-events: auto; max-width: 90vw; }
.toast.error { background: var(--danger); }
.fab { display: none; }

/* ---------- Телефон ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 70; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 65; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .hide-m { display: none; }
  .content { padding: 14px 12px 100px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash { grid-template-columns: 1fr; }
  .props { grid-template-columns: 1fr; }
  .props > .k { padding-top: 6px; }
  .drawer-b { padding: 14px 16px 60px; }
  .fields-editor .frow { grid-template-columns: 22px 1fr 1fr; }
  .fields-editor .frow .opt-col { grid-column: 2 / -1; }
  .fab { display: inline-flex; position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40; width: 54px; height: 54px; border-radius: 50%; font-size: 22px; box-shadow: var(--shadow-lg); }
  .modal-wrap { padding: 4vh 8px 8px; }
  .toolbar .search { max-width: none; flex: 1 1 100%; }
  .shell { background: var(--bg); }
  .list li { flex-wrap: wrap; }
  .list .ttl { white-space: normal; flex-basis: 70%; }
  .list .meta { margin-left: 28px; }
}
