:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #15212c;
  --muted: #5d6c79;
  --line: #d8dfe5;
  --accent: #17607f;
  --accent-ink: #ffffff;
  --focus: #1b7fb0;

  --todo: #7a8794;
  --prog: #2b6fd4;
  --done: #23865a;
  --missed: #cf2f3a;
  --post: #b87208;
  --todo-bg: #edf0f3;
  --prog-bg: #e4eefc;
  --done-bg: #e1f4ea;
  --missed-bg: #fdeaec;
  --post-bg: #fbf0d9;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(21, 33, 44, .06);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f161c;
    --surface: #17212a;
    --surface-2: #1d2a35;
    --ink: #e7edf2;
    --muted: #92a2b0;
    --line: #2a3945;
    --accent: #4fb0d6;
    --accent-ink: #08202b;
    --focus: #6cc3e6;
    --todo: #8a98a5;
    --prog: #6b9cf0;
    --done: #3fb27e;
    --missed: #ef5d68;
    --post: #e0a23a;
    --todo-bg: #222f3a;
    --prog-bg: #1a2a45;
    --done-bg: #143327;
    --missed-bg: #3b1b20;
    --post-bg: #3a2d12;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }

/* ───── боковое меню: на компьютере и на телефоне одинаковое ───── */
#app.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; align-items: start; --nav-w: 212px; }
#app.shell.nav-rail { --nav-w: 56px; }
.side-slot { align-self: stretch; min-width: 0; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 12px; background: var(--surface);
  border-right: 1px solid var(--line); padding: 12px 8px 10px; padding-top: max(12px, env(safe-area-inset-top)); overflow-x: hidden; overflow-y: auto; z-index: 30; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 34px; }
.brand { font-weight: 750; font-size: 1.05rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; padding: 0 4px; min-width: 0; }
.brand img { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.side-toggle { border: 0; background: none; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); font-size: 1.25rem; line-height: 1; flex: none; padding: 0; }
.side-toggle:hover { background: var(--surface-2); color: var(--ink); }
.tabs { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.tabs a { position: relative; display: flex; align-items: center; gap: 10px; white-space: nowrap; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .98rem; }
.tabs a svg, .who .out svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a:hover { background: var(--surface-2); color: var(--ink); }
.tabs a.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--missed); color: #fff; font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.badge[hidden] { display: none; }
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 6px 0; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.who .lbl { overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 4px; }
.who .out { display: flex; align-items: center; gap: 8px; padding: 4px; }
#app.nav-rail .lbl { display: none; }
#app.nav-rail .side-head { flex-direction: column; gap: 6px; }
#app.nav-rail .brand { padding: 0; }
#app.nav-rail .tabs a { justify-content: center; padding: 9px 0; }
#app.nav-rail .badge { position: absolute; top: 2px; right: 3px; margin: 0; min-width: 16px; height: 16px; font-size: .62rem; padding: 0 3px; }
#app.nav-rail .who { align-items: center; padding: 8px 0 0; }
.side-backdrop { display: none; }

main { max-width: 1280px; margin: 0; padding: 18px 16px 80px; outline: none; min-width: 0; width: 100%; }

@media (max-width: 899px) {
  :root { font-size: 15px; }
  #app.shell, #app.shell.nav-rail, #app.shell.nav-open { --nav-w: 52px; }
  .side-slot { width: 52px; }
  .side { width: 52px; padding-left: 5px; padding-right: 5px; }
  /* развёрнутое меню на телефоне — выезжающая панель поверх страницы */
  #app.nav-open .side { position: fixed; left: 0; top: 0; bottom: 0; width: 236px; padding-left: 8px; padding-right: 8px; box-shadow: 6px 0 24px rgba(0, 0, 0, .28); }
  #app.nav-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 18, 26, .45); }
  main { padding: 12px 10px 80px; }
}

/* ───── кнопки и поля ───── */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; min-height: 40px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--missed); border-color: color-mix(in srgb, var(--missed) 50%, var(--line)); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .9rem; }
.link { border: 0; background: none; color: var(--accent); padding: 4px; font-weight: 600; }
.icon-btn { border: 0; background: none; font-size: 1.1rem; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); }

input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input[type=color], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-height: 40px; }
input[type=color] { padding: 2px; width: 48px; min-height: 36px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: .9rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { font-weight: 400; color: var(--ink); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.hint { color: var(--muted); font-size: .88rem; }

/* ───── заголовок страницы и фильтры ───── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 12px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 600; min-width: 0; }
.ctl.wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .88rem; font-weight: 600; color: var(--muted); min-height: 32px; }
.chip-btn.on { color: #fff; border-color: transparent; }
.chip-btn.on.st-todo { background: var(--todo); }
.chip-btn.on.st-in_progress { background: var(--prog); }
.chip-btn.on.st-done { background: var(--done); }
.chip-btn.on.st-missed { background: var(--missed); }
.chip-btn.on.st-postponed { background: var(--post); }
.chip-btn.on.plain { background: var(--accent); color: var(--accent-ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 14px; font-weight: 600; color: var(--muted); min-height: 36px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.summary { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 2px 10px; font-size: .9rem; color: var(--muted); }
.summary b { color: var(--ink); }

/* ───── панели и списки ───── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel > h2, .panel > .panel-head { padding: 12px 14px 8px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel.alert { border-color: color-mix(in srgb, var(--missed) 45%, var(--line)); }
.panel.alert > h2, .panel.alert .panel-head h2 { color: var(--missed); }
.grp { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--surface-2); border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: .92rem; width: 100%; text-align: left; color: var(--ink); }
button.grp:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
.grp .chev { width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -3px 4px 0 0; flex: none; transition: transform .15s; }
.grp.collapsed .chev { transform: rotate(-45deg); margin: 0 4px 0 -2px; }
.grp-tools { margin-left: auto; display: inline-flex; gap: 10px; }
.grp-tools .link { padding: 0; font-size: .88rem; }
.grp:first-child { border-top: 0; }
.grp .n { margin-left: auto; font-weight: 600; color: var(--muted); font-size: .85rem; }
ul.rows { list-style: none; margin: 0; padding: 0; }
li.row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
li.row:last-child { border-bottom: 0; }
li.row.st-missed { border-left-color: var(--missed); background: var(--missed-bg); }
li.row.st-in_progress { border-left-color: var(--prog); }
li.row.st-postponed { border-left-color: var(--post); }
li.row.late .date { color: var(--missed); font-weight: 700; }
li.row.st-done .row-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.check { flex: none; width: 30px; height: 30px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--todo); background: var(--surface); position: relative; padding: 0; }
.check:hover { border-color: var(--done); }
.check.on { background: var(--done); border-color: var(--done); }
.check.on::after { content: ""; position: absolute; left: 9px; top: 4px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
li.row.st-missed .check { border-color: var(--missed); }
.row-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; display: block; }
.row-title { display: block; font-weight: 650; overflow-wrap: anywhere; }
.row-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 2px; font-size: .85rem; color: var(--muted); }
.row-meta .m-who { color: var(--ink); font-weight: 600; }
.row-meta .m-late { color: var(--missed); font-weight: 700; }
.row-comment { display: block; margin-top: 4px; font-size: .88rem; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 4px 8px; overflow-wrap: anywhere; }
li.row.st-missed .row-comment { background: color-mix(in srgb, var(--missed) 10%, var(--surface)); }
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: .85rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; flex: none; }
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.chip.st-todo { background: var(--todo-bg); color: var(--todo); }
.chip.st-in_progress { background: var(--prog-bg); color: var(--prog); }
.chip.st-done { background: var(--done-bg); color: var(--done); }
.chip.st-missed { background: var(--missed); color: #fff; }
.chip.st-postponed { background: var(--post-bg); color: var(--post); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.02rem; margin-bottom: 2px; }

/* ───── дашборд ───── */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.hero .sub { color: var(--muted); margin-top: 4px; }
.hero .sub b { color: var(--ink); }
.strip { display: grid; grid-template-columns: repeat(7, 1fr) 1.1fr; gap: 6px; margin-bottom: 16px; }
.day { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 8px 4px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 2px; min-width: 0; }
.day:hover { border-color: var(--accent); }
.day.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.day .dow { font-size: .78rem; color: var(--muted); font-weight: 600; }
.day .num { font-size: 1.15rem; font-weight: 750; line-height: 1.1; }
.day.today .num { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 30px; padding: 0 6px; }
.day .bars { height: 56px; display: flex; align-items: flex-end; margin: 4px 0 2px; }
.day .bar { width: 22px; display: flex; flex-direction: column-reverse; border-radius: 4px; overflow: hidden; background: var(--todo-bg); min-height: 4px; }
.day .bar i { display: block; }
.day .bar i.st-done { background: var(--done); }
.day .bar i.st-in_progress { background: var(--prog); }
.day .bar i.st-postponed { background: var(--post); }
.day .bar i.st-todo { background: var(--todo); opacity: .55; }
.day .bar i.st-missed { background: var(--missed); }
.day .cnt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.day.wk { justify-content: center; font-weight: 700; color: var(--muted); }
.day.wk.sel { color: var(--accent); }
.load { padding: 4px 14px 14px; display: grid; gap: 14px; }
.load-row .top-line { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; flex-wrap: wrap; }
.load-row .meter { height: 12px; border-radius: 999px; background: var(--todo-bg); overflow: hidden; display: flex; margin: 6px 0 4px; }
.load-row .meter i { display: block; height: 100%; }
.load-row .meter .m-done { background: var(--done); }
.load-row .meter .m-missed { background: var(--missed); }
.load-row .sub { color: var(--muted); font-size: .85rem; }
.quick { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.quick input { flex: 1; }

/* ───── таблицы ───── */
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--surface-2); font-weight: 650; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl td.nowrap { white-space: nowrap; }

/* ───── журнал ───── */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log .when { color: var(--muted); font-size: .82rem; }
.log .what { margin-top: 2px; }
.log ul { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; color: var(--muted); }
.log del { color: var(--missed); text-decoration-thickness: 1px; }
.log ins { color: var(--done); text-decoration: none; font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); margin-right: 6px; }

/* ───── модальные окна ───── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 18, 26, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 18px 48px rgba(0, 0, 0, .35); margin: 0 auto; }
.modal.wide { max-width: 720px; }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 6px 18px; }
.modal-body { padding: 6px 18px 12px; }
.modal > footer { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.modal > footer .spacer { flex: 1; }
.modal-sub { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.status-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-radio { position: relative; }
.chip-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-radio span { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); font-weight: 650; font-size: .92rem; color: var(--muted); }
.chip-radio input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip-radio.st-todo input:checked + span { background: var(--todo); color: #fff; border-color: transparent; }
.chip-radio.st-in_progress input:checked + span { background: var(--prog); color: #fff; border-color: transparent; }
.chip-radio.st-done input:checked + span { background: var(--done); color: #fff; border-color: transparent; }
.chip-radio.st-missed input:checked + span { background: var(--missed); color: #fff; border-color: transparent; }
.chip-radio.st-postponed input:checked + span { background: var(--post); color: #fff; border-color: transparent; }
.wd-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-pick label { position: relative; }
.wd-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.wd-pick span { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 38px; border: 1px solid var(--line); border-radius: 8px; font-weight: 650; color: var(--muted); }
.wd-pick input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.wd-pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
details.fold { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
details.fold summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
.versions { list-style: none; margin: 6px 0 0; padding: 0; font-size: .9rem; }
.versions li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.versions li:last-child { border-bottom: 0; }
.info-box { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.note-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.note-row input[type=text] { flex: 1; min-width: 140px; }

/* ───── вход и настройки ───── */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px 22px 20px; box-shadow: var(--shadow); }
.login h1 { margin-bottom: 4px; }
.login .hint { margin-bottom: 18px; }
.login .btn { width: 100%; margin-top: 4px; }
.form-error { color: var(--missed); font-weight: 600; font-size: .9rem; min-height: 1.3em; margin-top: 8px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.settings-grid .panel > form:not(.group-row), .settings-grid .panel > .pad { padding: 4px 14px 14px; }
.settings-grid .span-all { grid-column: 1 / -1; }
.group-row { max-width: 760px; display: grid; grid-template-columns: 48px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.group-row:last-child { border-bottom: 0; }

/* ───── уведомления ───── */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 24px); max-width: 480px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.toast.err { background: var(--missed); color: #fff; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ───── печать ───── */
#print-root { display: none; }
.print-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; margin: 6px 0 12px; }
.print-cols label { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); }
.print-cols input { width: 18px; height: 18px; }

@media print {
  body.printing { background: #fff; color: #000; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  #print-root h1 { font-size: 16pt; margin: 0 0 2pt; }
  #print-root .print-sub { font-size: 9pt; color: #444; margin-bottom: 8pt; }
  #print-root table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  #print-root th, #print-root td { border: 1px solid #555; padding: 4pt 6pt; text-align: left; vertical-align: top; }
  #print-root th { background: #e8e8e8; }
  #print-root tr { break-inside: avoid; }
  #print-root td.box { text-align: center; font-size: 14pt; width: 1%; }
  #print-root tr.grp-row td { background: #f2f2f2; font-weight: bold; }
}

/* ───── компьютер: плотнее ───── */
@media (min-width: 900px) {
  :root { font-size: 14px; }
  main { padding: 14px 22px 60px; }
  h1 { font-size: 1.4rem; }
  .page-head { margin-bottom: 10px; }
  .btn { min-height: 34px; padding: 5px 12px; }
  .btn.small { min-height: 28px; padding: 3px 9px; }
  input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], select, textarea { min-height: 34px; padding: 5px 9px; }
  .filters { padding: 9px 10px; gap: 8px 10px; margin-bottom: 10px; }
  .chip-btn { min-height: 28px; padding: 2px 10px; }
  .seg button { min-height: 32px; padding: 4px 12px; }
  .panel { margin-bottom: 12px; }
  .grp { padding: 6px 12px; }
  li.row { padding: 6px 12px; gap: 10px; }
  .check { width: 22px; height: 22px; margin-top: 1px; border-width: 2px; }
  .check.on::after { left: 6px; top: 2px; width: 5px; height: 10px; border-width: 0 2px 2px 0; }
  .row-meta { margin-top: 0; }
  .row-comment { margin-top: 3px; padding: 2px 8px; }
  .tbl th, .tbl td { padding: 5px 10px; }
  .log li { padding: 7px 12px; }
}

/* ───── узкие экраны ───── */
@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { border-radius: 0; max-width: none; min-height: 100%; }
  .strip { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .day.wk { grid-column: 1 / -1; flex-direction: row; padding: 8px; }
  .day .bar { width: 16px; }
  li.row { padding: 10px; gap: 10px; flex-wrap: wrap; }
  .row-main { flex-basis: calc(100% - 50px); }
  .row-side { order: 3; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 10px; margin-left: 40px; text-align: left; }
  .row-side:empty { display: none; }
  .group-row { grid-template-columns: 44px 1fr; }
  .group-row .btn { grid-column: span 1; }
}

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

/* ───── распределение, статистика, прочее ───── */
.muted { color: var(--muted); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.inline-unit { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
.inline-unit input { width: 90px; }
.pause-box { border: 1px solid color-mix(in srgb, var(--post) 45%, var(--line)); background: var(--post-bg); color: var(--ink); }
.loadbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 8px; }
.lcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; display: flex; flex-direction: column; gap: 1px; font-size: .9rem; }
.lcard b { font-size: 1rem; }
.lcard span { color: var(--muted); }
.bulkbar { position: sticky; top: 0; z-index: 15; display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.bulkbar[hidden] { display: none; }
.bulkbar label { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.bulkbar select, .bulkbar input { min-width: 140px; }
.bulkbar input[type=number] { min-width: 70px; width: 80px; }
.tbl.assign td.c, .tbl.assign th.c { width: 32px; text-align: center; padding-left: 8px; padding-right: 4px; }
.tbl.assign input[type=checkbox] { width: 17px; height: 17px; }
.tbl.assign select { min-width: 150px; }
.tbl.assign input[type=number] { width: 70px; }
.tbl.assign td { vertical-align: middle; }
.tbl.assign td.grp-cell { padding: 0; }
.tbl.assign .linkish { border: 0; background: none; padding: 0; text-align: left; font-weight: 650; color: var(--ink); }
.tbl.assign .linkish:hover { color: var(--accent); text-decoration: underline; }
.tbl.assign tr[hidden] { display: none; }

@media (max-width: 899px) {
  .tbl.assign thead { display: none; }
  .tbl.assign, .tbl.assign tbody { display: block; width: 100%; }
  .tbl.assign tr.arow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 64px 64px; grid-template-areas: "c t t t" ". s s s" ". who w m"; gap: 4px 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
  .tbl.assign tr.arow[hidden] { display: none; }
  .tbl.assign tr.arow td { display: block; border: 0; padding: 0; }
  .tbl.assign .a-c { grid-area: c; width: auto; padding: 0; }
  .tbl.assign .a-t { grid-area: t; }
  .tbl.assign .a-s { grid-area: s; font-size: .85rem; }
  .tbl.assign .a-who { grid-area: who; }
  .tbl.assign .a-w { grid-area: w; }
  .tbl.assign .a-m { grid-area: m; }
  .tbl.assign select { min-width: 0; width: 100%; }
  .tbl.assign input[type=number] { width: 100%; }
  .tbl.assign tr:has(.grp-cell) { display: block; }
  .tbl-wrap:has(.assign) { overflow-x: visible; }
  .loadbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulkbar { gap: 6px 8px; }
  .bulkbar select, .bulkbar input { min-width: 0; width: 100%; }
  .bulkbar label { flex: 1 1 130px; }
}
