* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a2233;
  --muted: #6b7488;
  --border: #e3e7ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --yellow: #ca8a04;
  --yellow-bg: #fefce8;
  --blue-bg: #eff6ff;
  /* второй акцент — собрания, и третий — регулярные задачи: свои цвета, но из общей палитры */
  --violet: #7c3aed;
  --violet-bg: #f3e8ff;
  --sky: #0369a1;
  --sky-bg: #e0f2fe;
  --amber: #eab308;
  --sidebar: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
/* ---------- Темы ---------- */
:root[data-theme="emerald"] { --primary: #059669; --primary-dark: #047857; --blue-bg: #ecfdf5; --sidebar: #064e3b; }
:root[data-theme="violet"] { --primary: #7c3aed; --primary-dark: #6d28d9; --blue-bg: #f5f3ff; --sidebar: #2e1065; }
:root[data-theme="sunset"] { --primary: #ea580c; --primary-dark: #c2410c; --blue-bg: #fff7ed; --sidebar: #3b1d0d; }
:root[data-theme="rose"] { --primary: #e11d48; --primary-dark: #be123c; --blue-bg: #fff1f2; --sidebar: #4c0519; }
:root[data-theme="teal"] { --primary: #0d9488; --primary-dark: #0f766e; --blue-bg: #f0fdfa; --sidebar: #042f2e; }
:root[data-theme="graphite"] { --primary: #64748b; --primary-dark: #475569; --blue-bg: #eef2f7; --sidebar: #1e293b; }
:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #0e0a1f; --card: #191233; --text: #ece9f8; --muted: #9d94bd; --border: #2c2250;
  --primary: #8b5cf6; --primary-dark: #7c3aed; --blue-bg: #251b47; --sidebar: #0a0618;
  --red-bg: #3b1214; --orange-bg: #3b2412; --green-bg: #0f2e1c; --yellow-bg: #332a10;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
:root[data-theme="forest"] {
  color-scheme: dark;
  --bg: #08120d; --card: #101f16; --text: #e4efe8; --muted: #8aa896; --border: #1e3629;
  --primary: #10b981; --primary-dark: #059669; --blue-bg: #123527; --sidebar: #050d09;
  --red-bg: #3b1214; --orange-bg: #3b2412; --green-bg: #0f2e1c; --yellow-bg: #332a10;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --card: #131c2e; --text: #e6eaf2; --muted: #8b94a7; --border: #243044;
  --primary: #3b82f6; --primary-dark: #2563eb; --blue-bg: #1e293b; --sidebar: #060b16;
  --red-bg: #3b1214; --orange-bg: #3b2412; --green-bg: #0f2e1c; --yellow-bg: #332a10;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
/* на тёмных темах второй и третий акценты тоже темнеют — иначе светлые пятна на тёмных карточках */
:root[data-mode="dark"] {
  --violet: #c4b5fd; --violet-bg: #2e2150;
  --sky: #7dd3fc; --sky-bg: #10293b;
  --amber: #facc15;
}
:root[data-theme="midnight"] { --violet: #f0abfc; --violet-bg: #3a1c4a; }  /* основной цвет темы сам фиолетовый */
/* где фиолетовый спорит с основным цветом темы — берём соседний оттенок,
   чтобы собрания оставались отличимы от задач, но не выбивались из гаммы */
:root[data-theme="sunset"] { --violet: #be185d; --violet-bg: #fce7f3; }
:root[data-theme="violet"] { --violet: #0891b2; --violet-bg: #cffafe; }
:root[data-mode="dark"] .detail-desc, :root[data-mode="dark"] .tabs,
:root[data-mode="dark"] .tg-code, :root[data-mode="dark"] .modal-close,
:root[data-mode="dark"] .asg-chip, :root[data-mode="dark"] .badge.s-new,
:root[data-mode="dark"] .badge.p-low { background: var(--blue-bg); }
:root[data-mode="dark"] .badge.s-new, :root[data-mode="dark"] .badge.p-low,
:root[data-mode="dark"] .asg-chip { color: var(--muted); }
:root[data-mode="dark"] .assignee-item:hover, :root[data-mode="dark"] table.data tr.clickable:hover { background: var(--blue-bg); }
:root[data-mode="dark"] .task-card.overdue-card { background: #2a1416; }
:root[data-mode="dark"] .dr-box, :root[data-mode="dark"] .review-box { background: #332a10; border-color: #665420; }
:root[data-mode="dark"] .radio-card.checked { background: var(--blue-bg); }
:root[data-mode="dark"] .form-row label { color: var(--text); }
:root[data-mode="dark"] .modal-close { color: #e6eaf2; }
:root[data-mode="dark"] .cal-cell.other { background: transparent; }
:root[data-mode="dark"] input, :root[data-mode="dark"] textarea, :root[data-mode="dark"] select { background-color: var(--blue-bg); color: var(--text); }
:root[data-mode="dark"] input::placeholder, :root[data-mode="dark"] textarea::placeholder { color: #6b7488; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }

/* ---------- Вход ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 62%, #000), var(--sidebar));
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 40px; width: 360px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- Каркас ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--sidebar); color: #d1d5db; display: flex; flex-direction: column;
  padding: 20px 12px; position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 9px; padding: 2px 12px 24px; }
.logo-bolt { width: 22px; height: 22px; filter: drop-shadow(0 0 8px rgba(250, 204, 21, .5)); }
.logo-text {
  font-size: 20px; font-weight: 800; letter-spacing: .18em;
  background: linear-gradient(90deg, #ffffff 20%, color-mix(in srgb, var(--primary) 45%, #ffffff));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; text-align: left; background: none; border: none;
  color: #cbd2dd; padding: 11px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: background .12s, color .12s;
}
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; transition: opacity .12s; }
.nav-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-btn:hover svg { opacity: 1; }
.nav-btn.active {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
}
.nav-btn.active svg { opacity: 1; }
.login-brand {
  font-size: 30px !important; font-weight: 800; letter-spacing: .2em; margin-bottom: 4px;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-bottom { display: flex; flex-direction: column; margin-bottom: 8px; }
.nav-more { display: none; }  /* «Ещё» — только для нижней панели телефона */
.notif-badge {
  display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}
.notif-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--blue-bg); margin: 0 -10px; padding: 10px; border-radius: 8px; border-bottom: none; margin-bottom: 4px; }

/* настройка уведомлений: что приходит, а что нет */
.notif-settings { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; background: var(--card); }
.notif-settings > summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.notif-settings > summary::-webkit-details-marker { display: none; }
.notif-settings > summary::before { content: '▸ '; color: var(--muted); }
.notif-settings[open] > summary::before { content: '▾ '; }
.notif-pref {
  display: flex; align-items: flex-start; gap: 9px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; line-height: 1.35;
}
.notif-pref:last-child { border-bottom: none; }
.notif-pref input { margin-top: 3px; flex: 0 0 auto; }
.notif-pref span { min-width: 0; overflow-wrap: anywhere; }
.notif-feed { max-height: 52vh; overflow-y: auto; }
/* «Без срока» под выбором даты */
.nodl-toggle { font-size: 13px; }

/* Дедлайн и «+» — в одну строку; «+» добавляет день повторения регулярной задачи */
.dl-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-line .dtp { flex: 1 1 auto; min-width: 0; }
.dl-plus { flex: 0 0 auto; font-size: 18px; line-height: 1; padding: 0 12px; min-height: 42px; }
.extra-dates { margin-top: 8px; }
.extra-dates .cp-list { margin-bottom: 4px; }
.nav-btn.dragging { opacity: .4; }
.sidebar nav .nav-btn { position: relative; }
.sidebar nav .nav-btn::after {
  content: '≡'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: 0; transition: opacity .15s; cursor: grab;
}
.sidebar nav .nav-btn:hover::after { opacity: .45; }
.sidebar nav .nav-btn:active::after { cursor: grabbing; }
.sidebar-user { border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 12px 0; }
.user-name { color: #fff; font-weight: 600; font-size: 14px; }
.user-role { font-size: 12.5px; color: #9ca3af; margin-bottom: 10px; }
.main { flex: 1; margin-left: 230px; padding: 28px 32px; max-width: 1200px; }

/* ---------- Общие элементы ---------- */
h2.page-title { font-size: 22px; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-ghost { background: rgba(255, 255, 255, .1); color: #d1d5db; border: none; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.p-urgent { background: var(--red-bg); color: var(--red); }
.badge.p-high { background: var(--orange-bg); color: var(--orange); }
.badge.p-medium { background: var(--blue-bg); color: var(--primary); }
.badge.p-low { background: #f1f5f9; color: var(--muted); }
.badge.s-new { background: #f1f5f9; color: var(--muted); }
.badge.s-in_progress { background: var(--blue-bg); color: var(--primary); }
.badge.s-review { background: var(--yellow-bg); color: var(--yellow); }
.badge.s-done { background: var(--green-bg); color: var(--green); }
.badge.s-returned { background: var(--orange-bg); color: var(--orange); }
.badge.overdue { background: var(--red); color: #fff; }

.light { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.light.red { background: var(--red); box-shadow: 0 0 6px rgba(220, 38, 38, .5); }
.light.yellow { background: var(--amber); }
.light.green { background: var(--green); }

/* ---------- Дашборд ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; }
.kpi .kpi-num { font-size: 28px; font-weight: 800; }
.kpi .kpi-label { font-size: 13px; color: var(--muted); }
.quote-banner {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 16px;
  font-size: 14px; border-left: 4px solid var(--primary); font-style: italic;
}
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.dep-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.dep-stack { display: flex; flex-direction: column; gap: 8px; }
.dep-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 8px; }
.traffic-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.traffic-card { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; font-size: 14px; }
.traffic-card:hover { border-color: var(--primary); }
.kpi.clickable { cursor: pointer; transition: border-color .1s; }
.kpi.clickable:hover { border-color: var(--primary); }
.kpi.red .kpi-num { color: var(--red); }
.kpi.yellow .kpi-num { color: var(--yellow); }
.kpi.green .kpi-num { color: var(--green); }

.section-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #f8fafc; }
.num-red { color: var(--red); font-weight: 700; }
.num-green { color: var(--green); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- Задачи ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
/* «+ Новая задача» и «Голосом» — рядом, отдельной строкой под фильтрами */
.toolbar-actions { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: -8px; }
.toolbar-actions .btn { justify-content: center; min-height: 42px; }
.task-search { flex: 1 1 170px; min-width: 170px; max-width: 320px; }
.tabs { display: flex; gap: 4px; background: #e9edf3; padding: 4px; border-radius: 10px; }
.tab { border: none; background: none; padding: 7px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.spacer { flex: 1; }
select.filter, input.filter { font-size: 14.5px; min-height: 42px; }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card { padding: 14px 18px; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; transition: border-color .1s; }
.task-card:hover { border-color: var(--primary); }
.task-card.overdue-card { border-left: 4px solid var(--red); background: #fffafa; }
.task-card.soon-card { border-left: 4px solid var(--amber); }
/* базовая ширина 240px: при толпе чипов-исполнителей правая часть уезжает на
   новую строку, а не давит название в столбик по букве */
.task-main { flex: 1 1 240px; min-width: 0; }
.task-side { flex: 0 1 auto; max-width: 100%; margin-left: auto; }
.task-title { font-weight: 600; font-size: 15px; word-break: break-word; }
.task-title a, .detail-desc a, .comment a, .note-text a, .review-box a { color: var(--primary); text-decoration: underline; }
/* длинные ссылки и слова не вылезают за рамки карточек */
.note-text, .detail-desc, .comment, .task-title, .review-box, .subtask-row, .asg-row, .notif-item, .quote-banner { overflow-wrap: anywhere; min-width: 0; }
.note-cat { overflow: hidden; }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.asg-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.asg-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 12px; background: #f1f5f9; color: var(--muted); }
.asg-chip.s-done { background: var(--green-bg); color: var(--green); }
.asg-chip.s-review { background: var(--yellow-bg); color: var(--yellow); }
.asg-chip.s-in_progress { background: var(--blue-bg); color: var(--primary); }
.asg-chip.s-returned { background: var(--orange-bg); color: var(--orange); }
.asg-chip.chip-overdue { background: var(--red); color: #fff; }

.week-empty { color: var(--muted); font-size: 13px; padding: 10px 14px; background: var(--card); border: 1px dashed var(--border); border-radius: 10px; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.day-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.day-divider.past span { color: var(--red); }
.day-divider.today span { color: var(--primary); }

.meeting-card { padding: 14px 18px; display: flex; align-items: flex-start; gap: 14px; border-left: 4px solid var(--violet); }

/* ---------- Голосовой ввод и темы ---------- */
.mic-btn {
  border: 1px solid var(--border); background: var(--card); border-radius: 9px; cursor: pointer;
  font-size: 15px; padding: 6px 10px; flex-shrink: 0;
}
.mic-btn:hover { border-color: var(--primary); }
.mic-btn.recording { background: var(--red); border-color: var(--red); animation: pulse-rec 1s infinite; }
@keyframes pulse-rec { 50% { opacity: .6; } }
.with-mic { display: flex; gap: 6px; align-items: flex-start; }
.with-mic input, .with-mic textarea { flex: 1; }
.collapse-btn { font-size: 11px; width: 18px; }
.theme-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.theme-swatch {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--card); cursor: pointer; font-size: 13.5px;
  font-weight: 600; color: var(--text); font-family: inherit;
}
.theme-swatch.active { border-color: var(--primary); background: var(--blue-bg); }
.theme-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.custom-colors { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.custom-color-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
.custom-color-item input[type=color] { width: 26px; height: 26px; border: none; padding: 0; background: none; cursor: pointer; }
.parent-search {
  width: 100%; padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--border);
  border-radius: 9px; font-size: 13.5px; font-family: inherit; outline: none; background: var(--card); color: var(--text);
}
.parent-search:focus { border-color: var(--primary); }

/* ---------- Заметки ---------- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.note-cat { padding: 14px 16px; }
.note-cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.note-cat-head h4 { font-size: 15px; flex: 1; }
.note-count { font-size: 12px; background: var(--blue-bg); color: var(--primary); border-radius: 12px; padding: 1px 8px; font-weight: 700; }
.note-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.note-row:last-of-type { border-bottom: none; }
.note-row input[type=checkbox] { margin-top: 3px; }
.note-text { flex: 1; }
.note-row.done .note-text { text-decoration: line-through; color: var(--muted); }
/* мелкие иконки-кнопки (✕, ✏️, ▼) — не меньше 26 px даже мышью, иначе в них не попасть */
.note-btn { border: none; background: none; cursor: pointer; font-size: 14px; opacity: .55; padding: 4px 6px; min-width: 26px; min-height: 26px; border-radius: 7px; }
.note-btn:hover { background: var(--blue-bg); }
.note-btn:hover { opacity: 1; }
.note-add { display: flex; gap: 6px; margin-top: 8px; }
.note-add input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; outline: none; }
.note-add input:focus { border-color: var(--primary); }

/* ---------- Календарь ---------- */
.cal-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.cal-header h3 { font-size: 17px; min-width: 170px; text-align: center; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; text-transform: uppercase; }
.cal-cell { background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-height: 76px; padding: 6px; font-size: 12px; }
.cal-count { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 7px; margin: 0 3px 3px 0; background: var(--blue-bg); color: var(--primary); }
.cal-count.overdue { background: var(--red); color: #fff; }
.cal-ico { display: none; }  /* значок вместо слова — только на телефоне */
.cal-count.done { background: var(--green-bg); color: var(--green); }
.cal-count.meeting { background: var(--violet-bg); color: var(--violet); }
.cal-count.recur { background: var(--sky-bg); color: var(--sky); }
.day-time.recur-time { background: var(--sky-bg); color: var(--sky); }
.day-time {
  display: inline-block; min-width: 64px; text-align: center; font-weight: 700; font-size: 13px;
  background: var(--blue-bg); color: var(--primary); border-radius: 8px; padding: 4px 8px; flex-shrink: 0;
}
.day-time.late { background: var(--red); color: #fff; }
.day-time.meeting-time { background: var(--violet-bg); color: var(--violet); }
.cal-cell.other { background: transparent; border-color: transparent; }

/* Поздравление имениннику на сводке */
.bday-banner {
  margin-bottom: 14px; padding: 14px 18px; font-size: 15px; line-height: 1.5;
  border-left: 4px solid var(--amber);
  background: linear-gradient(100deg, color-mix(in srgb, var(--amber) 18%, var(--card)), var(--card) 70%);
}

/* Задачник глазами сотрудника: карточка выбора в сводке и плашка-напоминание */
.imp-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 14px; border-left: 4px solid var(--amber); }
.imp-card .filter { flex: 0 1 280px; }
.imp-bar { position: fixed; top: 0; left: 230px; right: 0; z-index: 150; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; background: var(--amber); color: #1f2937; font-size: 13.5px; font-weight: 600; }
.imp-bar .btn { background: #1f2937; color: #fff; border: none; }
body.imp-on .main { padding-top: 64px; }
@media (max-width: 800px) {
  .imp-bar { left: 0; }
  body.imp-on .main { padding-top: 84px; }
}

/* Недельный формат календаря: 7 колонок, в каждой список дел и «+ задача» */
.week-wrap { overflow-x: auto; }
.week-cols { display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr)); gap: 10px; }
.wk-col { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wk-col.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.wk-col.dayoff { background: var(--sidebar); }
.wk-col.dayoff .wk-dow, .wk-col.dayoff .wk-date { color: #fff; }
.wk-head { cursor: pointer; }
.wk-dow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.wk-col.today .wk-dow { color: var(--primary); }
.wk-date { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wk-items { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.wk-item { font-size: 12.5px; line-height: 1.35; padding: 5px 7px; border-radius: 8px; background: var(--blue-bg); color: var(--primary); cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.wk-item.wk-meet { background: var(--violet-bg); color: var(--violet); }
.wk-item.wk-recur { background: var(--sky-bg); color: var(--sky); }
.wk-item.wk-late { background: var(--red); color: #fff; }
.wk-add { border: 1.5px dashed var(--border); background: transparent; color: var(--muted); border-radius: 9px; padding: 7px; font-size: 13px; cursor: pointer; }
.wk-add:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 800px) {
  .week-cols { grid-template-columns: 1fr; }
  .wk-head { display: flex; align-items: baseline; gap: 8px; }
  .wk-add { min-height: 44px; font-size: 16px; }
}
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell.clickable-day { cursor: pointer; }
.cal-cell.clickable-day:hover { border-color: var(--primary); }
.cal-day-num { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.cal-task { padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--blue-bg); color: var(--primary); }
.cal-task.done { background: var(--green-bg); color: var(--green); text-decoration: line-through; }
.cal-task.overdue { background: var(--red); color: #fff; }
.cal-task.review { background: var(--yellow-bg); color: var(--yellow); }
.cal-task.meeting { background: var(--violet-bg); color: var(--violet); font-weight: 600; }

/* ---------- Команда ---------- */
.tree-node { padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.tree-node:last-child { border-bottom: none; }
.tree-indent-1 { padding-left: 40px; }
.tree-indent-2 { padding-left: 66px; }
.tree-indent-3 { padding-left: 92px; }
.tree-indent-4 { padding-left: 118px; }
.tree-name { font-weight: 600; }
.tree-login { color: var(--muted); font-size: 12.5px; }
.inactive { opacity: .45; }

/* ---------- Модальные окна ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .55); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 640px; padding: 26px 28px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); }
.modal h3 { font-size: 19px; margin-bottom: 16px; }
.modal-close { float: right; border: none; background: #f1f5f9; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=datetime-local],
.form-row textarea, .form-row select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; font-family: inherit; outline: none; background-color: var(--card);
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.radio-row { display: flex; gap: 10px; }
.radio-card { flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 13.5px; }
.radio-card input { margin-right: 6px; }
.radio-card.checked { border-color: var(--primary); background: var(--blue-bg); }
.assignee-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; padding: 6px; }
.assignee-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.assignee-item:hover { background: #f8fafc; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- Карточка задачи ---------- */
.task-detail-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.detail-desc { background: #f8fafc; border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 14px; white-space: pre-wrap; }
.detail-meta { font-size: 13px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.asg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.asg-row:last-child { border-bottom: none; }
.subtask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; cursor: pointer; font-size: 13.5px; }
/* названию гарантируется ширина: бейджи уходят на новую строку, а не сжимают текст в столбик */
.row-title { flex: 1 1 200px; min-width: 0; }
.subtask-row:hover { border-color: var(--primary); }
.comment { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.comment:last-child { border-bottom: none; }
.comment-head { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.comment-head b { color: var(--text); }
.activity-item { font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; font-family: inherit; outline: none; }
.dr-box { background: var(--yellow-bg); border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 13.5px; }

.review-box { background: var(--yellow-bg); border: 1px solid #fde68a; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--sidebar); color: #fff; padding: 12px 20px;
  border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}

/* ---------- Настройки ---------- */
.settings-card { padding: 20px 22px; margin-bottom: 16px; max-width: 640px; }
.settings-card h4 { font-size: 15.5px; margin-bottom: 6px; }
.tg-code { font-size: 20px; font-weight: 800; letter-spacing: .05em; background: #f1f5f9; padding: 8px 16px; border-radius: 8px; display: inline-block; margin: 8px 0; }

/* ---------- Свой календарь PULSE ---------- */
.dtp { display: inline-flex; min-width: 170px; }
/* поле даты выглядит ровно как свой выпадающий список: та же рамка, высота и стрелка */
.form-row .dtp .dtp-view, .dtp .dtp-view, .dtp-view {
  cursor: pointer; width: 100%; font-family: inherit; font-size: 14.5px; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 34px 10px 12px; min-height: 42px; outline: none;
}
.dtp { position: relative; }
.dtp::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.dtp-view:hover { border-color: var(--primary); }
.dtp.hidden { display: none; }
.dtp-pop {
  position: fixed; z-index: 300; width: 318px; max-width: calc(100vw - 16px); background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
}
.dtp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 14.5px; }
.dtp-nav {
  border: 1px solid var(--border); background: var(--card); color: var(--text); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
}
.dtp-nav:hover { border-color: var(--primary); color: var(--primary); }
.dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dtp-dow { text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 3px 0; }
.dtp-day {
  border: none; background: none; color: var(--text); font-family: inherit; font-size: 13px;
  height: 32px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.dtp-day:hover { background: var(--blue-bg); color: var(--primary); }
.dtp-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.dtp-day.sel { background: var(--primary); color: #fff; font-weight: 700; }
.dtp-foot { display: flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.dtp-foot select { padding: 6px 22px 6px 8px; font-size: 13.5px; background-position: right 6px center; }
/* время набирается вручную, а не выбирается из длинного списка */
.dtp-time {
  width: 86px; flex: 0 0 86px; text-align: center; font-size: 15px; font-family: inherit;
  padding: 8px 6px; min-height: 38px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); outline: none; font-variant-numeric: tabular-nums;
}
.dtp-time:focus { border-color: var(--primary); }
.dtp-time.dtp-bad { border-color: var(--red); }
.dtp-foot .btn { padding: 8px 10px; white-space: nowrap; flex-shrink: 0; min-height: 38px; font-size: 13px; }

/* ---------- Единый стиль контролов: селекты, поля, даты ---------- */
:root { color-scheme: light; }
* { accent-color: var(--primary); }
input[type="text"], input[type="password"], input[type="date"], input[type="datetime-local"], textarea, select {
  font-family: inherit; font-size: 14px; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 32px;
  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' fill='none' stroke='%236b7488' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="date"], input[type="datetime-local"], .day-time, .kpi-num, .cal-day-num, table.data td { font-variant-numeric: tabular-nums; }
::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
::-webkit-calendar-picker-indicator:hover { opacity: 1; }
:root[data-mode="dark"] ::-webkit-calendar-picker-indicator { filter: invert(1); }
select.filter, input.filter { padding-top: 9px; padding-bottom: 9px; }

/* ---------- Планшеты и всё, чем пользуются пальцем ---------- */
@media (max-width: 1024px) {
  .btn { min-height: 42px; }
  .btn-sm { padding: 9px 13px; font-size: 13.5px; min-height: 40px; }
  .note-btn { font-size: 17px; padding: 8px 10px; min-width: 40px; min-height: 40px; opacity: .8; }
  .tab { min-height: 44px; padding: 11px 14px; }
  .theme-swatch { min-height: 44px; }
  /* 16px обязательны: при меньшем шрифте iOS зумит страницу на каждом поле */
  select, input, textarea,
  .form-row input[type=text], .form-row input[type=password], .form-row textarea, .form-row select,
  select.filter, input.filter, .note-add input, .comment-form input, .dtp-foot select,
  .login-card input, .parent-search { font-size: 16px; min-height: 44px; }
  .form-row .dtp .dtp-view, .dtp .dtp-view, .dtp-view { font-size: 16px; min-height: 44px; }
  textarea, .form-row textarea { min-height: 84px; }
  .dtp-day { height: 40px; font-size: 14px; }
  .dtp-nav { width: 40px; height: 40px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 20px; }
  .assignee-item { padding: 11px 10px; }
  /* широкие таблицы прокручиваются внутри себя, а не растягивают страницу */
  table.data { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-cell { min-width: 0; overflow: hidden; }
  /* min-width:0 — иначе широкая таблица распирает колонку контента за экран */
  .main { max-width: calc(100vw - 230px); min-width: 0; }
}

@media (max-width: 800px) {
  /* мобильный режим: меню становится нижней панелью, как в приложениях */
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: 100%;
    flex-direction: row; align-items: center; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    z-index: 40; box-shadow: 0 -4px 16px rgba(0, 0, 0, .25);
  }
  .sidebar-logo, .sidebar-user { display: none; }
  .sidebar nav { flex-direction: row; flex: 1; gap: 0; justify-content: space-around; }
  .nav-bottom { flex-direction: row; margin-bottom: 0; }
  .sidebar nav .nav-btn::after { display: none; }
  /* нижняя панель: все разделы в два ряда по 5 — ничего не спрятано, кнопки крупные */
  .sidebar { flex-wrap: wrap; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .sidebar nav, .nav-bottom { display: contents; }
  .nav-more { display: none !important; }
  .nav-btn {
    flex: 0 0 20%; max-width: 20%; min-width: 0; min-height: 60px;
    padding: 8px 2px; border-radius: 12px; flex-direction: column; justify-content: center;
    align-items: center; gap: 4px; text-align: center;
  }
  .nav-btn svg { width: 23px; height: 23px; }
  .nav-btn span { display: block; font-size: 10px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .notif-badge { position: absolute; top: 4px; right: 50%; margin-right: -22px; margin-left: 0; font-size: 10px; padding: 0 5px; }
  .nav-btn { position: relative; }

  /* пальцу нужно минимум 40 px: увеличиваем все мелкие кнопки */
  .note-btn { font-size: 17px; padding: 8px 10px; min-width: 40px; min-height: 40px; opacity: .8; }
  .btn-sm { padding: 9px 13px; font-size: 13.5px; min-height: 40px; }
  .btn { min-height: 42px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .assignee-item { padding: 11px 10px; }
  .tab { min-height: 44px; padding: 11px 14px; font-size: 13.5px; }
  .tabs { flex-wrap: wrap; gap: 4px; }
  select.filter, .filter, .sel-btn, .sel-btn.filter { min-height: 44px; font-size: 16px; }
  input, textarea, select { font-size: 16px; }   /* меньше 16px — iOS зумит страницу при фокусе */

  /* таблицы (рейтинг, команда) прокручиваются пальцем, а не ломают страницу */
  table.data { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 10px 10px; }

  /* модальные окна — как шторка снизу, во весь экран */
  .modal-overlay { align-items: flex-end; padding: 0; overflow: hidden; }
  .modal { width: 100%; max-width: 100%; max-height: 96vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
           border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .radio-row { flex-direction: column; }            /* «Общая / Индивидуальная / Себе» — в столбик */
  .radio-card { width: 100%; min-height: 52px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dep-cols { grid-template-columns: 1fr; }
  .quick-chips .btn { flex: 0 0 auto; }
  .main { margin-left: 0; padding: 16px 12px 156px; max-width: 100vw; overflow-x: hidden; }
  .card { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  /* календарь целиком влезает в экран: колонки могут сжиматься, счётчики переносятся */
  .cal-grid { gap: 2px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-cell { min-height: 58px; padding: 2px; font-size: 10px; min-width: 0; overflow: hidden; }
  .cal-day-num { font-size: 11px; margin-bottom: 2px; }
  .cal-count { font-size: 11px; padding: 1px 5px; margin: 0 1px 2px 0; max-width: 100%; white-space: nowrap; }
  .cal-word { display: none; }        /* на телефоне вместо «2 собрания» — «2 🤝» */
  .cal-ico { display: inline; }
  .cal-dow { font-size: 10px; padding: 2px 0; }
  .card:has(.cal-grid) { overflow-x: hidden; }
  .spacer { display: none; }          /* иначе кнопки уезжают за правый край экрана */
  .toolbar, .cal-header { justify-content: flex-start; flex-wrap: wrap; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 8px 8px; }
  .modal { padding: 18px 16px; }
  .modal-overlay { padding: 12px 8px; }
  .toolbar { gap: 8px; }
  .notes-grid { grid-template-columns: 1fr; }
}

/* Справка */
.help-sec { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; max-width: 760px; }
.help-sec summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; align-items: center; gap: 4px; user-select: none; }
.help-sec summary::before { content: '▸'; color: var(--muted); margin-right: 6px; transition: transform .15s; }
.help-sec[open] summary::before { transform: rotate(90deg); }
.help-sec summary::-webkit-details-marker { display: none; }
.help-body { padding: 0 18px 14px; font-size: 14px; line-height: 1.65; }
.help-body p { margin: 6px 0; }
.help-body ol, .help-body ul { margin: 6px 0; padding-left: 20px; }
.help-body li { margin-bottom: 7px; }
.help-boss-title { margin: 22px 0 10px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Итоги собрания */
.meeting-summary {
  margin-top: 8px; padding: 8px 11px; font-size: 13px; line-height: 1.55;
  background: var(--blue-bg); border-left: 3px solid var(--primary); border-radius: 8px;
  overflow-wrap: anywhere;
}

/* Выходные и праздники в календаре — видно на любом устройстве */
/* выходные и праздники — в цвет левой колонки, чтобы читалось как единая система */
.cal-cell.dayoff { background: var(--sidebar); border-color: var(--sidebar); }
.cal-cell.dayoff .cal-day-num { color: #ffffff; }
.cal-holiday {
  font-size: 9.5px; line-height: 1.15; font-weight: 600; color: #cbd2dd;
  margin-bottom: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cal-cell.dayoff.today { border-color: var(--primary); }
.dtp-day.dtp-off { color: var(--sidebar); font-weight: 700; }
:root[data-mode="dark"] .dtp-day.dtp-off { color: #93a3bd; }

/* Свои выпадающие списки вместо системных — единый стиль на всех устройствах */
.sel-wrap { position: relative; display: block; }
.sel-wrap select {
  position: absolute; opacity: 0; pointer-events: none;
  width: 100%; height: 100%; left: 0; top: 0; margin: 0;
}
.sel-btn {
  width: 100%; text-align: left; font-family: inherit; font-size: 14.5px; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 34px 10px 12px; cursor: pointer; position: relative;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 42px;
}
.sel-btn::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.sel-btn:hover { border-color: var(--primary); }
.sel-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 1px; }
/* один размер у всех контролов: списки, поля, даты — ничего не выбивается */
.sel-btn.filter { font-size: 14.5px; padding: 10px 34px 10px 12px; min-height: 42px; }
.sel-btn:disabled { opacity: .55; cursor: not-allowed; }

.sel-pop {
  position: fixed; z-index: 400; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .22); padding: 6px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sel-search {
  width: 100%; margin-bottom: 6px; padding: 9px 11px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); outline: none;
  /* длинный список прокручивается — поиск должен оставаться на виду */
  position: sticky; top: 0; z-index: 1;
}
.sel-list { display: flex; flex-direction: column; gap: 1px; }
.sel-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; font-family: inherit; font-size: 14.5px; color: var(--text);
  padding: 10px 10px; border-radius: 8px; cursor: pointer; min-height: 42px; line-height: 1.25;
}
.sel-opt:hover { background: var(--blue-bg); color: var(--primary); }
.sel-opt.sel { background: var(--blue-bg); color: var(--primary); font-weight: 600; }
.sel-check { width: 14px; flex-shrink: 0; color: var(--primary); font-size: 13px; }

/* Промежуточный контроль */
.cp-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cp-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cp-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600;
  background: var(--blue-bg); color: var(--primary); border-radius: 10px; padding: 5px 8px 5px 10px;
}
.cp-chip.passed { background: var(--green-bg); color: var(--green); }
.cp-chip .note-btn { font-size: 12px; padding: 0 2px; color: inherit; min-width: 18px; min-height: 18px; }
.cp-chip .note-btn:hover { background: none; }

/* Тач-размеры для контролов, описанных ниже медиазапросов (порядок правил важен) */
@media (max-width: 1024px) {
  .dtp-time { width: 96px; flex: 0 0 96px; font-size: 16px; }
  .sel-btn, .sel-btn.filter { font-size: 16px; min-height: 44px; }
  .sel-opt { font-size: 15.5px; min-height: 44px; }
  .form-row .dtp .dtp-view, .dtp .dtp-view, .dtp-view { font-size: 16px; min-height: 44px; }
}

/* «Дополнительно» в формах — редко нужные поля не занимают экран */
.form-more { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; background: var(--card); }
.form-more > summary {
  cursor: pointer; padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  list-style: none; user-select: none;
}
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::before { content: '▸ '; }
.form-more[open] > summary::before { content: '▾ '; }
.form-more > .form-row, .form-more > details { padding: 0 14px; }
.form-more > .form-row:last-of-type { padding-bottom: 12px; }
.form-more .form-row { margin-bottom: 12px; }

/* Формы на телефоне: компактнее, чтобы окно постановки задачи почти не листалось */
@media (max-width: 800px) {
  .modal .form-row { margin-bottom: 10px; }
  .modal .form-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .modal .form-row > label { margin-bottom: 3px; font-size: 13px; }
  .modal .radio-card { min-height: 46px; padding: 10px 12px; font-size: 13.5px; }
  .modal .radio-row { gap: 6px; }
  .modal textarea, .modal .form-row textarea { min-height: 64px; }
  .form-more > summary { padding: 10px 12px; font-size: 13.5px; }
}
@media (max-width: 800px) {
  .modal .radio-row { flex-direction: row; flex-wrap: wrap; }
  .modal .radio-card { flex: 1 1 calc(50% - 3px); width: auto; min-height: 44px; font-size: 13px; padding: 9px 10px; }
  .modal { padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .modal h3 { font-size: 17px; margin-bottom: 8px; }
  .modal .modal-actions { margin-top: 10px; }
}
@media (max-width: 800px) { .modal .form-more { margin-bottom: 8px; } .modal .form-error:empty { display: none; } }
.dtp-view.dtp-bad { border-color: var(--red); }

/* Совместные заметки */
.note-shared {
  font-size: 11.5px; font-weight: 600; color: var(--primary); background: var(--blue-bg);
  border-radius: 10px; padding: 2px 7px; white-space: nowrap; flex-shrink: 0;
}

/* Загрузка дня */
.xp-line { display: flex; align-items: center; gap: 8px; }
.xp-line input[type=number] { width: 92px; text-align: center; }
.energy-box { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.energy-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.energy-name { flex: 0 0 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.energy-bar { flex: 1; height: 8px; background: var(--border); border-radius: 6px; overflow: hidden; }
.energy-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; transition: width .2s; }
.energy-bar i.warn { background: var(--yellow); }
.energy-bar i.over { background: var(--red); }
.energy-num { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.energy-num.warn { color: var(--yellow); }
.energy-num.over { color: var(--red); }
.energy-head { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.xp-mini { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.xp-mini .energy-bar { flex: 1; height: 6px; }
.xp-mini .energy-num { font-size: 11px; }
.num-orange { color: var(--orange); font-weight: 600; }

/* Экскурсия по «Пульсу» */
.tour-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .55); z-index: 500; display: flex; align-items: flex-end; justify-content: center; padding: 24px; }
.tour-card { background: var(--card); border-radius: 16px; padding: 22px 24px; max-width: 560px; width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,.4); max-height: 78vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tour-card ul { margin: 8px 0 0 18px; }
.tour-card li { font-size: 14px; line-height: 1.55; margin-bottom: 5px; }
.tour-card p + p { margin-top: 8px; }
.tour-step { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.tour-card h3 { margin-bottom: 8px; }
.tour-card p { font-size: 14.5px; line-height: 1.6; color: var(--text); }
.tour-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 18px;
  position: sticky; bottom: -22px; background: var(--card); padding: 12px 0 2px;
  border-top: 1px solid var(--border);
}
.tour-hl { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 10px; position: relative; z-index: 501; pointer-events: none; }
@media (max-width: 800px) { .tour-overlay { padding: 10px 8px 92px; } .tour-card { padding: 16px 14px; max-height: 72vh; } .tour-actions { bottom: -16px; } .tour-card li { font-size: 13.5px; } }

/* Окна поверх окон (помощник, предупреждение по загрузке) — выше календаря и списков,
   иначе выпадающий календарь (z-index 300) перекрывал бы их кнопки */
.modal-overlay.overlay-top { z-index: 450; }

/* Пункты заметок пальцем: галочка крупнее, строка не ниже 44 px */
@media (max-width: 1024px) {
  .note-row { min-height: 44px; align-items: center; }
  .note-row input[type=checkbox] { width: 24px; height: 24px; min-height: 24px; margin: 0 2px; }
}

/* ---------- Правила отдела ---------- */
.rule-alert {
  background: var(--yellow-bg); border: 1px solid var(--yellow); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; font-size: 14px;
}
:root[data-mode="dark"] .rule-alert { background: #332a10; border-color: #665420; }
.rule-card { padding: 15px 18px; border-left: 4px solid var(--yellow); }
.rule-card.rule-active { border-left-color: var(--green); }
.rule-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rule-title { font-weight: 700; font-size: 15.5px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rule-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 8px; }
.rule-body a { color: var(--primary); text-decoration: underline; }
.rule-meta { margin-bottom: 8px; overflow-wrap: anywhere; }
.rule-people { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.ack-chip {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 12px;
  background: var(--blue-bg); color: var(--muted); white-space: nowrap;
}
.ack-chip.ok { background: var(--green-bg); color: var(--green); }
.rule-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rule-rev { border-bottom: 1px solid var(--border); padding: 10px 0; }
.rule-rev:last-child { border-bottom: none; }
.cal-who { max-width: 260px; }

/* Обсуждение правила: переписка живёт в окне, история прокручивается внутри себя */
.chat-new {
  display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 0 5px; margin-left: 4px; vertical-align: middle;
}
.chat-rule-title { margin: -4px 0 10px; overflow-wrap: anywhere; }
.chat-box {
  max-height: 46vh; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 8px;
}
.chat-empty { text-align: center; padding: 18px 6px; margin: 0; }
.chat-day { text-align: center; margin: 4px 0 2px; }
.chat-day span {
  display: inline-block; font-size: 12px; color: var(--muted);
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px;
}
.chat-msg {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 11px; max-width: 88%; align-self: flex-start; min-width: 0;
}
/* свои реплики оттеняем от акцента темы: в тёмных темах --blue-bg совпадает
   с фоном карточки, и «мои/чужие» переставали различаться */
.chat-msg.mine {
  align-self: flex-end;
  background: color-mix(in srgb, var(--primary) 16%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
}
.chat-head { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 3px; flex-wrap: wrap; }
.chat-time { margin-left: auto; white-space: nowrap; }
.chat-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.chat-del:hover { background: var(--red-bg); color: var(--red); }
.chat-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-form textarea { flex: 1; min-height: 42px; resize: none; margin: 0; }
.chat-form .btn { flex: 0 0 auto; }

@media (max-width: 800px) {
  .rule-actions .btn { flex: 1 1 auto; justify-content: center; }
  .cal-who { max-width: 100%; flex: 1 1 100%; }
  .chat-box { max-height: 40vh; }
  .chat-msg { max-width: 100%; }
  .chat-form .btn { padding: 0 12px; }
}

/* Нижняя панель на телефоне: разделов стало 11 — раскладываем по 6 в ряд,
   иначе появлялся третий ряд и панель съедала экран */
@media (max-width: 800px) {
  .nav-btn { flex: 0 0 16.6667%; max-width: 16.6667%; padding: 8px 1px; }
  .nav-btn svg { width: 21px; height: 21px; }
  .nav-btn span { font-size: 9px; letter-spacing: -.2px; }
  .notif-badge { margin-right: -16px; }
}

/* Панель календаря переносится по строкам: с выбором сотрудника она перестала
   влезать в колонку контента на планшете и распирала страницу */
.cal-header { flex-wrap: wrap; }
.cal-who { flex: 0 1 220px; min-width: 150px; }

/* Переключатель «Все / Мои / Моих сотрудников» в блоках сводки */
.scope-tabs { display: inline-flex; margin: -4px 0 10px; flex-wrap: wrap; }
.scope-tabs .tab { padding: 6px 12px; font-size: 13px; }
.scope-num { opacity: .6; font-weight: 700; margin-left: 3px; }
.scope-tabs .tab.active .scope-num { opacity: .85; }
@media (max-width: 800px) {
  .scope-tabs { display: flex; width: 100%; }
  .scope-tabs .tab { flex: 1 1 auto; min-height: 40px; padding: 8px 6px; font-size: 12.5px; }
}

/* Экскурсия: затемнение ниже подсветки, карточка с текстом — выше неё.
   Иначе подсвеченный блок (z-index 501) наезжал на текст экскурсии и прятал его. */
.tour-dim { position: fixed; inset: 0; background: rgba(17, 24, 39, .55); z-index: 500; }
.tour-overlay { background: transparent; z-index: 502; pointer-events: none; }
.tour-card { pointer-events: auto; }

/* ---------- Что нового ---------- */
/* Главное — текст не должен вылезать за рамки окна: длинные слова переносятся,
   а сам список прокручивается внутри себя, а не растягивает окно. */
.upd-box { max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 4px 0 6px; }
.upd-day { padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.upd-day:last-child { border-bottom: none; margin-bottom: 0; }
.upd-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.upd-date { font-weight: 700; font-size: 14.5px; }
.upd-count {
  font-size: 11.5px; font-weight: 600; color: var(--primary); background: var(--blue-bg);
  border-radius: 10px; padding: 2px 8px; white-space: nowrap;
}
.upd-list { margin: 0; padding: 0; list-style: none; }
.upd-list li {
  position: relative; padding: 7px 0 7px 22px; font-size: 14.5px; line-height: 1.55;
  border-bottom: 1px solid var(--border); overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}
.upd-list li:last-child { border-bottom: none; }
.upd-list li::before {
  content: ''; position: absolute; left: 6px; top: 15px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--primary);
}
.upd-list a { color: var(--primary); text-decoration: underline; }
@media (max-width: 800px) {
  .upd-box { max-height: 52vh; }
  .upd-list li { font-size: 14px; padding-left: 20px; }
}

/* Сегодняшний список выделен, прошлые дни — ниже и спокойнее */
.upd-today { background: var(--blue-bg); border-radius: 10px; padding: 12px 14px; border-bottom: none; }
.upd-today .upd-list li { border-bottom-color: color-mix(in srgb, var(--primary) 18%, transparent); }
.upd-today .upd-list li:last-child { border-bottom: none; }
.upd-empty { background: var(--blue-bg); border-radius: 10px; padding: 14px; font-size: 14px; }
.upd-past-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 16px 0 8px;
}

/* История изменений в «Справке»: день — сворачиваемая строка */
.upd-hist { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.upd-hist-day { border-bottom: 1px solid var(--border); }
.upd-hist-day:last-child { border-bottom: none; }
.upd-hist-day > summary {
  cursor: pointer; padding: 11px 14px; font-size: 14px; list-style: none;
  display: flex; align-items: center; gap: 10px; user-select: none; min-width: 0;
}
.upd-hist-day > summary::-webkit-details-marker { display: none; }
.upd-hist-day > summary::before { content: '▸'; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.upd-hist-day[open] > summary::before { transform: rotate(90deg); }
.upd-hist-day > summary:hover { background: var(--blue-bg); }
.upd-hist-date { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.upd-hist-day .upd-list { padding: 0 14px 10px 32px; }
.upd-hist-day .upd-list li { padding-left: 16px; font-size: 14px; }
.upd-hist-day .upd-list li::before { left: 0; top: 14px; }
@media (max-width: 800px) {
  .upd-hist-day > summary { padding: 12px; font-size: 13.5px; }
  .upd-hist-day .upd-list { padding: 0 12px 10px 24px; }
}

/* Сегодняшний список ещё пополняется — помечаем, чтобы не ждали 19:00 */
.upd-live {
  font-size: 13px; color: var(--muted); background: var(--green-bg);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; line-height: 1.45;
}
.upd-live-dot { font-size: 11px; }

/* Свёрнутое правило: в строке остаётся название и кто ещё не ознакомился */
.rule-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-head .collapse-btn { flex: 0 0 auto; }
.rule-head .rule-title { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.rule-card.is-collapsed { padding-bottom: 12px; }
.rule-waiting {
  margin-top: 6px; color: var(--red); background: var(--red-bg);
  border-radius: 8px; padding: 5px 9px; overflow-wrap: anywhere;
}
.rule-collapsed-hint { margin-top: 5px; }

/* Направление, для которого действует правило */
.rule-dep {
  font-size: 12px; font-weight: 600; border-radius: 20px; padding: 2px 9px;
  background: var(--blue-bg); color: var(--primary); white-space: nowrap;
}
.rule-dep.common { background: var(--border); color: var(--muted); }
.dep-pick { display: flex; flex-direction: column; gap: 2px; }
.dep-pick .assignee-item { padding-left: 0; }

/* Собрание, чьё время прошло, но организатор ещё не отметил «Проведено» */
.meeting-card.meeting-passed { border-left: 4px solid var(--yellow); }

/* Итоги собрания как общий протокол: кто писал последним и слияние правок */
.sum-who { margin-bottom: 8px; }
.sum-fresh { color: var(--green); font-weight: 600; }
.sum-diff {
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px;
  margin-bottom: 8px; max-height: 24vh; overflow-y: auto; background: var(--bg);
}

/* ---------- Мотивация ---------- */
/* Две колонки: слева «сколько платят» (правит директор), справа «сколько наработал»
   (крутит каждый сам) и итог. На телефоне колонки становятся одна под другой. */
.motiv-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.motiv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; background: var(--primary); color: #fff; }
.motiv-title { font-size: 16px; font-weight: 700; }
.motiv-title span { font-weight: 500; opacity: .85; font-size: 12px; }
.motiv-desc { padding: 10px 18px; background: var(--blue-bg); border-bottom: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.motiv-desc b { color: var(--text); }
.motiv-body { display: grid; grid-template-columns: 1.15fr 1fr; }
.motiv-col { padding: 16px 18px; }
.motiv-col + .motiv-col { border-left: 1px solid var(--border); }
.motiv-h { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.motiv-lock, .motiv-hint-h { font-size: 10px; text-transform: none; letter-spacing: 0; font-weight: 600;
  color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; }
.motiv-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--primary);
  font-weight: 700; margin: 14px 0 4px; }
.motiv-note { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0 0 6px; font-style: italic; }
.motiv-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border); }
.motiv-row:last-child { border-bottom: none; }
.motiv-lab { font-size: 13px; line-height: 1.35; }
.motiv-lab small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.motiv-val { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.motiv-pick { cursor: pointer; border-radius: 8px; padding: 7px 8px; margin: 0 -8px; border-bottom: 1px solid var(--border); }
.motiv-pick:hover { background: var(--bg); }
.motiv-pick.on { background: var(--blue-bg); }
.motiv-pick input { accent-color: var(--primary); margin-right: 6px; vertical-align: -2px; }
.motiv-auto .motiv-lab { color: var(--muted); }
.motiv-num { display: inline-flex; align-items: stretch; }
.motiv-num input { width: 120px; text-align: right; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--primary); background: var(--bg); border: 1px solid var(--border); border-right: none;
  border-radius: 8px 0 0 8px; padding: 6px 9px; }
.motiv-num input:focus { outline: none; border-color: var(--primary); background: var(--card); }
.motiv-spin { display: flex; flex-direction: column; border: 1px solid var(--border); border-left: none;
  border-radius: 0 8px 8px 0; overflow: hidden; }
.motiv-spin button { width: 26px; flex: 1; border: none; background: var(--bg); color: var(--muted);
  cursor: pointer; font-size: 8px; line-height: 1; padding: 0; }
.motiv-spin button:first-child { border-bottom: 1px solid var(--border); }
.motiv-spin button:hover { background: var(--primary); color: #fff; }
.motiv-fix { font-size: 14px; font-weight: 700; color: var(--text); }
.motiv-suf { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 12px; }
.motiv-chg { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); background: var(--bg); border-radius: 20px; padding: 2px 7px; }
.motiv-chg.unsaved { color: var(--orange); background: var(--orange-bg); }

.motiv-out { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.motiv-brk { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
.motiv-brk b { color: var(--text); font-weight: 600; white-space: nowrap; }
.motiv-total { margin-top: 8px; padding: 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.motiv-total-l { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.motiv-total-v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.motiv-net { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.motiv-footnote { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--yellow-bg);
  font-size: 12px; line-height: 1.55; color: var(--muted); }

@media (max-width: 900px) {
  .motiv-body { grid-template-columns: 1fr; }
  .motiv-col + .motiv-col { border-left: none; border-top: 1px solid var(--border); }
  .motiv-num input { width: 96px; }
  .motiv-total-v { font-size: 24px; }
}

/* ---------- Прикреплённые документы ---------- */
.file-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.file-row:last-child { border-bottom: none; }
.file-ico { font-size: 17px; flex-shrink: 0; }
.file-name { color: var(--primary); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; }
.file-name:hover { text-decoration: underline; }
.file-meta { flex-shrink: 0; white-space: nowrap; }
.file-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 2px; }
#new-files-list { margin-top: 6px; line-height: 1.7; }
input[type=file] { font-size: 14px; padding: 8px; background: var(--blue-bg); border: 1px dashed var(--border);
  border-radius: 10px; width: 100%; color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px;
  border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; }
@media (max-width: 1024px) {
  .file-meta { display: none; }              /* на телефоне важнее само название */
  input[type=file] { font-size: 16px; }      /* меньше 16px — iOS зумит страницу */
}

/* ---------- Черновик формы ---------- */
.draft-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px;
  padding: 9px 13px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  background: var(--yellow-bg); border: 1px solid var(--border); color: var(--text); }
.draft-bar .btn { margin-left: auto; }

/* возврат на доработку — заметнее обычного отчёта, но без паники */
.review-box.rework { background: var(--orange-bg); border-color: var(--orange); }

/* Подзадачи: чек-лист внутри задачи */
.step-add { display: flex; gap: 8px; align-items: center; }
.step-add .step-new { flex: 1; margin-bottom: 0; }
.step-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.step-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 14px;
}
.step-chip span { flex: 1; word-break: break-word; }
.step-x {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 2px 4px;
}
.step-x:hover { color: var(--red); }
.step-done-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.step-item {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card);
}
.step-item:hover { border-color: var(--primary); }
.step-item input { margin: 0; flex-shrink: 0; }
.step-item .step-text { flex: 1; word-break: break-word; }
.step-item.on .step-text { text-decoration: line-through; color: var(--muted); }
