:root {
  --bg: #f6f5f2; --card: #fff; --text: #1d1d1f; --muted: #6b6b70; --line: #e3e1dc;
  --accent: #2f5d50; --accent-2: #e8f0ed; --danger: #b3261e; --warn: #b06a00; --ok: #2e7d32;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { display: flex; align-items: center; gap: 20px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: 14px; flex-wrap: wrap; flex: 1; }
.top nav a { color: var(--text); }
.me { display: flex; gap: 12px; align-items: center; }

.flash { background: var(--accent-2); border: 1px solid #c7dcd4; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.error { background: #fdecea; border: 1px solid #f3c2bd; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head h1 { margin: 4px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.table-wrap table { border: 0; }

form.inline { display: inline; margin: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }

button, .btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.btn:hover { text-decoration: none; opacity: .92; }
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--danger); border-color: #e6b3ae; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters > *, .filters input, .filters select { width: auto; }
.filters input[type=text] { min-width: 220px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eee; color: #333; white-space: nowrap; }
.b-lead, .b-new, .b-planned { background: #eef2f7; color: #36506e; }
.b-contacted, .b-thinking, .b-interview, .b-in_progress, .b-sales { background: #fff4e0; color: var(--warn); }
.b-awaiting_payment, .b-prepaid, .b-review { background: #f3e9fb; color: #6a3d8f; }
.b-paid, .b-active, .b-done, .b-running { background: #e6f4ea; color: var(--ok); }
.b-completed { background: #e8eaed; color: #444; }
.b-lost, .b-cancelled { background: #fdecea; color: var(--danger); }
.b-high { background: #fdecea; color: var(--danger); }
.overdue { color: var(--danger); font-weight: 600; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { min-width: 230px; max-width: 260px; flex: 0 0 auto; background: #ecebe6; border-radius: 10px; padding: 8px; }
.col h3 { margin: 4px 4px 8px; font-size: 14px; display: flex; justify-content: space-between; }
.deal { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: 14px; }
.deal select { margin-top: 6px; padding: 4px 6px; font-size: 13px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 4px 0 10px 12px; }
.timeline .meta { font-size: 12px; color: var(--muted); }
.pre { white-space: pre-wrap; }
.secret { border: 1px dashed var(--warn); background: #fffaf0; }
.kpi { font-size: 26px; font-weight: 700; }
.qr { width: 220px; height: 220px; background: #fff; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: 1px; background: #f0efe9; padding: 6px 10px; border-radius: 6px; display: inline-block; }
.login { max-width: 380px; margin: 10vh auto; }
.perm-table td, .perm-table th { padding: 6px 8px; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* Типы задач */
.b-assumed { background: #fff4e0; color: var(--warn); }
.t-product { background: #e8eefc; color: #2b4c9a; }
.t-sales { background: #e6f4ea; color: var(--ok); }
.t-ops { background: #eef0f2; color: #444; }
.t-content { background: #fde8f3; color: #9a2b6a; }
.t-finance { background: #fff4e0; color: var(--warn); }
.t-legal { background: #f0e9fb; color: #5a3d8f; }
.t-infra { background: #e3f2f7; color: #1f6378; }
.t-team { background: #f3efe6; color: #6b5a2e; }

/* Календарь */
table.month { table-layout: fixed; min-width: 760px; }
table.month th { text-align: center; }
table.month td { height: 96px; padding: 4px; border-right: 1px solid var(--line); }
table.month td.out { background: #f7f6f3; }
table.month td.weekend { background: #fbfaf7; }
table.month td.is-today .dnum { background: var(--accent); color: #fff; border-radius: 999px; display: inline-block; min-width: 22px; text-align: center; }
table.month td.has-conflict { box-shadow: inset 0 0 0 2px var(--danger); }
.dnum { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chip { display: block; font-size: 11px; line-height: 1.25; padding: 2px 5px; margin-bottom: 2px; border-radius: 5px; color: #1d1d1f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.legend .chip { display: inline-block; }
a.chip:hover { text-decoration: none; filter: brightness(.96); }
.c-tet { background: #cfe8cf; }
.c-emf { background: #ddd0f0; }
.c-breath { background: #fbd7bd; }
.c-other { background: #d6e4f5; }
.c-internal { background: #e8e6e0; }
.c-holiday { background: #f6c9e4; }
.c-off { background: #f0f0f0; color: #777; }
.s-confirmed { font-weight: 600; }
.s-changed { font-weight: 600; border-color: #b06a00; }
.s-draft { opacity: .75; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 4px, transparent 4px 8px); }
.s-tbd { background: #fff !important; border: 1px dashed #999; color: #555; }
.conflict-mark { color: #fff; background: var(--danger); border-radius: 999px; padding: 0 5px; font-size: 11px; font-weight: 700; }
.conflicts { border-color: #f3c2bd; background: #fffafa; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
.b-confirmed { background: #e6f4ea; color: var(--ok); }
.b-changed { background: #fff4e0; color: var(--warn); }
.b-draft { background: #eef2f7; color: #36506e; }
.b-tbd { background: #f0f0f0; color: #555; }

/* Вход с кодом */
.login { margin: 6vh auto; }
.qr-wrap { text-align: center; }
.qr { display: inline-block; }
.secret-key { display: block; font-size: 15px; letter-spacing: .5px; word-spacing: 4px; text-align: center; }
@media (max-width: 600px) {
  .top { gap: 8px; }
  .top nav { gap: 10px; font-size: 14px; }
  main { padding: 14px 12px 40px; }
  h1 { font-size: 21px; }
}
table.payments { margin-top: 8px; }
table.payments th, table.payments td { padding: 4px 6px; }
details summary { cursor: pointer; color: var(--accent); margin: 6px 0; }

/* ---------- Единые размеры элементов управления ---------- */
:root { --ctl-h: 36px; }
button, .btn {
  height: var(--ctl-h); padding: 0 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; white-space: nowrap; vertical-align: middle; font-size: 14px; font-weight: 500;
}
button.link { height: auto; padding: 0; display: inline; font-weight: 400; font-size: inherit; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  height: var(--ctl-h); padding: 0 10px; font-size: 14px;
}
textarea { padding: 8px 10px; font-size: 14px; }
.deal select { height: 30px; }
/* Шапка страницы: заголовок слева, все кнопки справа одной группой */
.head { justify-content: flex-start; margin-bottom: 14px; }
.head > h1 { margin-right: auto; }
.head > .btn, .head > form { flex: 0 0 auto; }
/* Ряд кнопок: ровные промежутки и перенос без слипания */
.actions, .btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row { margin: 12px 0 0; }
.actions form.inline, .btn-row form.inline { display: contents; }
form p:last-child { margin-bottom: 0; }
form > p > button + a, form > p > button + .btn, form > p > .btn + .btn, form > p > button + button { margin-left: 8px; }
/* Фильтры: всё по одной линии */
.filters { align-items: center; }
.filters label, .filters .check { margin: 0; }
.filters .check { height: var(--ctl-h); }
/* Карточки: первый заголовок без лишнего отступа сверху */
.card > :first-child { margin-top: 0; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 12px; }
.card > :last-child { margin-bottom: 0; }

/* Календарь: выбор месяца, перетаскивание, удаление */
.month-pick { display: flex; gap: 6px; margin: 0; }
.month-pick select { width: auto; }
.hint { margin: -4px 0 8px; }
.chip { display: flex; align-items: center; gap: 2px; }
.chip > a { flex: 1; min-width: 0; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip > a:hover { text-decoration: none; }
.legend .chip { display: inline-block; }
.chip-del { margin: 0; flex: 0 0 auto; display: none; }
.chip:hover .chip-del { display: block; }
.chip-del button { height: 16px; width: 16px; padding: 0; border: 0; border-radius: 4px; background: rgba(0,0,0,.08); color: #333; font-size: 13px; line-height: 1; }
.chip-del button:hover { background: var(--danger); color: #fff; }
table.month.editable .chip[draggable=true] { cursor: grab; }
.chip.dragging { opacity: .4; }
table.month td.drop-target { background: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent); }
table.month.busy { opacity: .6; pointer-events: none; }
.row-actions { white-space: nowrap; text-align: right; font-size: 13px; }
.row-actions form.inline { margin-left: 10px; }
button.link.danger-link { color: var(--danger); font-size: 13px; }
@media (hover: none) { .chip-del { display: block; } }

/* Вкладки представлений, как в Asana: Список / Доска / Календарь */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.c-mkt { background: #fde8c8; }
.c-brand { background: #e3e0f7; }

/* Задачи как в Asana */
.check-col { width: 34px; padding-right: 0 !important; }
button.tick { height: 22px; width: 22px; padding: 0; border-radius: 999px; background: #fff; border: 1.5px solid #b9b7b0; color: transparent; font-size: 12px; }
button.tick:hover { border-color: var(--ok); color: var(--ok); }
button.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
tr.is-done td a { color: var(--muted); text-decoration: line-through; }
h2.bucket.b-overdue { color: var(--danger); }
.task-board .col { min-width: 250px; max-width: 290px; }
.task-board .col.drop-target { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-2); }
.tcard { cursor: default; }
.tcard[draggable=true] { cursor: grab; }
.tcard.dragging { opacity: .4; }
.tcard > a { display: block; color: var(--text); margin-bottom: 4px; }
.tmeta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.task-board.busy { opacity: .6; pointer-events: none; }
h2.cal-title { margin: 0; }
.tchip { border-left: 3px solid rgba(0,0,0,.2); }
.tchip.done > a { text-decoration: line-through; color: var(--muted); }
.tchip.late { border-left-color: var(--danger); }
[data-drop].busy { opacity: .6; pointer-events: none; }
.head > h2:first-child { margin-right: auto; }

/* ---------- Темная тема ---------- */
html[data-theme=dark] {
  --bg: #141517; --card: #1d1f22; --text: #e6e6e3; --muted: #9a9a9f; --line: #2f3236;
  --accent: #5fa58e; --accent-2: #1f3330; --danger: #ef7d74; --warn: #e0a54a; --ok: #6cc27a;
  color-scheme: dark;
}
html[data-theme=dark] body { background: var(--bg); }
html[data-theme=dark] input[type=text], html[data-theme=dark] input[type=email], html[data-theme=dark] input[type=password],
html[data-theme=dark] input[type=date], html[data-theme=dark] input[type=number], html[data-theme=dark] select, html[data-theme=dark] textarea {
  background: #16181b; color: var(--text); border-color: #3a3e43;
}
html[data-theme=dark] button, html[data-theme=dark] .btn { color: #0f1a17; }
html[data-theme=dark] button.secondary, html[data-theme=dark] .btn.secondary { background: transparent; color: var(--accent); }
html[data-theme=dark] button.danger { background: transparent; color: var(--danger); border-color: #6b3531; }
html[data-theme=dark] button.link { color: var(--accent); background: none; }
html[data-theme=dark] button.link.danger-link { color: var(--danger); }
html[data-theme=dark] .flash { border-color: #2e4a44; }
html[data-theme=dark] .error { background: #3a1f1d; border-color: #5c2c28; }
html[data-theme=dark] .col { background: #191b1e; }
html[data-theme=dark] .deal { background: var(--card); }
html[data-theme=dark] .secret { background: #2a2416; }
html[data-theme=dark] .code { background: #26292d; }
html[data-theme=dark] .qr { background: #fff; padding: 8px; border-radius: 8px; }
html[data-theme=dark] .conflicts { background: #2a1d1c; border-color: #5c2c28; }
html[data-theme=dark] table.month td.out { background: #18191c; }
html[data-theme=dark] table.month td.weekend { background: #1a1c1f; }
html[data-theme=dark] table.month td.is-today .dnum { color: #0f1a17; }
html[data-theme=dark] button.tick { background: transparent; border-color: #555a60; }
html[data-theme=dark] button.tick.on { color: #0f1a17; }
html[data-theme=dark] .chip-del button { background: rgba(255,255,255,.12); color: var(--text); }
html[data-theme=dark] .tchip { border-left-color: rgba(255,255,255,.25); }
/* Бейджи: темный фон, светлый текст того же оттенка */
html[data-theme=dark] .badge { background: #2b2e32; color: #cfcfcc; }
html[data-theme=dark] .b-lead, html[data-theme=dark] .b-new, html[data-theme=dark] .b-planned, html[data-theme=dark] .b-draft { background: #1f2a38; color: #9fb9d9; }
html[data-theme=dark] .b-contacted, html[data-theme=dark] .b-thinking, html[data-theme=dark] .b-interview, html[data-theme=dark] .b-in_progress,
html[data-theme=dark] .b-sales, html[data-theme=dark] .b-assumed, html[data-theme=dark] .b-changed, html[data-theme=dark] .t-finance { background: #3a2c14; color: #e9b866; }
html[data-theme=dark] .b-awaiting_payment, html[data-theme=dark] .b-prepaid, html[data-theme=dark] .b-review, html[data-theme=dark] .t-legal { background: #30233d; color: #c6a5e6; }
html[data-theme=dark] .b-paid, html[data-theme=dark] .b-active, html[data-theme=dark] .b-done, html[data-theme=dark] .b-running,
html[data-theme=dark] .b-confirmed, html[data-theme=dark] .t-sales { background: #1d3323; color: #8fd59a; }
html[data-theme=dark] .b-completed, html[data-theme=dark] .b-tbd, html[data-theme=dark] .t-ops { background: #2b2e32; color: #b9b9b6; }
html[data-theme=dark] .b-lost, html[data-theme=dark] .b-cancelled, html[data-theme=dark] .b-high { background: #3a1f1d; color: #f1a39c; }
html[data-theme=dark] .t-product { background: #1e2a45; color: #a3baf0; }
html[data-theme=dark] .t-content { background: #3b1f30; color: #eda3cb; }
html[data-theme=dark] .t-infra { background: #18323a; color: #8ccbdd; }
html[data-theme=dark] .t-team { background: #332c1e; color: #d8c69a; }
/* Плашки календаря: приглушенные цвета продуктов */
html[data-theme=dark] .chip { color: #ecece9; }
html[data-theme=dark] .c-tet { background: #2c4a2f; }
html[data-theme=dark] .c-emf { background: #41325c; }
html[data-theme=dark] .c-breath { background: #5a3a22; }
html[data-theme=dark] .c-other { background: #253a55; }
html[data-theme=dark] .c-internal { background: #34363a; }
html[data-theme=dark] .c-holiday { background: #5a2846; }
html[data-theme=dark] .c-off { background: #2a2b2e; color: #9a9a9f; }
html[data-theme=dark] .c-mkt { background: #574018; }
html[data-theme=dark] .c-brand { background: #35305a; }
html[data-theme=dark] .s-changed { border-color: var(--warn); }
html[data-theme=dark] .s-draft { background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.25) 0 4px, transparent 4px 8px); }
html[data-theme=dark] .s-tbd { background: transparent !important; border-color: #666; color: #b0b0ad; }

/* Переключатель темы */
.theme-toggle { height: 30px; width: 30px; padding: 0; border-radius: 999px; background: transparent; border: 1px solid var(--line); color: var(--text); font-size: 15px; }
.theme-toggle:hover { border-color: var(--accent); }
html[data-theme=dark] .theme-toggle { color: var(--text); background: transparent; }
.theme-float { position: fixed; top: 12px; right: 12px; }
/* В светлой теме кнопка показывает луну (перейти в темную), в темной — солнце */
.theme-toggle .i-light { display: none; }
html[data-theme=dark] .theme-toggle .i-light { display: inline; }
html[data-theme=dark] .theme-toggle .i-dark { display: none; }

/* ---------- Телефон ---------- */
.only-mobile { display: none; }
.main-nav a.active { color: var(--accent); font-weight: 600; }
@media (max-width: 700px) {
  .only-mobile { display: revert; }
  div.only-mobile, nav .only-mobile { display: block; }
  .main-nav a.only-mobile { display: inline-block; }
  .only-desktop { display: none !important; }
  body { font-size: 15px; }
  main { padding: 12px 12px 48px; }
  h1 { font-size: 21px; }
  h2 { font-size: 17px; margin: 20px 0 8px; }

  /* Шапка: логотип и кнопки в одну строку, меню — второй строкой с прокруткой вбок */
  .top { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 8px 12px 0; }
  .top .brand { grid-column: 1; align-self: center; }
  .top .me { grid-column: 2; gap: 10px; }
  .top nav.main-nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px;
    margin: 0 -12px; padding: 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .top nav.main-nav::-webkit-scrollbar { display: none; }
  .top nav.main-nav a { flex: 0 0 auto; padding: 9px 8px 10px; border-bottom: 2px solid transparent; white-space: nowrap; }
  .top nav.main-nav a.active { border-bottom-color: var(--accent); }

  /* Поля 16px — иначе iPhone приближает страницу при вводе; кнопки крупнее под палец */
  :root { --ctl-h: 42px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea { font-size: 16px; }
  button, .btn { font-size: 15px; }
  .theme-toggle { height: 34px; width: 34px; }

  /* Шапка страницы: заголовок сверху, кнопки под ним на всю ширину */
  .head { gap: 8px; }
  .head > h1 { flex: 1 1 100%; }
  .head .actions { width: 100%; }
  .head > .btn { flex: 1 1 auto; }
  .month-pick { flex: 1 1 auto; }
  .month-pick select { flex: 1; }

  /* Фильтры — сетка в два столбца */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters > *, .filters input, .filters select { width: 100%; min-width: 0; }
  .filters input[type=text] { grid-column: 1 / -1; min-width: 0; }
  .filters .check { grid-column: 1 / -1; height: auto; }

  /* Вкладки прокручиваются вбок, не переносятся */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs a { flex: 0 0 auto; }

  /* Формы — в один-два столбца */
  .row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .card { padding: 14px; border-radius: 12px; }
  .cols, .grid { gap: 12px; }

  /* Таблицы превращаются в карточки: строка = блок, ячейки текут друг за другом */
  .table-wrap { overflow: visible; border-radius: 12px; }
  main table:not(.month):not(.perm-table) tr:has(> th) { display: none; }
  main table:not(.month):not(.perm-table) tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  main table:not(.month):not(.perm-table) tr:last-child { border-bottom: 0; }
  main table:not(.month):not(.perm-table) td { display: block; border: 0; padding: 0; text-align: left; }
  main table:not(.month):not(.perm-table) td:empty { display: none; }
  main table:not(.month):not(.perm-table) td:first-child:not(.check-col),
  main table:not(.month):not(.perm-table) td.check-col + td { flex: 1 1 calc(100% - 44px); font-size: 15px; }
  main table:not(.month):not(.perm-table) td.check-col { flex: 0 0 32px; align-self: flex-start; }
  main table:not(.month):not(.perm-table) tr:has(td.check-col) { padding-left: 54px; position: relative; }
  main table:not(.month):not(.perm-table) td.check-col { position: absolute; left: 12px; top: 10px; }
  main table:not(.month):not(.perm-table) td.check-col + td { flex-basis: 100%; }
  main table:not(.month):not(.perm-table) td.num { white-space: normal; }
  .row-actions { text-align: left; width: 100%; }
  button.tick { height: 26px; width: 26px; }
  table.perm-table tr { gap: 4px 14px; }

  /* Доски: колонка почти на весь экран, листаются вбок с примагничиванием */
  .board { scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 10px; }
  .col, .task-board .col { min-width: 82vw; max-width: 82vw; scroll-snap-align: start; }

  .agenda-day { margin: 18px 0 6px; font-size: 15px; }
  .agenda-day.today { color: var(--accent); }
  .login { margin: 4vh auto; }
  .theme-float { top: 8px; right: 8px; }
}

@media (max-width: 700px) {
  .filters .check { display: flex; gap: 8px; align-items: center; }
  .filters .check input { width: auto; flex: 0 0 auto; }
  .filters-toggle { width: 100%; margin-bottom: 10px; }
  form.filters.collapsed { display: none; }
}
@media (min-width: 701px) { .filters-toggle { display: none !important; } }
@media (max-width: 700px) {
  .cols > *, .grid > *, .card { min-width: 0; }
  table.payments, table.payments tbody { display: block; }
  table.payments tr:has(> th) { display: none; }
  table.payments tr { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.payments td { display: block; border: 0; padding: 0 !important; text-align: left; }
  table.payments td:empty { display: none; }
  table.perm-table { font-size: 13px; }
  table.perm-table td, table.perm-table th { padding: 6px 4px; }
  .deal-head, .card h3 { overflow-wrap: anywhere; }
}

@media (max-width: 700px) {
  main table:not(.month):not(.perm-table), main table:not(.month):not(.perm-table) > tbody { display: block; width: 100%; }
  main table:not(.month):not(.perm-table) td { overflow-wrap: anywhere; min-width: 0; }
  table.perm-table { display: block; overflow-x: auto; }
}
@media (max-width: 700px) {
  main table:not(.month):not(.perm-table) td.num[data-label] { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 64px; }
  main table:not(.month):not(.perm-table) td.num[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); font-weight: 400; }
}
@media (max-width: 700px) {
  form.status-pick { display: block; margin-top: 8px; }
  form.status-pick select { height: 38px; }
  .board .col { max-height: none; }
}
.tcard:target { box-shadow: 0 0 0 2px var(--accent); scroll-margin: 80px; }
