/*
  Оформление доски задач.

  Ориентир — современный минимализм: мягкие поверхности вместо рамок, крупные
  скругления, плавные движения с «пружинкой», один синий акцент. Никаких
  сторонних библиотек: всё, что здесь есть, — эти правила, поэтому страница
  открывается мгновенно и на слабом телефоне тоже.
*/

:root {
  --bg:         #fbfbfd;
  --surface:    #ffffff;
  --surface-2:  #f2f2f7;
  --surface-3:  #e9e9ef;
  --text:       #1d1d1f;
  --text-dim:   #6e6e73;
  --text-faint: #9a9aa0;
  --line:       #e3e3e8;
  --line-soft:  #eeeef2;
  --accent:     #0071e3;
  --accent-2:   #4d9fff;
  --accent-soft:#e9f2ff;
  --danger:     #d70015;
  --danger-soft:#ffeceb;
  --warn:       #b25000;
  --warn-soft:  #fff2e5;
  --ok:         #1d7a3e;
  --ok-soft:    #e6f6ec;

  --r-xs: 8px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --pill: 980px;

  --sh-1: 0 1px 2px rgba(16,17,20,.05);
  --sh-2: 0 2px 8px rgba(16,17,20,.07), 0 1px 2px rgba(16,17,20,.04);
  --sh-3: 0 8px 28px rgba(16,17,20,.12), 0 2px 6px rgba(16,17,20,.05);
  --sh-4: 0 24px 64px rgba(16,17,20,.2), 0 6px 16px rgba(16,17,20,.08);

  /* Пружинистое замедление — движения кажутся живыми, а не механическими. */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --fast: .18s var(--ease);
  --slow: .34s var(--ease);

  --top-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0b0b0d;
    --surface:    #17171a;
    --surface-2:  #202024;
    --surface-3:  #2a2a30;
    --text:       #f5f5f7;
    --text-dim:   #a1a1a6;
    --text-faint: #6e6e73;
    --line:       #2e2e34;
    --line-soft:  #232328;
    --accent:     #2997ff;
    --accent-2:   #5cb0ff;
    --accent-soft:#12243a;
    --danger:     #ff453a;
    --danger-soft:#2c1614;
    --warn:       #ff9f0a;
    --warn-soft:  #2c2113;
    --ok:         #30d158;
    --ok-soft:    #12271a;
    --sh-1: 0 1px 2px rgba(0,0,0,.5);
    --sh-2: 0 2px 8px rgba(0,0,0,.5);
    --sh-3: 0 8px 28px rgba(0,0,0,.6);
    --sh-4: 0 24px 64px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
::selection { background: var(--accent); color: #fff; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 30px; font-weight: 650; letter-spacing: -.025em; margin: 0 0 6px; }
h2 { font-size: 20px; font-weight: 620; letter-spacing: -.015em; margin: 34px 0 14px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; letter-spacing: -.01em; }
p.lead { color: var(--text-dim); margin: 0 0 26px; font-size: 15px; }

.muted { color: var(--text-dim); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.grow  { flex: 1; }
.row    { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ============================================================ шапка */

.top {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 22px;
  height: var(--top-h); padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  font-weight: 650; letter-spacing: -.02em; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand i {
  width: 20px; height: 20px; border-radius: 6px; display: block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.top-nav { display: flex; gap: 4px; flex: 1; }
.top-nav a {
  color: var(--text-dim); font-size: 14px; padding: 6px 12px;
  border-radius: var(--pill); transition: background var(--fast), color var(--fast);
}
.top-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.top-nav a.on { background: var(--surface-2); color: var(--text); font-weight: 550; }
.top-right { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.who { color: var(--text-dim); margin-right: 6px; }
.ghost {
  color: var(--text-dim); padding: 6px 12px; border-radius: var(--pill);
  transition: background var(--fast), color var(--fast);
}
.ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* На узком экране правые ссылки не помещаются и «Выйти» уезжает за край,
   поэтому там они прячутся в кнопку с инициалами. */
.me-btn {
  display: none; width: 32px; height: 32px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 25%, transparent));
  color: var(--accent); font: inherit; font-size: 11px; font-weight: 700;
  cursor: pointer; flex: 0 0 auto;
}
.narrow-only { display: none; }

/* ============================================================ раскладка */

.wrap { max-width: 1100px; margin: 0 auto; padding: 36px 22px 90px; }
.wrap-wide { max-width: none; margin: 0; padding: 0; }
.center { max-width: 400px; margin: 0 auto; padding: 8vh 22px 40px; }

/* ============================================================ кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--pill); border: 1px solid transparent;
  background: var(--accent); color: #fff; font: inherit; font-size: 14px;
  font-weight: 550; line-height: 1.25; cursor: pointer; white-space: nowrap;
  transition: transform var(--fast), box-shadow var(--fast),
              background var(--fast), opacity var(--fast);
  box-shadow: var(--sh-1);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn.sec {
  background: var(--surface); color: var(--text); border-color: var(--line);
  box-shadow: var(--sh-1);
}
.btn.sec:hover { background: var(--surface-2); }

.btn.quiet {
  background: transparent; color: var(--text-dim); box-shadow: none; padding: 7px 12px;
}
.btn.quiet:hover { background: var(--surface-2); color: var(--text); transform: none; box-shadow: none; }

.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.soft { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.danger.soft:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }

.btn.wide { width: 100%; }
.btn.big  { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: default; transform: none !important; box-shadow: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; border: none;
  background: transparent; color: var(--text-faint); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0;
  transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent); }

/* ============================================================ поля ввода */

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-dim); margin-bottom: 7px; letter-spacing: -.005em;
}

input[type=text], input[type=password], input[type=date], input[type=search],
input[type=number], select, textarea {
  width: 100%; padding: 12px 15px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface-2);
  border: 1.5px solid transparent; border-radius: var(--r);
  outline: none; appearance: none; -webkit-appearance: none;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { background: var(--surface-3); }
input:focus, select:focus, textarea:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* Свой треугольник у списка: родной выглядит по-разному в каждом браузере. */
select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%236e6e73' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}

input[type=date] { cursor: pointer; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .5; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* --- пин-код: четыре отдельных окошка --- */

/* Окошки тянутся по ширине формы: иначе подпись слева, а сами они по центру —
   и поле выглядит съехавшим относительно остальных. */
.pin-boxes { display: flex; gap: 12px; }
.pin-boxes input {
  flex: 1; width: auto; min-width: 0; height: 72px; padding: 0; text-align: center;
  font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums;
  border-radius: 18px; background: var(--surface-2);
  border: 1.5px solid transparent; caret-color: var(--accent);
}
.pin-boxes input:focus {
  background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
  transform: translateY(-2px);
}
.pin-boxes input.filled { background: var(--accent-soft); color: var(--accent); }

/* --- выключатель --- */

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i {
  position: relative; width: 44px; height: 26px; border-radius: var(--pill);
  background: var(--surface-3); flex: 0 0 auto; transition: background var(--slow);
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-2); transition: transform var(--slow);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }

/* --- переключатель из нескольких положений --- */

.seg {
  display: inline-flex; background: var(--surface-2); border-radius: var(--r);
  padding: 3px; gap: 3px; position: relative;
}
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; padding: 7px 15px; border-radius: 11px; font-size: 13.5px;
  font-weight: 500; color: var(--text-dim); cursor: pointer; white-space: nowrap;
  transition: background var(--fast), color var(--fast), box-shadow var(--fast);
}
.seg span:hover { color: var(--text); }
.seg input:checked + span {
  background: var(--surface); color: var(--text); box-shadow: var(--sh-2); font-weight: 600;
}
.seg input:checked + span.v-view { color: var(--accent); }
.seg input:checked + span.v-edit { color: var(--ok); }
.seg input:checked + span.v-none { color: var(--text-faint); }
.seg input:checked + span.s-work { color: var(--accent); }
.seg input:checked + span.s-hold { color: var(--warn); }
.seg input:checked + span.s-done { color: var(--ok); }
.seg.full { display: flex; }
.seg.full label { flex: 1; }
.seg.full span { text-align: center; }

/* --- галочка --- */

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check i {
  width: 21px; height: 21px; border-radius: 7px; flex: 0 0 auto;
  background: var(--surface-2); border: 1.5px solid var(--line);
  display: grid; place-items: center; transition: all var(--fast);
}
.check i::after {
  content: ""; width: 10px; height: 6px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform var(--fast);
}
.check input:checked + i { background: var(--accent); border-color: var(--accent); }
.check input:checked + i::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible + i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }

/* --- выбор цвета --- */

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches i {
  display: block; width: 34px; height: 34px; border-radius: 11px;
  transition: transform var(--fast), box-shadow var(--fast);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatches label:hover i { transform: scale(1.1); }
.swatches input:checked + i {
  transform: scale(1.12);
  box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px currentColor;
}

/* ============================================================ карточки-панели */

.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 24px; margin-bottom: 18px;
  box-shadow: var(--sh-1);
}
.card > h3:first-child { margin-top: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile {
  display: block; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 20px; color: var(--text);
  box-shadow: var(--sh-1);
  transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast);
}
.tile:hover {
  text-decoration: none; transform: translateY(-3px);
  box-shadow: var(--sh-3); border-color: var(--line);
}
.tile .t-kind {
  display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-faint); margin-bottom: 10px;
}
.tile .t-name { font-weight: 620; letter-spacing: -.015em; margin-bottom: 5px; font-size: 16px; }
.tile .t-meta { font-size: 13px; color: var(--text-dim); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px 18px; }
.stat b { display: block; font-size: 28px; font-weight: 650; letter-spacing: -.03em; }
.stat span { font-size: 13px; color: var(--text-dim); }

.flash-wrap { max-width: 1100px; margin: 18px auto 0; padding: 0 22px; }
.flash {
  padding: 14px 18px; border-radius: var(--r); margin-bottom: 10px;
  background: var(--accent-soft); color: var(--text); font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  word-break: break-word;
  animation: slide-in .4s var(--ease);
}
.flash.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } }
.err { color: var(--danger); font-size: 13.5px; margin: 0 0 14px; font-weight: 500; }

/* ============================================================ таблицы */

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.grid td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pill {
  display: inline-block; padding: 3px 11px; border-radius: var(--pill);
  font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-dim);
}
.pill.view { background: var(--accent-soft); color: var(--accent); }
.pill.edit { background: var(--ok-soft); color: var(--ok); }
.pill.own  { background: var(--surface-3); color: var(--text); }
.pill.off  { background: var(--danger-soft); color: var(--danger); }

/* Форма в две-три колонки, которая на телефоне складывается в одну. */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 16px; margin-bottom: 4px;
}

.person + .person { border-top: 1px solid var(--line-soft); }
.person-panel {
  background: var(--surface-2); border-radius: var(--r);
  padding: 18px; margin: 4px 0 14px;
  animation: pop .28s var(--ease);
}
.person-panel .field:last-of-type { margin-bottom: 14px; }

.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }

/* ============================================================ доска */

.board-head {
  position: sticky; top: var(--top-h); z-index: 40;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 22px; background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}
.board-head h1 { font-size: 23px; margin: 0; }

.columns {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px 22px 48px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  min-height: calc(100vh - var(--top-h) - 78px);
}

.col {
  flex: 0 0 312px; width: 312px;
  background: var(--surface-2); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column;
  transition: box-shadow var(--fast), transform var(--fast), opacity var(--fast);
}
.col.col-dragging { opacity: .3; }
.col.col-ghost {
  position: fixed; z-index: 210; pointer-events: none;
  box-shadow: var(--sh-4); transform: rotate(1deg) scale(1.01);
  opacity: .96; max-height: 70vh; overflow: hidden;
}
.col.drop-target { box-shadow: inset 0 0 0 2px var(--accent); }

.col-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding: 0 3px; }
.col-grip {
  cursor: grab; color: var(--text-faint); flex: 0 0 auto; display: grid; place-items: center;
  width: 18px; height: 22px; opacity: 0; transition: opacity var(--fast);
  touch-action: none;
}
.col:hover .col-grip { opacity: 1; }
.col-grip:active { cursor: grabbing; }
.col-grip svg { display: block; }
.c-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.c-dot.work { background: var(--accent); }
.c-dot.hold { background: var(--warn); }
.c-dot.done { background: var(--ok); }
.c-name {
  font-weight: 620; font-size: 14.5px; letter-spacing: -.015em; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 6px; margin: -3px -6px; border-radius: var(--r-xs);
  transition: background var(--fast);
}
.c-name[contenteditable="true"]:hover { background: var(--surface-3); cursor: text; }
.c-name[contenteditable="true"]:focus {
  background: var(--surface); outline: none;
  box-shadow: 0 0 0 2px var(--accent); cursor: text; white-space: normal;
}
.c-count {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  font-variant-numeric: tabular-nums; background: var(--surface-3);
  padding: 2px 8px; border-radius: var(--pill); min-width: 24px; text-align: center;
}
.col.is-hidden { opacity: .55; }
.col.is-hidden .c-name::after { content: " · скрыта"; color: var(--text-faint); font-weight: 400; }

.col-body { display: flex; flex-direction: column; gap: 9px; min-height: 30px; }

/* --- карточка --- */

.kcard {
  background: var(--surface); border-radius: var(--r);
  padding: 12px 14px; cursor: pointer; box-shadow: var(--sh-1);
  border: 1px solid transparent;
  transition: box-shadow var(--fast), transform var(--fast),
              opacity var(--fast), border-color var(--fast);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.kcard:hover { box-shadow: var(--sh-2); border-color: var(--line-soft); transform: translateY(-1px); }
.kcard:active { transform: scale(.99); }
.kcard.dragging { opacity: .3; }
.kcard.ghost {
  position: fixed; z-index: 200; pointer-events: none; width: 284px;
  box-shadow: var(--sh-4); transform: rotate(2deg) scale(1.02); opacity: .97;
  border-color: transparent;
}
.kcard .k-title { font-size: 14.5px; line-height: 1.4; word-break: break-word; font-weight: 480; }
.kcard .k-foot { display: flex; align-items: center; gap: 9px; margin-top: 10px; flex-wrap: wrap; }
.kcard.pending-del { opacity: .5; background: var(--surface-2); border: 1px dashed var(--line); }
.kcard.pending-del .k-title { text-decoration: line-through; color: var(--text-dim); }
.kcard.no-assignee { box-shadow: var(--sh-1), inset 3px 0 0 var(--warn); }

.labels { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.lab {
  height: 7px; width: 36px; border-radius: 4px; font-size: 0; overflow: hidden;
  transition: height var(--fast), width var(--fast), padding var(--fast);
}
body.labels-open .lab {
  height: auto; width: auto; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px; color: #fff; line-height: 1.5;
  letter-spacing: -.005em;
}

.who-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 22%, transparent));
  color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0;
}
.due {
  font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums;
  font-weight: 550; padding: 2px 8px; border-radius: var(--pill); background: var(--surface-2);
}
.due.soon { color: var(--warn); background: var(--warn-soft); }
.due.late { color: var(--danger); background: var(--danger-soft); }
.chk { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; font-weight: 550; }
.mirror-mark { font-size: 12px; color: var(--text-faint); }

.add-card {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--r);
  color: var(--text-dim); font: inherit; font-size: 14px; cursor: pointer;
  background: transparent; border: none; width: 100%; text-align: left;
  transition: background var(--fast), color var(--fast);
}
.add-card:hover { background: var(--surface-3); color: var(--text); }
.add-col { flex: 0 0 260px; width: 260px; background: transparent; box-shadow: none; }
.add-col .add-card {
  background: var(--surface-2); text-align: center; padding: 14px;
  margin: 0; font-weight: 550;
}
.add-col .add-card:hover { background: var(--surface-3); }

/* --- сочинялка новой карточки / колонки --- */

.composer { display: none; flex-direction: column; gap: 8px; margin-top: 10px; }
.composer.on { display: flex; animation: pop .28s var(--ease); }
.composer textarea {
  min-height: 68px; font-size: 14.5px; padding: 11px 13px;
  background: var(--surface); border-color: var(--line); border-radius: var(--r);
}
.composer .row { gap: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ============================================================ выпадающее меню */

.menu {
  position: fixed; z-index: 300; min-width: 210px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-4); padding: 6px; display: none;
  animation: menu-in .2s var(--ease);
}
.menu.on { display: block; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.menu button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: none; background: transparent; border-radius: var(--r-xs);
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: left;
  transition: background var(--fast);
}
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu button:disabled { opacity: .35; cursor: default; }
.menu button:disabled:hover { background: transparent; }
.menu .sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.menu .cap {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); padding: 8px 12px 4px; font-weight: 600;
}
.menu .ic { width: 18px; text-align: center; flex: 0 0 auto; opacity: .65; }

/* ============================================================ окна */

.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(10,10,12,.4);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 18px; overflow-y: auto;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.overlay.on { display: flex; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
body.modal-open { overflow: hidden; }

.sheet {
  background: var(--bg); border-radius: var(--r-xl); width: 100%;
  max-width: 660px; box-shadow: var(--sh-4); padding: 28px; margin: auto 0;
  animation: sheet-in .38s var(--ease);
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }

.sheet-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.sheet .t-title {
  font-size: 22px; font-weight: 620; border: none; padding: 6px 10px;
  background: transparent; letter-spacing: -.02em; border-radius: var(--r-sm);
}
.sheet .t-title:hover { background: var(--surface-2); }
.sheet .t-title:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.sheet-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 24px 10px; }

.block { margin-bottom: 24px; }
.block > h3 {
  color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; margin-bottom: 11px;
}

.pick { display: flex; flex-wrap: wrap; gap: 7px; }
.pick button {
  padding: 7px 14px; border-radius: var(--pill); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text-dim); font: inherit; font-size: 13.5px;
  font-weight: 500; cursor: pointer; transition: all var(--fast);
}
.pick button:hover { border-color: var(--text-faint); color: var(--text); }
.pick button.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--sh-2);
}
.pick button:disabled { opacity: .5; cursor: default; }

.chk-list { display: flex; flex-direction: column; gap: 1px; }
.chk-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 8px;
  border-radius: var(--r-sm); transition: background var(--fast);
}
.chk-item:hover { background: var(--surface-2); }
.chk-item .t { flex: 1; font-size: 14.5px; word-break: break-word; }
.chk-item.done .t { color: var(--text-faint); text-decoration: line-through; }
.chk-item .rm {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 18px; padding: 0 6px; opacity: 0; transition: opacity var(--fast), color var(--fast);
}
.chk-item:hover .rm { opacity: 1; }
.chk-item .rm:hover { color: var(--danger); }
.chk-bar { height: 5px; background: var(--surface-3); border-radius: 3px; margin: 10px 0 12px; overflow: hidden; }
.chk-bar i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 70%, var(--accent)));
  transition: width var(--slow);
}

.chat { display: flex; flex-direction: column; gap: 11px; max-height: 340px; overflow-y: auto; padding: 3px; }
.msg {
  max-width: 82%; padding: 10px 14px; border-radius: 20px;
  background: var(--surface-2); font-size: 14.5px;
  animation: pop .3s var(--ease);
}
.msg .m-who { font-size: 11px; color: var(--text-dim); margin-bottom: 3px; font-weight: 600; }
.msg .m-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg .m-at { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.msg.mine .m-who, .msg.mine .m-at { color: rgba(255,255,255,.8); }
.chat-send { display: flex; gap: 9px; margin-top: 14px; align-items: flex-end; }
.chat-send textarea { min-height: 46px; max-height: 130px; border-radius: 23px; padding: 12px 18px; }
.chat-send .btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 17px; flex: 0 0 auto; }

.sheet-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  border-top: 1px solid var(--line-soft); padding-top: 20px; flex-wrap: wrap;
}

/* --- маленькое окно подтверждения --- */

.dialog { max-width: 400px; padding: 26px; text-align: center; }
.dialog h3 { font-size: 18px; margin-bottom: 8px; }
.dialog p { color: var(--text-dim); font-size: 14px; margin: 0 0 22px; }
.dialog .row { justify-content: center; gap: 10px; }

/* --- всплывающее уведомление --- */

.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg);
  padding: 11px 20px; border-radius: var(--pill); font-size: 14px; font-weight: 500;
  box-shadow: var(--sh-3); animation: toast-in .35s var(--ease);
  backdrop-filter: blur(12px);
}
.toast.out { animation: toast-out .28s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(.94); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.96); } }

.sticky-save {
  position: sticky; bottom: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-soft); padding: 16px 0; margin-top: 22px;
}

/* ============================================================ телефон */

@media (max-width: 780px) {
  :root { --top-h: 52px; }
  .top { padding: 0 14px; gap: 10px; }
  .top-nav { gap: 2px; }
  .top-nav a { padding: 6px 10px; font-size: 13.5px; }
  .who { display: none; }
  .wide-only { display: none; }
  .narrow-only { display: inline-flex; }
  .me-btn { display: inline-flex; align-items: center; justify-content: center; }
  .top-nav { overflow-x: auto; scrollbar-width: none; }
  .top-nav::-webkit-scrollbar { display: none; }
  .wrap { padding: 22px 14px 70px; }
  .flash-wrap { padding: 0 14px; }
  h1 { font-size: 24px; }
  .center { padding: 5vh 18px 40px; }

  .board-head { padding: 13px 14px; gap: 9px; }
  .board-head h1 { font-size: 19px; }

  /* Колонки листаются вбок «страницами»: на узком экране это удобнее,
     чем пытаться уместить их все разом. */
  .columns {
    padding: 14px; gap: 12px;
    scroll-snap-type: x mandatory;
    min-height: calc(100vh - var(--top-h) - 62px);
  }
  .col { flex: 0 0 86vw; width: 86vw; scroll-snap-align: center; }
  .col-grip { opacity: 1; }
  .kcard.ghost { width: 78vw; }
  .add-col { flex: 0 0 70vw; width: 70vw; }

  .overlay { padding: 0; }
  .sheet { max-width: none; border-radius: 0; min-height: 100vh; padding: 20px 16px 40px; }
  .sheet .t-title { font-size: 20px; }
  .dialog { border-radius: var(--r-xl); min-height: auto; margin: auto; max-width: 92vw; }
  .overlay.dlg { padding: 18px; align-items: center; }

  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .msg { max-width: 90%; }
  .menu { min-width: 200px; }
  .pin-boxes input { height: 68px; font-size: 27px; }
}

@media (max-width: 430px) {
  .tiles { grid-template-columns: 1fr; }
  .pin-boxes { gap: 9px; }
  .pin-boxes input { height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
