/* Цвета и размеры. Тему задаёт атрибут data-theme на <html> (ставит скрипт в index.html). */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f0f2f5; --text: #151923; --muted: #667085; --border: #e3e6ec;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-weak: #eef0ff; --on-accent: #ffffff; --danger: #d92d20;
  --ring: rgba(79, 70, 229, 0.22);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --tint-bg: 94%; --tint-fg: 32%; --tint-line: 82%;
  --radius: 12px; --radius-sm: 8px; --sidebar: 236px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1014; --panel: #171a21; --panel-2: #1e222b; --text: #e8eaf0; --muted: #8d95a5; --border: #282d38;
  --accent: #818cf8; --accent-hover: #99a2ff; --accent-weak: #23284a; --on-accent: #0e1014; --danger: #ff7066;
  --ring: rgba(129, 140, 248, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --tint-bg: 19%; --tint-fg: 80%; --tint-line: 32%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* боковое меню */
#topbar { position: sticky; top: 0; flex: 0 0 var(--sidebar); height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 15px; font-weight: 800; box-shadow: var(--shadow); }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a, .me a, .me button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; border: 0; background: none; font-size: 14px; width: 100%; text-align: left; cursor: pointer; height: auto; box-shadow: none; }
nav a:hover, .me a:hover, .me button:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
nav a.active { background: var(--accent-weak); color: var(--accent); }
.me { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
#me-link { color: var(--text); }
#me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bell-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }

main { flex: 1; min-width: 0; width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 72px; }
@media (max-width: 900px) {
  body { flex-direction: column; }
  #topbar { position: static; flex: none; height: auto; width: 100%; flex-direction: row; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand { padding: 4px 8px; }
  .brand span:last-child, .me .label { display: none; }
  nav, .me { flex-direction: row; flex: none; }
  nav { flex: 1; }
  nav a, .me a, .me button { width: auto; white-space: nowrap; }
  .me { border-top: 0; margin: 0; padding: 0; }
  main { padding: 20px 16px 60px; }
}

/* текст */
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 20px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin: 32px 0 12px; }
h3 { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); margin: 8px 0; padding: 8px 12px; border-radius: var(--radius-sm); background: hsl(4 80% var(--tint-bg)); font-size: 13px; }
.overdue { color: var(--danger); font-weight: 600; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* раскладка */
.panel, .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > h1 { margin-bottom: 0; min-width: 0; overflow-wrap: anywhere; }
.row:has(> h1) { margin-bottom: 20px; }
.spacer { flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { transition: box-shadow 0.15s, border-color 0.15s; }
.card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* кнопки и поля */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; font: inherit; font-weight: 500; white-space: nowrap; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; box-shadow: var(--shadow-sm); transition: background 0.12s, border-color 0.12s, box-shadow 0.12s; }
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--accent); box-shadow: none; font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; }
button.danger { color: var(--danger); }
button:disabled, select:disabled, input:disabled { opacity: 0.55; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; transition: border-color 0.12s, box-shadow 0.12s; }
input:not([type="checkbox"]):not([type="file"]), select { height: 36px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; vertical-align: -3px; }
input[type="file"] { padding: 5px; font-size: 13px; color: var(--muted); max-width: 100%; min-width: 0; }
input::file-selector-button { font: inherit; font-size: 13px; margin-right: 8px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); color: var(--text); cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.5; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input:not([type="checkbox"]), .form-grid select { width: 100%; }
.form-grid label { min-height: 38px; display: flex; align-items: end; }
.form-grid .login-label { gap: 5px; white-space: nowrap; }
.user-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 205px; }
.user-actions button[disabled] { opacity: .5; cursor: not-allowed; }
.ticket-danger { margin-top: 14px; padding: 12px 0 2px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.notification-filters { align-items: center; }
.notification-filters .check-label { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; white-space: nowrap; cursor: pointer; }
.notification-filters .check-label input { margin: 0; width: 16px; height: 16px; }
#bulk { padding: 8px 12px; border-radius: var(--radius); background: var(--accent-weak); align-items: center; }
#bulk .bulk-actions { display: inline-flex; gap: 8px; margin-left: auto; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.inline-form input { min-width: 0; flex: 1; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.checklist label { color: var(--text); font-size: 14px; font-weight: 400; display: flex; gap: 8px; align-items: center; margin: 0; }
.preview { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 60px; margin-top: 6px; }

/* таблицы */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
th a { color: inherit; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background 0.1s; }
tr.clickable:hover td { background: var(--panel-2); }
td > a:first-child { font-weight: 500; color: var(--text); }
tr.clickable:hover td > a:first-child { color: var(--accent); }
td:has(> .pick), th:has(> #pick-all) { width: 36px; padding-right: 0; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 14px; }

/* значки, метки, аватары — оттенок задаётся переменной --h */
.badge, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; --s: 12%; background: hsl(var(--h, 220) var(--s) var(--tint-bg)); color: hsl(var(--h, 220) var(--s) var(--tint-fg)); }
.badge[class*="st-"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.st-new { --h: 217; --s: 85%; }
.st-in_progress { --h: 36; --s: 90%; }
.st-review { --h: 265; --s: 75%; }
.st-testing { --h: 180; --s: 70%; }
.st-done { --h: 145; --s: 60%; }
.st-rejected { --s: 6%; }
.pr-urgent { --h: 2; --s: 85%; font-weight: 650; }
.pr-high { --h: 24; --s: 90%; }
.pr-low { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.chip { --s: 65%; background: transparent; box-shadow: inset 0 0 0 1px hsl(var(--h) var(--s) var(--tint-line)); }
a.chip:hover { text-decoration: none; background: hsl(var(--h) var(--s) var(--tint-bg)); }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; background: hsl(var(--h) 60% var(--tint-bg)); color: hsl(var(--h) 60% var(--tint-fg)); vertical-align: middle; }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* вход */
.login-box { width: 100%; max-width: 380px; margin: 9vh auto 0; padding: 32px; box-shadow: var(--shadow-lg); }
.login-box::before { content: "T"; display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 22px; font-weight: 800; }
.login-box h1 { text-align: center; font-size: 20px; }
.login-box input { width: 100%; margin-bottom: 10px; height: 40px !important; }
.login-box button.primary { height: 40px; }

/* задача */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; margin-top: 8px; }
@media (max-width: 1000px) { .ticket-layout { grid-template-columns: minmax(0, 1fr); } .side { position: static; } }
.side { position: sticky; top: 20px; }
.side .field { margin-bottom: 14px; }
.side select, .side input { width: 100%; }
.side h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.comment { border-top: 1px solid var(--border); padding: 14px 0; }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment .body { margin-top: 6px; }
.comment.system { color: var(--muted); font-size: 13px; padding: 8px 0; }
.comment.system .avatar { display: none; }
.item-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; flex-wrap: wrap; }
.attachments { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.attachment { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; font-size: 13px; background: var(--panel-2); }
.attachment img { max-width: 180px; max-height: 120px; border-radius: 6px; display: block; }
.attachment.image { flex-direction: column; align-items: flex-start; padding: 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }

/* разметка текста */
.md { overflow-wrap: anywhere; line-height: 1.6; }
.md p { margin: 0 0 8px; }
.md p:last-child, .md ul:last-child, .md ol:last-child, .md pre:last-child, .md blockquote:last-child { margin-bottom: 0; }
.md h3, .md h4, .md h5 { margin: 14px 0 6px; font-size: 14px; }
.md h3 { font-size: 16px; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md blockquote { margin: 0 0 8px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md code, .md pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--panel-2); border-radius: 6px; }
.md code { padding: 2px 5px; }
.md pre { padding: 12px; overflow-x: auto; margin: 0 0 8px; }
.md pre code { padding: 0; background: none; }
.mention { background: var(--accent-weak); color: var(--accent); border-radius: 5px; padding: 1px 4px; font-weight: 500; }

/* уведомления */
.notification { display: block; border-top: 1px solid var(--border); padding: 12px 10px; margin: 0 -10px; border-radius: var(--radius-sm); color: var(--text); }
.notification:first-child { border-top: 0; }
.notification.unread { font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.notification:hover { text-decoration: none; background: var(--panel-2); }

/* доска */
.board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(150px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 8px; }
.column { background: var(--panel-2); border: 1px solid transparent; border-radius: var(--radius); padding: 10px; min-height: 140px; transition: border-color 0.12s, background 0.12s; }
.column.over { border-color: var(--accent); background: var(--accent-weak); }
.column h3 { margin: 2px 4px 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.kcard { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--text); cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, transform 0.12s, border-color 0.12s; }
.kcard:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.kcard.dragging { opacity: 0.4; }
.kcard > div:nth-child(2) { font-weight: 500; margin: 2px 0 6px; }

/* узкие экраны: таблица прокручивается, а не сжимается в столбик */
.table-wrap table { min-width: 680px; }
tr.clickable td.muted, td.small { white-space: nowrap; }

/* поиск в меню и окно быстрого перехода */
#search-btn { display: flex; justify-content: flex-start; gap: 10px; width: 100%; height: 36px; margin-bottom: 8px; padding: 0 10px; color: var(--muted); background: var(--panel-2); border-color: transparent; box-shadow: none; font-weight: 400; }
#search-btn:hover { border-color: var(--border); color: var(--text); }
kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); font: 11px/16px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
@media (max-width: 900px) { #search-btn { width: auto; margin: 0 8px 0 0; } #search-btn .label, kbd { display: none; } }
#palette { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; background: rgba(10, 12, 20, 0.45); backdrop-filter: blur(2px); }
.palette-box { width: 100%; max-width: 580px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-box input { width: 100%; height: 48px !important; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0 16px; font-size: 15px; }
.palette-box input:focus { box-shadow: none; border-color: var(--border); }
.palette-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.palette-results a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); }
.palette-results a.active, .palette-results a:hover { background: var(--accent-weak); text-decoration: none; }
.palette-hint { padding: 8px 14px; border-top: 1px solid var(--border); }

/* подсказка людей при наборе «@» */
.mention-list { display: flex; flex-direction: column; margin-top: 4px; padding: 4px; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.mention-list button { justify-content: flex-start; gap: 8px; height: 34px; border: 0; box-shadow: none; background: none; font-weight: 400; }
.mention-list button.active, .mention-list button:hover { background: var(--accent-weak); }

/* чек-лист, реакции, внутренние отклики, предупреждения */
.check span { flex: 1; min-width: 0; }
.check.done span { color: var(--muted); text-decoration: line-through; }
.check-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text); font-weight: 400; cursor: pointer; }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.reaction { height: 26px; padding: 0 8px; border-radius: 999px; font-size: 13px; box-shadow: none; background: var(--panel-2); border-color: transparent; }
.reaction.mine { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.reaction-picker { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.comment:hover .reaction-picker, .reaction-picker:focus-within { opacity: 1; }
.reaction.add { background: none; padding: 0 5px; filter: grayscale(1); opacity: 0.6; }
.reaction.add:hover { filter: none; opacity: 1; background: var(--panel-2); }
.comment.internal { margin: 0 -10px; padding: 12px 10px; border-radius: var(--radius-sm); border-top-color: transparent; background: hsl(45 90% var(--tint-bg)); }
.banner { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; background: hsl(36 90% var(--tint-bg)); color: hsl(36 90% var(--tint-fg)); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }
.filters.saved { align-items: center; margin-bottom: 10px; }
.filters.saved .chip { gap: 6px; padding: 3px 6px 3px 10px; }
.filters.saved .chip a { color: inherit; }
h2.lane { margin: 22px 0 8px; font-size: 14px; }

/* календарь */
.calendar { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 104px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-week:last-child .cal-day { border-bottom: 0; }
.cal-day.other { background: var(--panel-2); }
.cal-day.other .cal-date { opacity: 0.5; }
.cal-day.over { background: var(--accent-weak); }
.cal-date { font-size: 12px; color: var(--muted); font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-date { background: var(--accent); color: var(--on-accent); }
.cal-item { display: block; padding: 2px 6px; border-radius: 5px; font-size: 12px; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; --s: 12%; background: hsl(var(--h, 220) var(--s) var(--tint-bg)); color: var(--text); box-shadow: inset 2px 0 0 hsl(var(--h, 220) var(--s) 55%); }
.cal-item:hover { text-decoration: none; filter: brightness(0.97); }
.cal-item.closed { opacity: 0.55; text-decoration: line-through; }
.cal-item.late { box-shadow: inset 2px 0 0 var(--danger); }

/* график этапа: линии — цветом и штрихом, подписи — цветом текста */
.chart-wrap { position: relative; }
svg.chart { display: block; width: 100%; height: auto; max-width: 860px; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .actual { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .plan { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; }
.chart .dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart-tip { position: absolute; top: 8px; width: 158px; padding: 8px 10px; font-size: 12px; line-height: 1.5; pointer-events: none; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 18px; height: 0; border-top: 2px solid var(--accent); }
.swatch.plan { border-top: 2px dashed var(--muted); }
details summary { cursor: pointer; color: var(--accent); }

/* история правок, показатели, столбчатый график */
.history { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--panel-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.version { padding: 6px 0; border-top: 1px solid var(--border); }
.version:first-of-type { border-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.tile .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
:root { --series-1: #2a78d6; --series-2: #eb6834; }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.swatch.box { width: 10px; height: 10px; border: 0; border-radius: 3px; }
.swatch.box.s1 { background: var(--series-1); }
.swatch.box.s2 { background: var(--series-2); }
.chart.weeks .hit:hover { fill: var(--text); fill-opacity: 0.05; }
#workflow .item-row button:not(.link) { width: 34px; padding: 0; }

/* телефон: название задачи не сжимается в столбик, меню — одними значками, поля не вылезают за край */
td:has(> a[href^="#/tickets/"]) { min-width: 220px; }
@media (max-width: 600px) {
  nav a { font-size: 0; gap: 0; padding: 8px; }
  nav { gap: 0; }
  #topbar { gap: 0; padding: 6px 8px; }
  .panel, .card { padding: 14px; }
  .row.small:has(input[type="file"]) { flex-direction: column; align-items: stretch; }
  input[type="file"] { width: 100%; }
  .cal-day { min-height: 72px; padding: 3px; }
  .cal-item { padding: 2px 3px; font-size: 11px; }
}

/* быстрая задача и страница команды */
.quick { padding: 8px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--panel); }
.quick input[name="title"] { flex: 1; min-width: 200px; }
.person .doing { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.person .doing a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person h3 a { color: var(--text); }
.quick select { max-width: 220px; }

/* таймер */
#timer-box { display: flex; align-items: center; gap: 6px; margin: -2px 0 8px; padding: 6px 8px 6px 10px; border-radius: var(--radius-sm); background: hsl(145 60% var(--tint-bg)); }
#timer-box a { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--text); }
#timer-box a:hover { text-decoration: none; }
#timer-box .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#timer-box button { height: 28px; padding: 0 10px; font-size: 12px; }
.timer-clock { font-variant-numeric: tabular-nums; }
.timer-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: hsl(145 60% 42%); animation: timer-pulse 1.6s ease-in-out infinite; display: inline-block; }
@keyframes timer-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .timer-dot { animation: none; } }
.timer-control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.timer-control .timer-clock { font-size: 18px; }
.person .now { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-lg); }
@media (max-width: 900px) { #timer-box { margin: 0 8px 0 0; } #timer-box .muted { display: none; } }

/* кнопки действий, срочность, рабочий день */
.side .actions { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.side .actions button { width: 100%; }
#reason-box { margin: -6px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
h3.urgency { margin: 20px 0 8px; font-size: 14px; }
h3.urgency:first-of-type { margin-top: 0; }
h3.u-overdue { color: var(--danger); }
#workday-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -2px 0 8px; font-size: 13px; }
#workday-box button { height: 30px; padding: 0 10px; font-size: 13px; }
#workday-box > span:first-child:not(.muted) { flex: 1; }
.workday-clock { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { #workday-box { margin: 0 8px 0 0; flex-wrap: nowrap; } #workday-box .muted { display: none; } }

.panel.weekly { margin-bottom: 14px; }
.panel.weekly h3 { margin: 0 0 8px; font-size: 15px; }
.panel.weekly pre { margin: 0; white-space: pre-wrap; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
