/* ===== Дом v2 — дизайн-система ===== */
:root {
  --bg: #F5F6F4; --surface: #FFFFFF; --surface-2: #EEF1EE; --text: #1B1F1D; --muted: #6A736E; --line: #E3E7E3;
  --brand: #1F5F4A; --brand-ink: #FFFFFF; --brand-soft: #E6F1EC; --brand-hover: #1A5040;
  --red: #C62828; --red-soft: #FDEBEA; --amber: #B45309; --amber-soft: #FFF3DF; --blue: #1D4ED8; --blue-soft: #E8EEFC;
  --violet: #6D28D9; --violet-soft: #F0EBFD; --green: #1B7F4B; --green-soft: #E5F4EB; --rose: #BE185D; --rose-soft: #FCE7F3;
  --teal: #0E7490; --teal-soft: #E0F2FE;
  --shadow-1: 0 1px 2px rgba(20,30,25,.06), 0 1px 1px rgba(20,30,25,.04); --shadow-2: 0 10px 28px rgba(20,30,25,.12);
  --r: 12px; --r-lg: 16px; --ease: cubic-bezier(.2,.7,.2,1); --t: 160ms; --sidebar: 236px; --tabs-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1412; --surface: #182019; --surface-2: #1F2A23; --text: #E7ECE8; --muted: #93A098; --line: #27302B;
    --brand: #3A9C78; --brand-soft: #1B2E27; --brand-hover: #46AD87;
    --red: #FF7B72; --red-soft: #3A1F1F; --amber: #F5B04C; --amber-soft: #3A2C14; --blue: #86A8FF; --blue-soft: #1B2542;
    --violet: #B79CFF; --violet-soft: #2A2140; --green: #5FD18F; --green-soft: #17342A; --rose: #F58BB6; --rose-soft: #3A1F2C;
    --teal: #67C9E8; --teal-soft: #14303A;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 28px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
@view-transition { navigation: auto; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .hidden { display: none !important; } .nowrap { white-space: nowrap; }
.desk-only { display: none !important; } @media (min-width: 900px) { .desk-only { display: revert !important; } }
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
button { font: inherit; }
::selection { background: var(--brand-soft); }

/* ----- Каркас ----- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.shell > div { min-width: 0; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--brand); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.topbar .brand { font-weight: 800; font-size: 18px; color: #fff; display: flex; align-items: center; gap: 8px; }
.topbar .spacer { flex: 1; }
.topbar .ibtn { color: #fff; background: rgba(255,255,255,.14); }
.content { padding: 14px 16px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); max-width: 1120px; width: 100%; margin: 0 auto; min-width: 0; }
.content.wide { max-width: none; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
.tabs a .i { width: 22px; height: 22px; } .tabs a.on { color: var(--brand); }
.tabs a.add { justify-content: flex-start; padding-top: 4px; }
.tabs a.add span { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 6px 16px rgba(31,95,74,.45); transition: transform var(--t) var(--ease); }
.tabs a.add:active span { transform: scale(.94); }
.tabs a .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
@media (min-width: 900px) {
  .shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; gap: 4px; }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); padding: 4px 10px 14px; }
  .sidebar .brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
  .sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-weight: 500; transition: background var(--t) var(--ease); }
  .sidebar nav a:hover { background: var(--surface-2); } .sidebar nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .sidebar nav a .i { color: var(--muted); } .sidebar nav a.on .i { color: var(--brand); }
  .sidebar nav a .badge { margin-left: auto; }
  .sidebar .sep { height: 1px; background: var(--line); margin: 8px 6px; }
  .sidebar .grow { flex: 1; }
  .sidebar .btn.primary { margin: 6px 4px 10px; }
  .sidebar .me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); }
  .sidebar .me:hover { background: var(--surface-2); }
  .topbar, .tabs { display: none; }
  .content { padding: 26px 32px 40px; }
}

/* ----- Кнопки, чипы, бейджи ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform var(--t) var(--ease), background var(--t), box-shadow var(--t), border-color var(--t); }
.btn:hover { background: var(--surface-2); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .btn.primary:hover { background: var(--brand-hover); }
.btn.ok { background: var(--green-soft); color: var(--green); border-color: transparent; } .btn.danger { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; } .btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.ibtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; transition: background var(--t), transform var(--t); }
.ibtn:hover { background: var(--line); } .ibtn:active { transform: scale(.94); }
.ibtn.ok { color: var(--green); } .ibtn.warn { color: var(--amber); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12.5px; line-height: 1.6; white-space: nowrap; max-width: 100%; }
.chip .i { width: 14px; height: 14px; }
.chip.on { background: var(--brand); color: #fff; } .chip.link { color: var(--brand); }
.chip.red { background: var(--red-soft); color: var(--red); } .chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.blue { background: var(--blue-soft); color: var(--blue); } .chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.green { background: var(--green-soft); color: var(--green); } .chip.rose { background: var(--rose-soft); color: var(--rose); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; align-items: center; }
.chips::-webkit-scrollbar { display: none; }
.chips a.chip { transition: background var(--t), color var(--t); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.badge.soft { background: var(--surface-2); color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.avatar.lg { width: 34px; height: 34px; font-size: 14px; }
.av-0 { background: #1F5F4A; } .av-1 { background: #1D4ED8; } .av-2 { background: #B45309; } .av-3 { background: #6D28D9; } .av-4 { background: #BE185D; } .av-5 { background: #0E7490; }

/* ----- Заголовок страницы, полоса статусов ----- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 14px; flex-wrap: wrap; min-width: 0; }
.page-head > * { min-width: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow-1); transition: transform var(--t) var(--ease), box-shadow var(--t); }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.stat .n { font-size: 22px; font-weight: 800; line-height: 1; } .stat .l { font-size: 12px; color: var(--muted); line-height: 1.2; }
@media (max-width: 600px) { .stat { padding: 8px 10px; gap: 6px; } .stat .ic { display: none; } .stat .l { font-size: 11.5px; } }
.stat .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat.violet .ic { background: var(--violet-soft); color: var(--violet); } .stat.rose .ic { background: var(--rose-soft); color: var(--rose); }
.stat.red .ic { background: var(--red-soft); color: var(--red); } .stat.red .n { color: var(--red); }
.stat.zero { opacity: .65; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat .n { font-size: 19px; } }

/* ----- Карточка задачи ----- */
.list { display: flex; flex-direction: column; gap: 8px; }
.card { position: relative; display: flex; gap: 10px; padding: 10px 12px 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: transform var(--t) var(--ease), box-shadow var(--t), opacity 220ms, border-color var(--t); animation: fade-up 260ms var(--ease) both; }
.card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--line); }
.card.s-overdue::before { background: var(--red); } .card.s-today::before { background: var(--amber); } .card.s-soon::before { background: var(--blue); }
.card.st-inbox::before { background: var(--violet); } .card.st-find::before { background: var(--rose); } .card.st-waiting::before { background: var(--teal); } .card.st-in_progress::before { background: var(--blue); } .card.st-done::before { background: var(--green); }
@media (hover: hover) { .card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--line) 60%, var(--brand)); } }
.card.leaving { opacity: 0; transform: translateX(24px) scale(.98); }
.card.done-anim { opacity: 0; transform: scale(.97); }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 600; font-size: 15.5px; line-height: 1.3; color: var(--text); display: block; }
.card .title::after { content: ""; position: absolute; inset: 0; }   /* stretched link */
.card .title.blocked { color: var(--muted); }
.card .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; position: relative; z-index: 1; }
.card .due { margin-top: 5px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.card .due .i { width: 14px; height: 14px; }
.due.overdue { color: var(--red); font-weight: 600; } .due.today { color: var(--amber); font-weight: 600; } .due.soon { color: var(--blue); }
.card .acts { display: flex; flex-direction: row; gap: 4px; position: relative; z-index: 2; align-self: flex-start; }
@media (max-width: 899px) { .card .acts { flex-direction: column; } .card .acts [data-act=postpone] { display: none; } .card .acts .ibtn { width: 34px; height: 34px; } }
@media (hover: hover) and (min-width: 900px) { .card .acts { opacity: 0; transition: opacity var(--t); } .card:hover .acts, .card:focus-within .acts { opacity: 1; } }
.card.compact { padding: 8px 10px 8px 12px; } .card.compact .title { font-size: 14px; } .card.compact .meta { margin-top: 4px; }
.card.compact .acts { flex-direction: column; } .card.compact .acts [data-act=postpone], .card.compact .acts [data-act=done] { display: none; }
.card.compact .acts .ibtn { width: 28px; height: 28px; border-radius: 8px; }
.week .card .title { font-size: 13.5px; } .week .card .due { font-size: 12px; }
.card .prog { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.card .prog i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width 400ms var(--ease); }
.group { animation: fade-up 260ms var(--ease) both; }
.group.overdue h2 { color: var(--red); } .group.today h2 { color: var(--amber); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.list .card:nth-child(2) { animation-delay: 25ms; } .list .card:nth-child(3) { animation-delay: 50ms; } .list .card:nth-child(4) { animation-delay: 75ms; } .list .card:nth-child(5) { animation-delay: 100ms; }
.list .card:nth-child(n+6) { animation-delay: 120ms; }

/* ----- Пустые состояния, тосты, сообщения ----- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty .i { width: 34px; height: 34px; color: var(--muted); opacity: .7; }
.empty.ok { color: var(--green); border-color: transparent; background: var(--green-soft); padding: 14px; flex-direction: row; justify-content: center; }
.empty.ok .i { width: 20px; height: 20px; color: var(--green); opacity: 1; }
.empty.inline { padding: 16px; }
.toasts { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 22px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); font-weight: 500; animation: toast-in 220ms var(--ease) both; }
.toast.bad { background: var(--red); color: #fff; } .toast.ok { background: var(--green); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity 300ms, transform 300ms; }
.toast .btn { min-height: 28px; padding: 2px 10px; font-size: 13px; background: rgba(255,255,255,.18); color: inherit; border-color: transparent; }
.notice { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; }
.notice.ok { background: var(--green-soft); color: var(--green); } .notice.bad { background: var(--red-soft); color: var(--red); }

/* ----- Формы ----- */
.form label, .field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .input, .filters select, .filters input {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; transition: border-color var(--t), box-shadow var(--t); }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form input:disabled { opacity: .6; } .form textarea { resize: vertical; min-height: 60px; }
.form label.check, .form .radios label { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--text); }
.form input[type=checkbox], .form input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; gap: 0; } }
.actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
.actions form.inline, form.inline { display: contents; }
.req { color: var(--red); font-weight: 600; font-size: 12px; margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin: 12px 0; box-shadow: var(--shadow-1); }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; } .box-head h3 { margin: 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin-bottom: 10px; }
.filters select, .filters input { margin: 0; font-size: 14px; padding: 7px 9px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.presets .chip { cursor: pointer; border: 1px solid transparent; } .presets .chip:hover { border-color: var(--brand); }
code, .code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-size: 15px; }
.codeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ----- Модалки и нижние листы ----- */
dialog { border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 18px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(10,14,12,.45); backdrop-filter: blur(2px); }
dialog[open] { animation: pop-in 180ms var(--ease) both; }
dialog h3 { margin-bottom: 12px; }
@media (max-width: 600px) { dialog.sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: sheet-in 220ms var(--ease) both; } }
.sheet-list { display: flex; flex-direction: column; gap: 4px; }
.sheet-list button, .sheet-list a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; }
.sheet-list button:hover, .sheet-list a:hover { background: var(--surface-2); } .sheet-list .danger { color: var(--red); }

/* ----- Страница задачи ----- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 7px; background: var(--surface-2); color: var(--muted); }
.pill.inbox { background: var(--violet-soft); color: var(--violet); } .pill.find { background: var(--rose-soft); color: var(--rose); }
.pill.in_progress { background: var(--blue-soft); color: var(--blue); } .pill.waiting { background: var(--teal-soft); color: var(--teal); }
.pill.done { background: var(--green-soft); color: var(--green); } .pill.open { background: var(--brand-soft); color: var(--brand); }
.task-head h1 { margin: 8px 0; font-size: 24px; }
.due-box { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.due-box .i { width: 22px; height: 22px; color: var(--muted); }
.due-box.overdue { background: var(--red-soft); border-color: transparent; } .due-box.overdue .sub, .due-box.overdue .i { color: var(--red); }
.due-box.today { background: var(--amber-soft); border-color: transparent; } .due-box.today .sub, .due-box.today .i { color: var(--amber); }
.due-box .main { font-size: 17px; font-weight: 600; } .due-box .sub { font-size: 13.5px; color: var(--muted); }
.desc { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; margin: 12px 0; }
.steps { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.step .st { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; }
.step.done .st { background: var(--green); border-color: var(--green); } .step.done .t { text-decoration: line-through; color: var(--muted); }
.step.blocked .st { border-style: dashed; } .step .t { flex: 1; min-width: 0; font-weight: 500; color: var(--text); }
.step .sm { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.progress { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 8px; transition: width 500ms var(--ease); }
.search-wrap { position: relative; }
.dropdown { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); overflow: hidden; }
.dropdown button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 12px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.dropdown button:hover { background: var(--surface-2); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.file { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); } .file:hover img { transform: scale(1.04); }
.file .doc { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 6px; font-size: 12px; padding: 8px; text-align: center; color: var(--text); word-break: break-word; }
.file .del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; border: 0; display: grid; place-items: center; cursor: pointer; }
.upload { display: inline-flex; align-items: center; gap: 6px; }
table.tbl { width: 100%; border-collapse: collapse; } table.tbl td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; } table.tbl tr:first-child td { border-top: 0; }
table.tbl td.n { color: var(--muted); width: 24px; } table.tbl td.dates { white-space: nowrap; width: 1%; padding-right: 12px; }
.timeline { margin-top: 20px; }
.ev { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); margin-left: 8px; animation: fade-up 240ms var(--ease) both; }
.ev::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.ev-postponed::before { background: var(--amber); } .ev-comment::before { background: var(--blue); } .ev-status::before, .ev-created::before, .ev-planned::before { background: var(--green); }
.ev-unblocked::before { background: var(--green); } .ev-file::before { background: var(--violet); } .ev-link::before, .ev-unlink::before { background: var(--teal); }
.ev-head { font-size: 13px; } .ev-line { font-size: 14px; color: var(--muted); } .ev-text { white-space: pre-wrap; margin-top: 3px; }
.ev-postponed .ev-text { border-left: 3px solid var(--amber); padding-left: 8px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-left: 8px; } .comment-form textarea { margin: 0; flex: 1; }
.danger-zone { margin-top: 30px; text-align: right; }

/* ----- Доска ----- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 14px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.kanban.dragging { scroll-snap-type: none; }
.col { flex: 0 0 min(84vw, 300px); scroll-snap-align: start; display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--r-lg); max-height: calc(100dvh - 210px); }
@media (min-width: 900px) { .col { flex-basis: 268px; max-height: calc(100dvh - 150px); } }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-weight: 700; font-size: 13.5px; position: sticky; top: 0; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.col-body { flex: 1; overflow-y: auto; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.col-body:empty::after, .col-body.empty::after { content: "Пусто"; color: var(--muted); font-size: 13px; text-align: center; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; }
.col .card { cursor: grab; animation: none; } .col .card:active { cursor: grabbing; }
.sortable-ghost { opacity: .4; } .sortable-drag { transform: rotate(2deg); box-shadow: var(--shadow-2); }
.sortable-chosen { box-shadow: var(--shadow-2); }
.col.drop-ok { outline: 2px dashed var(--brand); outline-offset: -4px; }

/* ----- Неделя ----- */
.week { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, 1fr); gap: 8px; } .week .day { min-height: 200px; } }
.day { background: var(--surface-2); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.day.today { outline: 2px solid var(--amber); outline-offset: -2px; } .day.past { opacity: .8; }
.day-head { display: flex; align-items: baseline; gap: 6px; font-weight: 700; font-size: 13px; padding: 2px 4px; } .day-head .d { font-size: 18px; } .day.today .d { color: var(--amber); }
.day-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 40px; }
.day .card { animation: none; }
.tray { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 8px; margin-bottom: 10px; }
.tray .day-body { flex-direction: row; flex-wrap: wrap; } .tray .card { flex: 1 1 240px; }
.week-nav { display: flex; align-items: center; gap: 8px; }

/* ----- Входящие (разбор) ----- */
.triage { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); margin-bottom: 10px; overflow: hidden; animation: fade-up 260ms var(--ease) both; transition: opacity 240ms, transform 240ms var(--ease); }
.triage.leaving { opacity: 0; transform: translateX(30px); }
.triage summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.triage summary::-webkit-details-marker { display: none; }
.triage summary .t { font-weight: 600; font-size: 16px; flex: 1; } .triage summary .i { color: var(--muted); transition: transform var(--t); }
.triage[open] summary .i.chev { transform: rotate(180deg); }
.triage .body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.triage .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.triage .btns .btn { flex: 1 1 auto; }

/* ----- Вход ----- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; margin: 0; padding: 16px; background: linear-gradient(160deg, var(--brand-soft), var(--bg) 60%); }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-2); animation: pop-in 260ms var(--ease) both; }
.login-box .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; margin-bottom: 12px; }
.login-box h1 { font-size: 26px; }

/* ----- Анимации ----- */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } @view-transition { navigation: none; } }

/* ----- Таймлайн (Gantt) ----- */
.gantt { --cell: 34px; --label: 220px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
@media (max-width: 899px) { .gantt { --cell: 30px; --label: 150px; } }
.g-head, .g-row, .g-group { display: grid; grid-template-columns: var(--label) calc(var(--n) * var(--cell)); min-width: max-content; }
.g-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.g-label { position: sticky; left: 0; z-index: 2; background: var(--surface); padding: 6px 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; font-size: 13.5px; color: var(--text); min-height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-label .small { display: block; overflow: hidden; text-overflow: ellipsis; }
.g-group .g-label { flex-direction: row; align-items: center; gap: 8px; background: var(--surface-2); }
.g-group .g-days { background: var(--surface-2); }
.g-days { position: relative; display: grid; grid-template-columns: repeat(var(--n), var(--cell)); }
.g-day { border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent); min-height: 38px; font-size: 11px; color: var(--muted); text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.g-head .g-day { min-height: 42px; font-weight: 600; } .g-head .g-day .mn { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.g-day.wknd { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.g-day.today { background: var(--amber-soft); } .g-head .g-day.today .dn { background: var(--amber); color: #fff; border-radius: 999px; width: 20px; height: 20px; display: inline-grid; place-items: center; }
.g-row { border-bottom: 1px solid var(--line); } .g-row:hover .g-label { background: var(--surface-2); }
.g-bar { position: absolute; top: 7px; height: 24px; left: calc(var(--s) * var(--cell) + 2px); width: calc((var(--e) - var(--s)) * var(--cell) - 4px); border-radius: 7px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; box-shadow: var(--shadow-1); transition: transform var(--t) var(--ease), box-shadow var(--t); z-index: 1; }
.g-bar:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); z-index: 2; }
.g-bar.st-in_progress { background: var(--blue); } .g-bar.st-waiting { background: var(--teal); } .g-bar.st-find { background: var(--rose); } .g-bar.st-done { background: var(--green); opacity: .8; }
.g-bar.overdue { background: var(--red); }
.g-bar.blocked { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.g-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; } .g-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-plan { position: absolute; top: 4px; bottom: 4px; left: calc(var(--s) * var(--cell) + var(--cell) - 2px); width: 3px; background: var(--amber); border-radius: 2px; z-index: 2; }
.desc, .ev-text, .card .title, .step .t, .g-label { overflow-wrap: anywhere; }
.step .sm { white-space: normal; text-align: right; }
