:root {
  /* Светлая тема: белый фон, фиолетовый акцент */
  color-scheme: light;
  --ink: #2f2163;        /* боковая панель */
  --ink-2: #44328a;
  --bg: #ffffff;         /* фон рабочей области */
  --surface: #ffffff;
  --surface-2: #f7f6fc;  /* лёгкая подложка */
  --surface-3: #eeebf8;  /* колонки досок, плашки */
  --line: #e2def0;
  --line-soft: #efecf7;
  --line-strong: #cfc8e6;
  --text: #1d1a2b;
  --muted: #6a6580;
  --muted-2: #a19bb8;
  --side-text: #d9d2f5;
  --action: #6a45d8;     /* основные кнопки */
  --action-hover: #5734c4;
  --accent-2: #5b5bd6;
  --danger: #c0392b;
  --yandex-bg: #f8d84a; --yandex-fg: #3b2f00;
  --google-bg: #d6e4fb; --google-fg: #1a4a9a;
  --plain-bg: #dfe5e2;  --plain-fg: #2b3836;
  --radius-s: 6px;
  --radius-m: 10px;
  font-family: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

/* Тёмная тема */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #0f0d17;
  --ink-2: #2a2443;
  --bg: #15131d;
  --surface: #1d1a28;
  --surface-2: #242133;
  --surface-3: #2c283e;
  --line: #3a3552;
  --line-soft: #2e2a40;
  --line-strong: #4a4467;
  --text: #ece9f6;
  --muted: #a8a2c0;
  --muted-2: #7d7798;
  --side-text: #c9c2e8;
  --action: #8d6cf2;
  --action-hover: #7b58ea;
  --accent-2: #93a6ff;
  --danger: #f07a6a;
  --plain-bg: #2c283e; --plain-fg: #d8d3ee;
}


* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--action); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .9rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: .86rem; }
.nowrap { white-space: nowrap; }
.wrap { max-width: 28ch; white-space: pre-wrap; }

/* Каркас */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--ink); color: var(--side-text);
  display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; padding: 0 10px 22px; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a {
  color: var(--side-text); text-decoration: none; padding: 9px 10px 9px 12px;
  border-radius: var(--radius-s); border-left: 3px solid transparent;
}
.menu a:hover { background: var(--ink-2); color: #fff; }
.menu a.on { background: var(--ink-2); color: #fff; border-left-color: var(--yandex-bg); font-weight: 600; }
.logout { margin-top: auto; padding: 0 10px; }
.logout .link-btn { color: var(--muted-2); }
.main { padding: 28px 32px 60px; min-width: 0; max-width: 1400px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back, .crumbs a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col .panel { margin-bottom: 0; }
.two-col + .panel { margin-top: 18px; }

/* Формы */
label { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; font-weight: 500; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px;
}
input[type=file] { padding: 6px; background: var(--bg); }
input[type=radio] { accent-color: var(--action); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .88rem; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 5px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 460px; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.num { width: 90px; }
.search { min-width: 220px; }
.title-input { font-size: 1.5rem; font-weight: 700; border-color: transparent; padding: 2px 6px; margin-left: -6px; color: var(--text); background: transparent; }
.title-input:hover, .title-input:focus { border-color: var(--line); background: var(--surface); }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
  background: var(--action); color: #fff; border: 1px solid var(--action);
  border-radius: var(--radius-s); padding: 8px 16px;
}
.btn:hover { background: var(--action-hover); }
.btn-ghost { background: var(--surface); color: var(--action); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-small { padding: 5px 10px; font-size: .85rem; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: var(--action); text-decoration: underline; font-size: .9rem; }
.danger { color: var(--danger); }
.link { font-size: .9rem; }

/* Форма профиля */
.profile-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.f-remark { grid-row: span 2; }
.f-group select + input { margin-top: 6px; }
.seg { display: flex; gap: 14px; flex-wrap: wrap; padding: 6px 0 8px; }
.seg label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-weight: 400; }
.proxy-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 5px; }
.f-proxy > label { margin: 0; }
.proxy-result { margin: 8px 0 0; }
.proxy-result.ok { color: var(--action); font-weight: 500; }
.proxy-result.err { color: var(--danger); }
.f-proxy select { width: 100%; }
.f-extra, .f-submit, .f-sheet { grid-column: 1 / -1; }
.f-sheet select { max-width: 460px; }
.f-extra summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.extra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }

/* Метки папок — главный визуальный акцент */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.list-head h2 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  text-decoration: none; white-space: nowrap; border: 1px solid transparent;
}
.chip-yandex { background: var(--yandex-bg); color: var(--yandex-fg); }
.chip-google { background: var(--google-bg); color: var(--google-fg); }
.chip-plain, .chip-all { background: var(--plain-bg); color: var(--plain-fg); }
.chips .chip { opacity: .7; }
.chips .chip.on { opacity: 1; border-color: currentColor; }

/* Таблицы */
.scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid tbody tr:hover td { background: var(--surface-2); }
.actions { text-align: right; width: 1%; }
.state { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.state.ok { color: var(--action); }
.state.err { color: var(--danger); cursor: help; }
.state.free { color: var(--muted); font-weight: 400; }
.err-text { color: var(--danger); font-size: .85rem; max-width: 32ch; }

.more { position: relative; display: inline-block; text-align: left; }
.more summary, .col-menu summary { cursor: pointer; list-style: none; color: var(--muted); font-size: .88rem; }
.more summary::-webkit-details-marker, .col-menu summary::-webkit-details-marker { display: none; }
.more-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 280px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 8px 24px rgba(22, 48, 47, .14);
}
.col-menu .more-body { left: 0; right: auto; }
.mini-form { display: flex; flex-direction: column; gap: 8px; }

/* Редактор таблицы */
.hint { font-size: .85rem; }
.sheet-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.sheet { font-size: .9rem; }
.sheet th, .sheet td { border-right: 1px solid var(--line-soft); }
.sheet thead th { background: var(--surface-2); position: sticky; top: 0; }
.sheet .col-menu summary { color: var(--text); font-weight: 600; }
.sheet td.cell { min-width: 120px; max-width: 360px; position: relative; padding-bottom: 20px; }
.sheet .txt { white-space: pre-wrap; outline: none; min-height: 1.4em; }
.sheet td.cell:focus-within { box-shadow: inset 0 0 0 2px var(--action); background: var(--surface); }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.th { position: relative; display: block; }
.th img { display: block; width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--line); }
.th-del {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(22, 48, 47, .82); color: #fff; cursor: pointer; line-height: 1; font-size: 15px;
  opacity: 0;
}
.th:hover .th-del, .th-del:focus-visible { opacity: 1; }
.add-photo {
  position: absolute; left: 10px; bottom: 3px; flex-direction: row;
  font-size: .75rem; font-weight: 500; color: var(--action); cursor: pointer; opacity: 0;
}
.sheet td.cell:hover .add-photo, .sheet td.cell:focus-within .add-photo { opacity: 1; }
.sheet td.drop { box-shadow: inset 0 0 0 2px var(--yandex-bg); background: var(--surface-2); }
.sheet td.saving { background: var(--surface-2); }
.sheet td.saved { background: var(--surface-2); transition: background 1.2s; }
.sheet td.failed { box-shadow: inset 0 0 0 2px var(--danger); }
.rownum { width: 44px; text-align: center; color: var(--muted); }
.row-del { font: inherit; font-size: .8rem; background: none; border: 0; color: var(--muted); cursor: pointer; width: 100%; }
.row-del:hover { color: var(--danger); text-decoration: line-through; }
.add-col input { width: 120px; padding: 4px 8px; font-size: .85rem; }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.rows-list { list-style: none; margin: 0; padding: 0; }
.rows-list li { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.rows-list li:last-child { border-bottom: 0; }
.rows-list li .link.push, .rows-list li form.push { margin-left: auto; }
.rows-list li .more summary { color: var(--action); text-decoration: underline; }
.title-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-input { border: 1px dashed var(--line) !important; min-width: 280px; }

/* Архив фото */
.tools { display: flex; flex-direction: column; gap: 12px; }
.folders { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.folder { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: var(--radius-s); padding: 12px 14px; display: flex; justify-content: space-between; gap: 8px; }
.folder > a { text-decoration: none; color: var(--text); display: flex; flex-direction: column; min-width: 0; }
.folder-name { font-weight: 600; overflow-wrap: anywhere; }
.folder .muted { font-size: .82rem; }
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: visible; }
.thumb { display: grid; place-items: center; aspect-ratio: 1; background: var(--surface-2); border-radius: var(--radius-s) var(--radius-s) 0 0; overflow: hidden; text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.ftype { color: var(--muted); font-size: .85rem; }
.tile-meta { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; font-size: .82rem; }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Заметки */
.notes { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.notes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notes-list a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius-s); text-decoration: none; color: var(--text); }
.notes-list a:hover { background: var(--surface-3); }
.notes-list a.on { background: var(--surface); border: 1px solid var(--line); }

/* Сообщения */
.flash { padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 12px; font-size: .92rem; }
.flash-ok { background: #dcefe8; color: #134a40; }
.flash-error { background: #f7dfd9; color: #7a2413; }
.notice { background: #fff6d6; border: 1px solid #ecd98a; color: #4d3f07; padding: 12px 14px; border-radius: var(--radius-s); margin-bottom: 18px; font-size: .92rem; }
.empty { color: var(--muted); padding: 18px 0; margin: 0; }

/* Вход */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: var(--ink); }
.auth .flash { width: 100%; max-width: 380px; }
.auth-card { background: var(--surface); border-radius: var(--radius-m); padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (hover: none) { .add-photo, .th-del { opacity: 1; } }

/* Архив фото: зона перетаскивания и отметки */
.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius-m); background: var(--surface-2);
  padding: 18px 20px; margin-bottom: 16px;
}
.drop-title { font-weight: 600; margin: 0 0 2px; }
.drop-actions { margin-top: 12px; }
.drop-actions label.btn { flex-direction: row; color: var(--action); font-weight: 600; font-size: 1rem; }
.upload-status { margin: 12px 0 0; font-weight: 500; }
.upload-status.ok { color: var(--action); }
.upload-status.err { color: var(--danger); }
.drop-hint { display: none; margin: 0; font-size: 1.15rem; font-weight: 600; color: var(--ink); padding: 14px 0; text-align: center; }
.dropzone.over { border-color: var(--action); border-style: solid; background: var(--surface-2); }
.dropzone.over .drop-idle, .dropzone.over .drop-actions, .dropzone.over .upload-status { display: none; }
.dropzone.over .drop-hint { display: block; }
.dropzone.over * { pointer-events: none; }

/* Вкладки архивов, как в браузере */
.tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; overflow-x: auto; }
.tab {
  display: flex; align-items: center; gap: 2px; max-width: 220px;
  background: var(--surface-3); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 9px 9px 0 0; margin-bottom: -1px;
}
.tab:hover { background: var(--line-soft); }
.tab.on { background: var(--bg); position: relative; }
.tab-link { padding: 8px 14px; color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tab.on .tab-link { color: var(--text); font-weight: 600; cursor: text; }
.tab form { display: flex; }
.tab-close { font: inherit; border: 0; background: none; color: var(--muted); cursor: pointer; width: 24px; height: 24px; border-radius: 50%; margin-right: 6px; line-height: 1; font-size: 16px; }
.tab-close:hover { background: var(--line-strong); color: var(--danger); }
.tab-new { font: inherit; font-size: 20px; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; width: 34px; height: 34px; border-radius: 50%; margin: 0 0 3px 4px; flex: none; }
.tab-new:hover { background: var(--surface-3); color: var(--action); }

.filter { margin-bottom: 14px; }
.chip-used { background: #cfe8dc; color: #0f4a3a; }
.used-badge { display: inline-block; margin-top: 6px; font-size: .85rem; font-weight: 600; color: #0f4a3a; background: #cfe8dc; padding: 2px 10px; border-radius: 999px; }
.folder.is-used { border-left-color: #2f8f6a; }
.tile { position: relative; }
.tile.is-used .thumb { outline: 3px solid #2f8f6a; outline-offset: -3px; }
.tile-flag {
  position: absolute; top: 8px; left: 8px; background: #2f8f6a; color: #fff;
  font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.disk-path { margin-top: 24px; overflow-wrap: anywhere; }

/* Связь таблицы с профилями */
.profile-map summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.profile-map[open] summary { margin-bottom: 12px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; margin: 12px 0 16px; }
.map-actions { margin-bottom: 10px; }

/* Аккаунты AdsPower */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.account-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.account-new { border-style: dashed; background: var(--surface-2); }
.account-new p { margin: 0; }
.acc-switch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.acc-switch .label { color: var(--muted); font-size: .88rem; font-weight: 500; }
.chip-acc { background: #e2e7e4; color: var(--plain-fg); }
.chip-acc.on { background: var(--ink); color: #fff; opacity: 1; }

/* Настройка столбцов */
.cfg summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.cfg[open] summary { margin-bottom: 12px; }
.cfg-rows { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.cfg-row {
  display: grid; grid-template-columns: 56px minmax(140px, 1fr) minmax(170px, 1fr) minmax(120px, 1.4fr) auto;
  gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--radius-s); background: var(--surface-2);
}
.cfg-row .cfg-tpl:not([hidden]) ~ .cfg-preview { display: none; }
.cfg-row .cfg-tpl[hidden] + .cfg-preview { display: block; }
.cfg-row .cfg-tpl { grid-column: 4; }
.cfg-new { background: var(--surface); border: 1px dashed var(--line); }
.cfg-move { display: flex; gap: 2px; }
.icon-btn { font: inherit; width: 26px; height: 26px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); cursor: pointer; color: var(--muted); }
.icon-btn:hover:not(:disabled) { color: var(--action); border-color: var(--action); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.cfg-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-help code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .82rem; }
.col-src { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); }
.field-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0; }
.pick { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-weight: 400; }
.pick input { accent-color: var(--action); }
@media (max-width: 900px) {
  .cfg-row { grid-template-columns: 56px 1fr; }
  .cfg-row > * { grid-column: auto !important; }
}

/* Переключатель ядра */
.kernel-switch { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 4px; }
.kernel-switch label { flex-direction: row; cursor: pointer; }
.kernel-switch input { position: absolute; opacity: 0; pointer-events: none; }
.kernel-switch span { padding: 6px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.kernel-switch input:checked + span { background: var(--ink); color: #fff; }
.kernel-switch input:focus-visible + span { outline: 2px solid var(--action); outline-offset: 2px; }
.f-kernel .muted { display: block; }

/* Доска задач со стикерами */
.board-hint { margin: 4px 0 0; }
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.board-col {
  flex: 0 0 290px; background: var(--surface-3); border-radius: var(--radius-m);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 170px);
}
.board-col.drop-target { background: var(--surface-3); }
.board-col.is-done .sticky { opacity: .75; }
.col-head { display: flex; align-items: center; gap: 8px; }
.col-name { margin: 0; font-size: 1rem; flex: 1; cursor: text; overflow-wrap: anywhere; }
.col-count { background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 600; border-radius: 999px; padding: 1px 9px; }
.col-more summary { font-size: 1.2rem; line-height: 1; padding: 0 4px; }
.cards { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 40px; padding: 2px 2px 6px; }

.sticky {
  --tilt: -0.8deg;
  position: relative; padding: 14px 14px 12px; border-radius: 3px 3px 10px 3px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 6px 14px -8px rgba(22, 48, 47, .45);
  transform: rotate(var(--tilt)); cursor: grab; color: #2a2a22;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sticky:nth-child(even) { --tilt: 0.7deg; }
.sticky:nth-child(3n) { --tilt: -0.3deg; }
.sticky::before {   /* полоска «клея» сверху */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 7px;
  background: rgba(0, 0, 0, .05); border-radius: 3px 3px 0 0;
}
.sticky:hover, .sticky:focus-visible { transform: rotate(0deg) translateY(-2px); box-shadow: 0 10px 20px -10px rgba(22, 48, 47, .55); }
.sticky.dragging { opacity: .4; transform: rotate(0deg); }
.sticky-title { margin: 0 0 4px; font-size: .98rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.sticky-body {
  margin: 0; font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.sticky-due { display: inline-block; margin-top: 8px; font-size: .76rem; font-weight: 700; background: rgba(255,255,255,.6); padding: 1px 8px; border-radius: 999px; }
.sticky-due.overdue { background: var(--danger); color: #fff; }
.sticky-yellow { background: #fff1a8; }
.sticky-pink { background: #ffd3dd; }
.sticky-green { background: #cdefd3; }
.sticky-blue { background: #cfe3ff; }
.sticky-orange { background: #ffd9b0; }
.sticky-purple { background: #e3d5ff; }

.quick-add input { width: 100%; background: transparent; border: 1px dashed var(--line-strong); }
.quick-add input:focus { background: var(--surface); border-style: solid; }

.card-dialog { border: 0; border-radius: var(--radius-m); padding: 22px; width: min(560px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.card-dialog::backdrop { background: rgba(22, 48, 47, .45); }
.card-dialog .title-input { min-width: 0; width: 100%; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; flex-direction: row; }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { border-color: var(--ink); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--action); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dialog-actions { display: flex; gap: 10px; align-items: center; }
.dialog-actions .danger { margin-left: auto; }
@media (prefers-reduced-motion: reduce) { .sticky { transform: none; } }

/* Сводная таблица */
.summary-meta { margin: 4px 0 0; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin: 12px 0 18px; }
.summary-grid p { margin: 0; }
.summary-create { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; }
.summary-create .field-picks, .summary-create > div { grid-column: 1 / -1; }
.summary-sheet .count-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1rem; min-width: 110px; }
.summary-sheet .folder-cell select { min-width: 200px; font-weight: 600; }
.summary-sheet tfoot td { border-top: 2px solid var(--line); background: var(--surface-2); }

/* Кнопка-заголовок столбца */
.col-btn {
  font: inherit; font-weight: 600; color: var(--text); background: none; border: 0; padding: 2px 4px;
  margin: -2px -4px; cursor: pointer; text-align: left; border-radius: var(--radius-s);
}
.col-btn:hover { background: var(--surface-3); }
.col-btn:focus-visible { outline: 2px solid var(--action); }
.col-dialog { width: min(440px, 92vw); }
.col-dialog-title { margin: 0; }

/* Перестановка строк */
.rownum { white-space: nowrap; width: 1%; }
.drag-handle { cursor: grab; color: var(--muted-2); padding: 0 4px; user-select: none; font-size: 1rem; }
.drag-handle:hover { color: var(--action); }
.rn { display: inline-block; min-width: 1.4em; text-align: center; color: var(--muted); font-size: .82rem; }
.rownum form { display: inline; }
.row-del { width: auto; padding: 0 4px; opacity: 0; font-size: 1rem; }
tr:hover .row-del, .row-del:focus-visible { opacity: 1; }
.row-del:hover { text-decoration: none; }
tr.row-dragging td { opacity: .35; }

/* Цвет ячеек */
.cell-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.cell-tools.active { border-color: var(--action); }
.tools-label { font-weight: 600; font-size: .88rem; }
.cell-swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); cursor: pointer; }
.cell-swatch:disabled, .cell-tools .link-btn:disabled { opacity: .35; cursor: default; }
.cell-swatch:not(:disabled):hover { transform: scale(1.12); }
.cc-yellow { background: #fff1a8 !important; }
.cc-green { background: #cdefd3 !important; }
.cc-red { background: #ffd0d0 !important; }
.cc-blue { background: #cfe3ff !important; }
.cc-orange { background: #ffd9b0 !important; }
.cc-purple { background: #e3d5ff !important; }
.cc-grey { background: #dfe5e2 !important; }
td.sc.sel { box-shadow: inset 0 0 0 2px var(--action); }
td.sc { cursor: cell; }
td.sc .txt { cursor: text; }

/* Цвет по значению */
.rules-box { border-top: 1px solid var(--line); padding-top: 12px; }
.rules-hint { margin: 0 0 8px; }
.rules { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rule-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-row select { width: 64px; }
.rule-value { width: 90px; }
.rule-colors { display: flex; gap: 4px; }
.rule-colors label { flex-direction: row; position: relative; }
.rule-colors input { position: absolute; opacity: 0; pointer-events: none; }
.rule-colors label:has(input:checked) { outline: 2px solid var(--ink); outline-offset: 1px; }
.rule-colors label:has(input:focus-visible) { outline: 2px solid var(--action); }
.col-dialog { width: min(560px, 94vw); }
.rule-row { flex-wrap: nowrap; }
.rule-colors .cell-swatch { width: 24px; height: 24px; }
@media (max-width: 560px) { .rule-row { flex-wrap: wrap; } }

/* Справка */
.help { max-width: 860px; }
.help-item { margin-bottom: 10px; padding: 16px 20px; }
.help-item summary { cursor: pointer; font-weight: 700; font-size: 1.02rem; }
.help-item[open] summary { margin-bottom: 10px; }
.help-item ol, .help-item ul { margin: 0 0 10px; padding-left: 20px; }
.help-item li { margin-bottom: 6px; }
.help-item code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .88rem; }
.help-table { margin: 10px 0; }
.help-table td:first-child { white-space: nowrap; width: 1%; }

/* Поиск по таблице */
.table-search {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.table-search:focus-within { border-color: var(--action); }
.search-icon { color: var(--muted); font-size: 1.2rem; line-height: 1; }
.table-search input[type=search] { flex: 1; min-width: 200px; border: 0; padding: 6px 4px; outline: none; }
.search-count { min-width: 90px; text-align: right; }
.search-only { margin-left: 6px; font-size: .88rem; }
td.hit { box-shadow: inset 0 0 0 2px #e0b400; }
td.hit-current { box-shadow: inset 0 0 0 3px #d98a00, inset 0 0 0 200px rgba(255, 214, 0, .3); }

/* Страница таблиц: плитки как в Google Таблицах */
.new-row { background: var(--surface-3); margin: -4px -32px 26px; padding: 18px 32px 22px; }
.new-row-title { margin: 0 0 12px; font-weight: 600; color: var(--muted); font-size: .92rem; }
.new-tiles { display: flex; gap: 18px; flex-wrap: wrap; }
.new-tile { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.new-art {
  width: 150px; height: 112px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; transition: border-color .15s, transform .15s;
}
.new-art span { font-size: 2.6rem; line-height: 1; font-weight: 300; }
.art-empty span { color: var(--action); }
.art-import span { color: #2f6fb3; }
.art-summary span { color: #b37a00; font-weight: 500; }
.new-tile:hover .new-art, .new-tile:focus-visible .new-art { border-color: var(--action); transform: translateY(-2px); }
.new-name { font-weight: 600; font-size: .9rem; }

.tiles-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.tiles-head h2 { margin: 0; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: visible;
  display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--muted-2); box-shadow: 0 6px 18px -10px rgba(22, 48, 47, .45); }
.tile.is-star { border-color: #e0b400; }
.tile-preview {
  display: block; height: 150px; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0; text-decoration: none; padding: 10px 10px 0; position: relative;
}
.tile-preview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: linear-gradient(transparent, var(--surface-2)); }
.mini { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: .64rem; color: var(--text); }
.mini th, .mini td { border: 1px solid var(--line-soft); padding: 3px 4px; height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; background: var(--surface); }
.mini th { background: var(--surface-2); font-weight: 700; }
.tile-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .85rem; }
.tile-info { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px 8px 12px; }
.tile-bottom { display: flex; align-items: center; gap: 8px; }
.tile-bottom form { display: flex; }
.tile-icon { width: 22px; height: 22px; border-radius: 6px; background: var(--action); color: #fff; display: grid; place-items: center; font-size: .9rem; flex: none; }
.tile-icon.icon-summary { background: #b37a00; }
.tile-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tile-title {
  font-weight: 600; color: var(--text); text-decoration: none; line-height: 1.3; padding-right: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.tile-title:hover { text-decoration: underline; }
.tile-meta { font-size: .76rem; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { font: inherit; font-size: 1.15rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--line-strong); padding: 4px; border-radius: 6px; }
.star:hover { color: #e0b400; background: var(--surface-2); }
.star.on { color: #e0b400; }
.tile-more summary { font-size: 1.2rem; padding: 2px 6px; }
.dlg-title { margin: 0; font-size: 1.05rem; }

/* Выбор таблиц в форме профиля */
.sheet-picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.sheet-pick { flex-direction: row; cursor: pointer; }
.sheet-pick input { position: absolute; opacity: 0; pointer-events: none; }
.sheet-pick span {
  display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: .9rem;
}
.sheet-pick input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.sheet-pick input:focus-visible + span { outline: 2px solid var(--action); outline-offset: 2px; }
.f-sheet .muted { display: block; }
@media (max-width: 900px) { .new-row { margin: -4px -14px 20px; padding: 16px 14px; } }

/* 2FA */
.twofa-hint { margin: 4px 0 0; }
.twofa-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.twofa-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 2px 6px -4px rgba(22, 48, 47, .3);
}
.tf-label { color: var(--text); font-weight: 600; font-size: .86rem; gap: 6px; }
.tf-label input { font-weight: 400; }
.tf-secret { position: relative; display: block; }
.tf-secret input { width: 100%; padding-right: 40px; font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; letter-spacing: .04em; }
.tf-secret input[readonly] { color: #6b7774; background: var(--surface-2); }
.tf-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; }
.tf-eye:hover, .tf-eye.on { color: var(--action); }
.tf-msg { min-height: 1em; font-weight: 500; }
.tf-msg.ok { color: var(--action); }
.tf-msg.err { color: var(--danger); }
.tf-code-box { background: var(--surface-2); border: 1px solid var(--surface-3); border-radius: 10px; padding: 16px 12px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; }
.tf-code {
  font: 700 2.1rem/1 "Cascadia Mono", Consolas, ui-monospace, monospace; letter-spacing: .06em;
  color: var(--accent-2); background: none; border: 0; cursor: pointer; padding: 4px 8px; border-radius: 8px;
  font-variant-numeric: tabular-nums; transition: color .2s;
}
.tf-code:hover { background: var(--surface-3); }
.tf-ending .tf-code { color: #c2410c; }
.tf-error .tf-code { font-size: 1rem; color: var(--danger); }
.tf-row { display: flex; align-items: center; gap: 10px; }
.tf-badge { background: #111; color: #fff; font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.tf-timer { position: relative; width: 34px; height: 34px; display: grid; place-items: center; }
.tf-timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.tf-timer .ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 3; }
.tf-timer .ring { fill: none; stroke: var(--accent-2); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.tf-ending .tf-timer .ring { stroke: #c2410c; }
.tf-timer span { font-size: .74rem; font-weight: 700; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tf-copy { width: 34px; height: 34px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--surface-3); border-radius: 8px; cursor: pointer; color: var(--text); }
.tf-copy:hover { border-color: var(--accent-2); color: var(--accent-2); }
.tf-copied .tf-code-box::after {
  content: "Скопировано"; position: absolute; top: 8px; right: 10px; font-size: .74rem; font-weight: 700;
  color: #fff; background: var(--action); padding: 2px 8px; border-radius: 999px;
}
.tf-remove { display: flex; justify-content: center; }
.tf-remove-btn {
  font: inherit; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px;
  color: var(--danger); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 16px; cursor: pointer;
}
.tf-remove-btn:hover { background: var(--surface-2); border-color: var(--danger); }
.twofa-empty { max-width: 640px; }
.tf-offline .tf-code { opacity: .4; }

/* Карточки заданий (Trello) */
.tasks-sub { margin: 4px 0 0; }
.task-tabs { margin-top: 0; }
.tboard { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.tlist {
  flex: 0 0 280px; background: var(--surface-3); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 220px);
}
.tlist.drop-target { background: var(--surface-3); }
.tlist-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.tlist-name { margin: 0; font-size: .96rem; flex: 1; cursor: text; overflow-wrap: anywhere; }
.tcards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 36px; padding: 2px; }
.tcard {
  background: var(--surface); border-radius: 8px; padding: 9px 10px 8px 36px; position: relative; cursor: pointer;
  box-shadow: 0 1px 0 rgba(22, 48, 47, .18); border: 1px solid transparent; transition: border-color .12s;
}
.tcard:hover, .tcard:focus-visible { border-color: var(--action); outline: none; }
.tcard.dragging { opacity: .4; }
.tcard-title { display: block; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.tcard-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: .74rem; color: var(--muted); }
.tcheck {
  position: absolute; left: 9px; top: 9px; width: 19px; height: 19px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface); color: transparent; display: grid; place-items: center;
  cursor: pointer; padding: 0; transition: background .12s, border-color .12s;
}
.tcheck:hover { border-color: #22a06b; color: #22a06b; }
.tcard.is-done .tcheck { background: #22a06b; border-color: #22a06b; color: #fff; }
.tcard.is-done .tcard-title { text-decoration: line-through; color: var(--muted); }
.tdone-badge { background: #dcfce7; color: #166534; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.tadd input { width: 100%; background: transparent; border: 1px dashed var(--line-strong); }
.tadd input:focus { background: var(--surface); border-style: solid; }

.tdialog { width: min(820px, 95vw); }
.tdialog-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.tdone-pick { font-weight: 600; }
.tinfo { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; max-height: 420px; overflow-y: auto; }
.tinfo-title { margin: 0 0 6px; font-size: .88rem; }
.tinfo-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 14px; font-size: .86rem; }
.tinfo-list dt { color: var(--muted); }
.tinfo-list dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ev { position: relative; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ev::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted-2); border: 2px solid var(--surface); }
.ev-created::before { background: var(--action); }
.ev-done::before { background: #22a06b; }
.ev-deleted::before { background: var(--danger); }
.ev-restored::before { background: var(--accent-2); }
.ev-moved::before { background: #d98a00; }
.ev-time { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-text { font-size: .88rem; }
.small-tl .ev { flex-direction: column; gap: 0; }
.arch-row form { display: inline; }
@media (max-width: 760px) { .tdialog-grid { grid-template-columns: 1fr; } }

/* Карточки заданий на всю ширину экрана */
.main-tasks { max-width: none; }
.main-tasks .tboard { gap: 16px; }
.main-tasks .tlist { flex: 1 1 280px; min-width: 260px; max-height: calc(100vh - 200px); }
.tdialog { width: min(980px, 96vw); }
/* Надпись «выполнено» видна только у выполненных карточек и исчезает сразу при снятии галочки */
.tcard:not(.is-done) .tdone-badge { display: none; }

/* Колонки карточек заданий выше: тянутся до низа экрана */
.main-tasks .tlist { min-height: calc(100vh - 230px); }
.main-tasks .tcards { flex: 1; }
.menu-toggle, .row-move { display: none; }

/* ===================== Телефон и узкие экраны ===================== */
@media (max-width: 900px) {
  /* Верхняя панель с кнопкой меню вместо боковой панели */
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side {
    position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 10px 14px; gap: 0;
  }
  .brand { padding: 0; flex: 1; font-size: 1.1rem; }
  .menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 0 10px; background: var(--ink-2); border: 0; border-radius: 10px; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; background: var(--surface); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .menu, .logout { display: none; }
  .menu-open .menu { display: flex; flex-direction: column; width: 100%; margin-top: 10px; gap: 2px; }
  .menu-open .menu a { padding: 12px 12px; font-size: 1.02rem; border-left: 3px solid transparent; }
  .menu-open .menu a.on { border-left-color: var(--yandex-bg); }
  .menu-open .logout { display: block; width: 100%; margin: 8px 0 4px; padding: 10px 12px; border-top: 1px solid var(--ink-2); }

  .main { padding: 16px 12px 48px; }
  h1 { font-size: 1.45rem; }
  .page-head { align-items: flex-start; margin-bottom: 14px; }
  .head-actions { width: 100%; }
  .panel { padding: 14px; }
  /* 16px в полях — иначе iPhone приближает страницу при вводе */
  input, select, textarea { font-size: 16px; }

  /* Форма профиля в одну колонку и без вылезания за край */
  .profile-form, .two-col, .extra-grid, .notes { grid-template-columns: 1fr; }
  .profile-form > *, .profile-form label, .profile-form input, .profile-form select, .profile-form textarea { min-width: 0; max-width: 100%; }
  .f-remark { grid-row: auto; }
  .proxy-row { grid-template-columns: 1fr auto; }
  .proxy-row [data-proxy-check] { grid-column: 1 / -1; }
  .kernel-switch span { padding: 8px 14px; }

  /* Таблицы */
  .cell-tools [data-sel-info] { flex-basis: 100%; }
  .table-search input[type=search] { min-width: 0; }
  .search-only { margin-left: 0; }
  .title-input { min-width: 0 !important; width: 100%; font-size: 1.25rem; }
  .cfg-row { grid-template-columns: 1fr; }
  .new-row { margin: -4px -12px 18px; padding: 14px 12px 16px; }
  .new-tiles { gap: 10px; }
  .new-tile { width: calc((100vw - 64px) / 3); }
  .new-art { width: 100%; height: 84px; }
  .new-art span { font-size: 2rem; }
  .new-name { font-size: .8rem; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile-preview { height: 110px; padding: 6px 6px 0; }

  /* Доски: колонка почти на всю ширину, листаются пальцем вбок */
  .board, .tboard { scroll-snap-type: x mandatory; gap: 12px; margin: 0 -12px; padding: 0 12px 16px; }
  .board-col, .main-tasks .tlist, .tlist {
    flex: 0 0 86vw; min-width: 0; scroll-snap-align: start;
    max-height: none; min-height: 60vh;
  }
  .tdialog-grid { grid-template-columns: 1fr; }
  .card-dialog { padding: 16px; }
  .dialog-actions { flex-wrap: wrap; }

  .twofa-grid { grid-template-columns: 1fr; }
  .folders { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .accounts { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .tiles { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

/* Сенсорные экраны: то, что на компьютере видно при наведении, показываем сразу */
@media (hover: none) {
  .row-del { opacity: 1; }
  .drag-handle { display: none; }
  .row-move { display: inline-flex; flex-direction: column; gap: 2px; vertical-align: middle; }
  .row-move button { font-size: .62rem; line-height: 1; padding: 3px 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; color: var(--muted); }
  .add-photo { opacity: 0 !important; pointer-events: none; }
  .sheet td.cell:focus-within .add-photo { opacity: 1 !important; pointer-events: auto; }
  .tf-code:hover { background: none; }
}

/* Таблица-отчёт по карточкам */
.icon-report { background: var(--accent-2) !important; }
.report-link { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.col-move { gap: 8px; }

/* Выключатель */
.switch { flex-direction: row; align-items: center; gap: 12px; cursor: pointer; color: var(--text); font-weight: 600; font-size: .95rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 46px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--action); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--action); outline-offset: 2px; }
.autosync-form { margin-bottom: 8px; }

/* Карточки заданий: перетаскивание колонок, поиск, архив колонок */
.tlist-head[draggable="true"] { cursor: grab; border-radius: 8px; }
.tlist-head[draggable="true"]:active { cursor: grabbing; }
.tlist.list-dragging { opacity: .45; outline: 2px dashed var(--action); outline-offset: -2px; }
.touch-only { display: none !important; }
@media (hover: none) { .touch-only { display: flex !important; } .tlist-head[draggable="true"] { cursor: default; } }
.task-search { margin-bottom: 14px; }
.tcard.search-hit { border-color: #e0b400; box-shadow: 0 0 0 2px rgba(224, 180, 0, .35); }
.tlist.no-hits { opacity: .55; }
.tlist.no-hits .tadd { display: none; }
.panel h2 + .rows-list { margin-top: 4px; }

/* Отчёт по карточкам: блоки по колонкам доски и цвета колонок */
.group-row td {
  padding: 10px 12px 8px; font-weight: 700; font-size: .95rem; border-top: 3px solid var(--surface);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.group-row .group-count { margin-left: 10px; font-size: .78rem; font-weight: 700; background: rgba(255,255,255,.8); padding: 1px 9px; border-radius: 999px; color: var(--muted); }
.group-row + tr td { border-top: 0; }
.report-add select { font-size: .84rem; padding: 4px 6px; max-width: 170px; }
.list-colors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-colors li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lc-name { font-weight: 600; min-width: 110px; }
.lc-swatches { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lc-swatches .cell-swatch { width: 22px; height: 22px; }
.lc-swatches .cell-swatch.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.lc-none { font: inherit; font-size: .75rem; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.lc-none.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.tlist[class*="lc-"] { border-top: 5px solid transparent; }
.tlist.lc-green { border-top-color: #4caf7a; } .tlist.lc-orange { border-top-color: #f0a04b; }
.tlist.lc-yellow { border-top-color: #e6c419; } .tlist.lc-red { border-top-color: #e26a6a; }
.tlist.lc-blue { border-top-color: #5b8def; } .tlist.lc-purple { border-top-color: #9b7be0; } .tlist.lc-grey { border-top-color: #a3aeaa; }

.group-row td[class*="gr-"] { border-left: 6px solid rgba(0,0,0,.18); }
.group-row td { border-left: 6px solid var(--line-strong); }
.tlist { border-top: 5px solid transparent; }

/* Пользователи */
.who { display: block; color: var(--side-text); font-size: .85rem; margin-bottom: 6px; overflow-wrap: anywhere; }
.invite-new { display: flex; gap: 8px; margin: 14px 0 6px; }
.invite-new input { flex: 1; font-family: "Cascadia Mono", Consolas, monospace; font-size: .88rem; background: var(--surface-2); }
.inv-title { margin: 16px 0 4px; }
.inv-link { overflow-wrap: anywhere; }
.user-card { border-left: 5px solid var(--line); }
.user-card.st-pending { border-left-color: #e0b400; }
.user-card.st-active { border-left-color: var(--action); }
.user-card.st-blocked { border-left-color: var(--danger); opacity: .85; }
.user-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.user-login { font-size: 1.1rem; margin-right: 8px; }
.user-meta { margin: 4px 0 0; }
.badge { font-size: .76rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.b-admin { background: var(--ink); color: #fff; }
.b-pending { background: #fff1a8; color: #5a4700; }
.b-active { background: #dcfce7; color: #166534; }
.b-blocked { background: #ffd0d0; color: #7a1f1f; }
.danger-btn { color: var(--danger); border-color: var(--line-strong); }
.access-form { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px 24px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.access-form > .inline { grid-column: 1 / -1; }
.access-form p.strong { margin: 0 0 4px; }
.table-picks { max-height: 200px; overflow-y: auto; }
.user-pw { margin-top: 10px; }
.user-pw summary { cursor: pointer; }
@media (max-width: 900px) { .access-form { grid-template-columns: 1fr; } }
.col-plain { font-weight: 600; color: var(--text); }
.pw-dialog { width: min(380px, 92vw); }

.key-box { background: var(--surface-2, var(--surface-2)); padding: 2px 8px; border-radius: 6px; letter-spacing: .05em; }
.setup-2fa li { margin-bottom: 6px; }

/* В тёмной теме на цветных ячейках, стикерах и плашках — тёмный текст, чтобы читалось */
:root[data-theme="dark"] [class*="cc-"], :root[data-theme="dark"] .sticky,
:root[data-theme="dark"] .notice, :root[data-theme="dark"] .flash { color: #1d1a2b; }
:root[data-theme="dark"] .sticky .sticky-due { color: #1d1a2b; }
:root[data-theme="dark"] .group-row td:not([class*="cc-"]) { color: var(--text); }
:root[data-theme="dark"] .tdone-badge { background: #1f4d34; color: #bff0d2; }
:root[data-theme="dark"] .used-badge, :root[data-theme="dark"] .chip-used { background: #1f4d3d; color: #bfeedd; }
:root[data-theme="dark"] .tf-badge { background: #ece9f6; color: #15131d; }
:root[data-theme="dark"] .tcard { box-shadow: 0 1px 0 rgba(0,0,0,.5); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: var(--surface-2); color: var(--text); }
:root[data-theme="dark"] .title-input { background: transparent; }
:root[data-theme="dark"] .menu a.on { border-left-color: var(--action); }
:root[data-theme="dark"] .dropzone.over { background: #2d2640; }
:root[data-theme="dark"] .b-pending { background: #4d4210; color: #f5e7a8; }
:root[data-theme="dark"] .b-active { background: #1f4d34; color: #bff0d2; }
:root[data-theme="dark"] .b-blocked { background: #5a2323; color: #ffd0d0; }
:root[data-theme="dark"] .b-admin { background: var(--action); }

/* Переключатель темы */
.theme-toggle { font: inherit; font-size: .85rem; background: none; border: 0; color: var(--side-text); cursor: pointer; padding: 0; margin-bottom: 8px; display: inline-flex; gap: 6px; align-items: center; }
.theme-toggle:hover { color: #fff; }
.menu a.on { border-left-color: #c8b6ff; }

/* Меню строки */
.row-menu-btn { font: inherit; background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 0 4px; font-size: 1rem; line-height: 1; opacity: 0; }
tr:hover .row-menu-btn, .row-menu-btn:focus-visible { opacity: 1; }
.row-menu-btn:hover { color: var(--action); }
.row-dialog { width: min(420px, 94vw); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions .btn { flex: 1 1 160px; }
.row-sep { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.free-row td.cell { font-weight: 600; }
.free-row td.cell .txt:empty::before { content: "…"; color: var(--muted-2); font-weight: 400; }
@media (hover: none) { .row-menu-btn { opacity: 1; } }

/* полоска загрузки страницы */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--action); z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .2s; }
.nav-progress.is-on { opacity: 1; animation: nav-progress 8s cubic-bezier(.1,.7,.2,1) forwards; }
@keyframes nav-progress { from { width: 0; } 10% { width: 35%; } to { width: 92%; } }

/* дополнительные цвета */
.cc-pink { background: #ffd3ea !important; }
.cc-lime { background: #e4f5b5 !important; }
.cc-teal { background: #c6eee6 !important; }
.cc-sky { background: #cdeffb !important; }
.cc-indigo { background: #d7dcff !important; }
.cc-brown { background: #eadbcb !important; }
.cc-sand { background: #f5ecd7 !important; }
.cc-yellow2 { background: #ffe066 !important; }
.cc-green2 { background: #9eddb0 !important; }
.cc-red2 { background: #f7a1a1 !important; }
.cc-blue2 { background: #a3c4fa !important; }
.cc-orange2 { background: #ffbc85 !important; }
.cc-purple2 { background: #c9b3f7 !important; }
.cc-grey2 { background: #bfc8c4 !important; }
.tlist.lc-pink { border-top-color: #e46fae; }
.tlist.lc-lime { border-top-color: #9bc23a; }
.tlist.lc-teal { border-top-color: #2fa69a; }
.tlist.lc-sky { border-top-color: #3aaed8; }
.tlist.lc-indigo { border-top-color: #5e6ad2; }
.tlist.lc-brown { border-top-color: #a57a52; }
.tlist.lc-sand { border-top-color: #c9a96a; }
.tlist.lc-yellow2 { border-top-color: #d4a800; }
.tlist.lc-green2 { border-top-color: #2e9a5c; }
.tlist.lc-red2 { border-top-color: #d04444; }
.tlist.lc-blue2 { border-top-color: #3b6fdb; }
.tlist.lc-orange2 { border-top-color: #e07f1f; }
.tlist.lc-purple2 { border-top-color: #7a55d6; }
.tlist.lc-grey2 { border-top-color: #7e8a85; }
.cell-tools, .rule-colors, .lc-swatches { flex-wrap: wrap; }
