/* Всегда светлая тема, независимо от темы Telegram. Основа — серый холст и белые карточки с
   тонкой рамкой, один акцентный синий для действий. Цвет несёт смысл и одинаков везде — статус
   задачи, приоритет, источник, роль на встрече — и живёт в полосках, точках и метках, а не
   в заливках целых блоков.

   Кнопки — три уровня: главное действие экрана (.btn.primary, одно), второстепенные — плитками
   по две в ряд (.tile), необратимое — тихой красной строкой внизу (.btn.quiet.danger). */
:root {
  color-scheme: light;
  --canvas: #f4f5f7; /* фон приложения */
  --paper: #ffffff;
  --wash: #f4f5f7; /* подложка внутри карточки */
  --ink: #15171c;
  --ink-2: #4a505e;
  --muted: #868c9a;
  --line: #e5e7ec;
  --line-strong: #d4d8df;
  --brand: #2b59e8;
  --brand-ink: #1e45c7;
  --brand-tint: #edf1fd;
  --brand-line: #cfd9fb;
  --focus: rgba(43, 89, 232, 0.16);

  --violet: #6d4ad8;
  --violet-tint: #f2eefc;
  --amber: #e89a0c;
  --amber-ink: #a5560a;
  --amber-tint: #fdf4e2;
  --amber-line: #f1dcb0;
  --cobalt: #2b59e8;
  --cobalt-tint: #edf1fd;
  --magenta: #c8346a;
  --magenta-tint: #fcebf1;
  --green: #17a465;
  --green-ink: #0b7346;
  --green-tint: #e6f6ee;
  --slate: #858ea0;
  --slate-tint: #f0f2f5;
  --red: #d93b3e;
  --red-tint: #fdecec;
  --red-line: #f3c7c8;
  --orange: #e8650e;
  --orange-tint: #fdf0e6;
  --teal: #0d8f84;
  --teal-tint: #e3f4f2;
  --sky: #0b84cc;
  --sky-tint: #e5f3fb;
  --lime: #4d7c0f;
  --lime-tint: #eff6e1;

  --radius-lg: 14px;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(21, 23, 28, 0.05);
  --tabbar: 56px; /* высота нижней панели вкладок */

  /* Во весь экран сверху — строка состояния и кнопки Telegram: контент начинается под ними. */
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(
    calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)),
    env(safe-area-inset-bottom, 0px)
  );
}

/* Цвет статуса задачи: --st — основной, --st-deep — для текста, --st-tint — подложка метки. */
[data-status="draft"] { --st: var(--violet); --st-deep: #5a37c4; --st-tint: var(--violet-tint); }
[data-status="new"] { --st: var(--amber); --st-deep: var(--amber-ink); --st-tint: var(--amber-tint); }
[data-status="in_progress"] { --st: var(--cobalt); --st-deep: var(--brand-ink); --st-tint: var(--cobalt-tint); }
[data-status="blocked"] { --st: var(--red); --st-deep: #b8292c; --st-tint: var(--red-tint); }
[data-status="done"] { --st: var(--green); --st-deep: var(--green-ink); --st-tint: var(--green-tint); }
[data-status="cancelled"] { --st: var(--slate); --st-deep: #5f687a; --st-tint: var(--slate-tint); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { padding: var(--safe-top) 0 calc(var(--tabbar) + var(--safe-bottom)); }

button { font: inherit; color: inherit; cursor: pointer; }

/* Курсор в полях — акцентным цветом: его видно сразу, куда бы ни встал. */
input, textarea, select { caret-color: var(--brand); }
input::placeholder, textarea::placeholder { color: #a3a8b4; opacity: 1; }

button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Значки: линии цветом текста. Сам набор — в index.html. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Колонка контента: на телефоне — во всю ширину, на большом экране — по центру. */
#calendar { padding: 0 max(14px, calc(50% - 480px)) 28px; }
#tasks-view, #team-view, #recs-view { padding: 0 max(14px, calc(50% - 340px)) 28px; }

/* --- вкладки: панель внизу, под большим пальцем -------------------------------------------- */

.tabbar {
  position: fixed;
  z-index: 5;
  inset: auto 0 0;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  padding: 6px 10px calc(6px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.tabbar button {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 132px;
  padding: 4px 0 3px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.tabbar .icon { width: 22px; height: 22px; }
.tabbar button.active { color: var(--brand); }

/* --- переключатели -------------------------------------------------------------------------- */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: #e8eaee;
}

.segmented button {
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
}

.segmented button.active {
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(21, 23, 28, 0.1), 0 0 0 0.5px rgba(21, 23, 28, 0.06);
}

.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
.scope { margin: 0 0 10px; }

/* --- месяц -------------------------------------------------------------------------------- */

.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0 10px;
}

.month-bar h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.month-bar h1::first-letter { text-transform: uppercase; }
.month-nav { display: flex; gap: 6px; }

.icon-btn {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-2);
  box-shadow: var(--shadow);
}

#cal-today { padding: 0 10px; font-size: 13px; font-weight: 600; }

/* Строка-призыв: значок, текст, стрелка. */
.row-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.row-link span { flex: 1; }
.row-link .chev { opacity: 0.55; }

.weekdays, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.weekdays {
  padding: 0 6px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.weekdays span:nth-child(n + 6) { color: #d06a6c; }

.grid {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.cell.other { color: var(--muted); opacity: 0.45; }
.cell.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.cell.today .num { color: var(--brand); font-weight: 700; }
.cell.selected { background: var(--ink); color: #fff; box-shadow: none; }
.cell.selected .num { color: #fff; font-weight: 650; }

.dots { display: flex; gap: 3px; height: 5px; }
.dot { width: 5px; height: 5px; border-radius: 50%; }
.dot.mine { background: var(--cobalt); }
.dot.guest { background: var(--teal); }
.dot.live { background: var(--green); }
.dot.foreign { box-shadow: inset 0 0 0 1.2px var(--violet); }
.dot.personal { background: var(--amber); }
.cell.selected .dot { background: #fff; box-shadow: none; }
.cell.selected .dot.foreign { background: transparent; box-shadow: inset 0 0 0 1.2px #fff; }

/* --- день --------------------------------------------------------------------------------- */

.day-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 10px; }
.day h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.day h2::first-letter { text-transform: uppercase; }

.add-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 7px 12px 7px 9px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
}

.add-btn .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.cards { display: flex; flex-direction: column; gap: 6px; }

/* Встреча: полоса слева — цветом роли. Организатор — кобальт, гость — бирюза,
   идёт сейчас — зелёный, встреча юнита без тебя — фиолетовый. */
.card {
  --stripe: var(--teal);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: left;
}

.card.mine { --stripe: var(--cobalt); }
.card.foreign { --stripe: var(--violet); }
.card.live { --stripe: var(--green); }
.card.personal { --stripe: var(--amber); }
/* Запись: полоса — что с ней сейчас. Готовая — спокойная, чтобы список не пестрел. */
.card.rec { --stripe: var(--line-strong); }
.card.rec[data-rec="queued"], .card.rec[data-rec="recording"] { --stripe: var(--green); }
.card.rec[data-rec="processing"] { --stripe: var(--cobalt); }
.card.rec[data-rec="failed"] { --stripe: var(--red); }
.trow { --stripe: var(--st, var(--line-strong)); }

/* Цветная полоса — отдельным слоем: по скруглению карточки она обрезается ровно. */
.card, .trow, #task-sheet .detail-head, .card-sheet .detail-head { position: relative; overflow: hidden; }

.card::before, .trow::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--stripe);
}

#task-sheet .detail-head::before, .card-sheet .detail-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--st, var(--brand));
}

.card .time {
  display: flex;
  flex-direction: column;
  min-width: 52px;
  padding-right: 10px;
  white-space: nowrap;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.card .time small { margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 550; }
.card .title { font-weight: 650; overflow-wrap: anywhere; }
.card .sub { margin-top: 1px; color: var(--muted); font-size: 13px; }
.card.foreign .title { font-weight: 600; }

.chip {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--slate-tint);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.yes { background: var(--green-tint); color: var(--green-ink); }
.chip.live { background: var(--green); color: #fff; }
.chip.past { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip.foreign { background: var(--violet-tint); color: var(--violet); }
.chip.mine { background: var(--cobalt-tint); color: var(--brand-ink); }

.empty {
  padding: 22px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  list-style: none;
}

/* --- листы: встреча, задача, форма --------------------------------------------------------- */

.detail {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: calc(12px + var(--safe-top)) max(14px, calc(50% - 310px)) calc(36px + var(--safe-bottom));
  background: var(--canvas);
  animation: slide-in 0.18s ease-out;
}

@keyframes slide-in { from { transform: translateY(14px); opacity: 0.6; } }

@media (prefers-reduced-motion: reduce) {
  .detail { animation: none; }
}

.detail-head { padding: 8px 2px 4px; }
.detail-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.detail-head .hint { color: var(--ink-2); font-size: 14px; }
.hint { margin: 0; color: var(--muted); }
.hint.small { font-size: 12.5px; font-weight: 500; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
#d-tags, #rc-tags { margin-top: 10px; }
#k-badges { margin: 4px 0 10px; }

/* Подпись раздела: мелко, прописными — заголовки не спорят с содержимым. */
.block {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.block h3, .inbox h3, .section h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.block h4 { margin: 16px 0 6px; font-size: 14px; font-weight: 650; }

.count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--wash);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

/* «Ждут тебя» — раздел без рамки: строки задач лежат прямо на фоне, как и в списке ниже. */
.inbox { margin-top: 16px; }
.inbox h3 { margin: 0 2px 8px; color: var(--amber-ink); }

/* Раздел на фоне вкладки: подпись, строки, внизу — тихие ссылки. */
.section { margin-top: 16px; }
.section h3 { margin: 0 2px 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-head h3 { margin: 0 2px; }
.section > .note { margin: 0 0 8px; }
.section-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 8px 2px 0; }
.section-foot:not(:has(:not([hidden]))) { display: none; }
.trows > li.hint { padding: 2px 2px 4px; color: var(--muted); font-size: 13.5px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; }
.trow .num { min-width: 34px; color: var(--ink-2); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.trow .num .icon { width: 18px; height: 18px; color: var(--violet); }

/* Разговор с ИИ: его вопросы — серым, ответы человека — синеватым. */
.dialog { margin: 0; padding: 0; list-style: none; }
.dialog li { padding: 9px 11px; border-radius: 10px; background: var(--wash); white-space: pre-line; overflow-wrap: anywhere; }
.dialog li + li { margin-top: 6px; }
.dialog li.me { margin-left: 24px; background: var(--brand-tint); }
.dialog .who { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.sources { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sources button { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: var(--brand); font-size: 14px; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.ai-answer { margin: 0; }
.ai-answer textarea { margin-bottom: 8px; }
.sheet-foot { margin: 14px 2px 0; }
.inbox .count { background: var(--amber); color: #fff; }
#rec-live-box h3 { color: var(--green-ink); }
#rec-live-box .count { background: var(--green); }
.list-title { margin: 18px 2px 8px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
#recs-view > .note { margin-top: 12px; }
#rec-list { margin-top: 12px; }
#rec-list-title:not([hidden]) + #rec-list { margin-top: 0; }
#rc-stop { margin-top: 12px; }
/* Плитки под итогами: видимые делят ряд поровну, скрытые места не занимают. */
.tiles.rec-tools { display: flex; margin-top: 12px; }
.rec-tools .tile { flex: 1; }
.chips.scroll { flex-wrap: nowrap; margin: 14px -14px 0; padding: 0 14px 2px; overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll button { flex: none; white-space: nowrap; }
.task-form input[type="file"] { padding: 9px 10px; font-size: 14px; }
.task-form > .segmented { margin-bottom: 14px; }

.note {
  margin: 10px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px;
}

.note.alert { border-color: var(--amber-line); background: var(--amber-tint); color: var(--ink); white-space: pre-line; }

/* --- кнопки -------------------------------------------------------------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.btn:active, .tile:active { background: var(--wash); }
.btn.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-ink); }
.btn.danger { border-color: var(--red-line); color: var(--red); }
.btn.quiet { min-height: 38px; border-color: transparent; background: transparent; font-size: 14px; font-weight: 550; }
.btn.quiet:active { background: var(--red-tint); }
.btn:disabled { opacity: 0.45; }
/* Запрос ушёл: главная кнопка гаснет, второй тап ничего не сделает. */
body[aria-busy="true"] .btn.primary { opacity: 0.6; }
.btn.small { display: inline-flex; width: auto; min-height: 0; margin: 0; padding: 6px 12px 6px 9px; gap: 5px; font-size: 13px; }
.btn.small .icon { width: 15px; height: 15px; }
#d-join { margin-top: 12px; }

/* Действия экрана: главное — кнопкой, второстепенные — плитками, форма раскрывается под ними. */
.actions { margin-top: 10px; }
.act-main > .btn:first-child { margin-top: 0; }
.act-main:not([hidden]) + .tiles { margin-top: 8px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }

.tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  box-shadow: var(--shadow);
}

.tile .icon { color: var(--ink-2); }
.tile.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); box-shadow: none; }
.tile.active .icon { color: var(--brand); }

.panel {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel > label, .panel-title {
  display: block;
  margin: 0 0 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.panel .task-form > * + * { margin-top: 8px; }
.panel .agenda-add { margin-top: 0; }
.panel .btn.danger { border-color: var(--red); background: var(--red); color: #fff; }

.danger-zone { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; margin-top: 14px; }
.danger-zone .btn { width: auto; margin-top: 0; padding: 8px 14px; }

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

.agenda-add input,
.move input,
.transcript input,
.task-form select,
.task-form textarea,
.task-form input,
.unit-filter {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.agenda-add input:focus,
.move input:focus,
.transcript input:focus,
.task-form select:focus,
.task-form textarea:focus,
.task-form input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

/* --- повестка ---------------------------------------------------------------------------- */

.agenda { margin: 0; padding: 0; list-style: none; counter-reset: agenda; }

.agenda li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  counter-increment: agenda;
}

.agenda li:first-child { border-top: 0; padding-top: 0; }

.agenda li::before {
  content: counter(agenda);
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--wash);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.agenda li.closed::before { background: var(--green-tint); color: var(--green-ink); }
.agenda li.open::before { background: var(--amber-tint); color: var(--amber-ink); }
.agenda .body { flex: 1; min-width: 0; }
.agenda .text { color: var(--ink); overflow-wrap: anywhere; }
.agenda .meta { color: var(--muted); font-size: 12.5px; }
.agenda .outcome { margin-top: 4px; color: var(--ink-2); font-size: 14px; }

.agenda .remove {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
}

.agenda .remove .icon { width: 15px; height: 15px; }
.agenda-add { display: flex; gap: 8px; margin-top: 10px; }

.agenda-add input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
}

.agenda-add .btn { width: auto; margin-top: 0; padding: 10px 14px; }

.people { margin: 0; padding: 0; list-style: none; }

.people li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.people li:first-child { border-top: 0; padding-top: 0; }
.people li:last-child { padding-bottom: 0; }
.people .who { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.people .tag { color: var(--muted); font-size: 12.5px; }

.people .who small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.people .who small.late { color: var(--red); }
.feeds { margin-bottom: 14px; }
.avatar.plain { border-radius: 9px; background: var(--wash); color: var(--ink-2); }
.avatar.plain .icon { width: 16px; height: 16px; }

.howto { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.howto summary { color: var(--brand); font-weight: 650; cursor: pointer; }
.howto ol { margin: 10px 0; padding-left: 20px; color: var(--ink-2); }
.howto li + li { margin-top: 4px; }

/* Кружок участника: цвет от имени, чтобы люди различались с первого взгляда. */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--cobalt-tint);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar.av-1 { background: var(--teal-tint); color: var(--teal); }
.avatar.av-2 { background: var(--magenta-tint); color: var(--magenta); }
.avatar.av-3 { background: var(--amber-tint); color: var(--amber-ink); }
.avatar.av-4 { background: var(--violet-tint); color: var(--violet); }
.avatar.av-5 { background: var(--green-tint); color: var(--green-ink); }

.move { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.move label { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.move .btn, .move .wide { grid-column: 1 / -1; margin-top: 0; }
.move select {
  width: 100%;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.move input {
  width: 100%;
  min-height: 42px;
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* --- итоги встречи ----------------------------------------------------------------------- */

.summary { margin: 0; white-space: pre-line; }
.section-text { margin: 0; color: var(--ink-2); white-space: pre-line; }

.speakers { margin: 0; padding: 0; list-style: none; }
.speakers li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.speakers .bar { height: 6px; border-radius: 3px; background: var(--teal); }
.speakers li:nth-child(4n + 1) .bar { background: var(--cobalt); }
.speakers li:nth-child(4n + 3) .bar { background: var(--magenta); }
.speakers li:nth-child(4n + 4) .bar { background: var(--amber); }
.speakers .share { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.transcript { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.transcript summary { color: var(--brand); font-weight: 650; cursor: pointer; }

.transcript input {
  width: 100%;
  margin: 10px 0 6px;
  padding: 10px;
  border-radius: var(--radius-sm);
}

#r-transcript { max-height: 50vh; overflow-y: auto; font-size: 14px; }
#r-transcript p { margin: 0; padding: 3px 0; }
#r-transcript .ts { margin-right: 6px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
#r-audio { width: 100%; margin-top: 10px; }

/* --- вкладка «Задачи» -------------------------------------------------------------------- */

.task-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 14px; }
.task-top .btn { margin-top: 0; }
.views { margin: 14px 0 0; }

.list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0;
}

.chips { display: flex; gap: 6px; }

.chips button {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.chips button.active { border-color: var(--ink); background: var(--ink); color: #fff; }

.unit-filter {
  max-width: 50%;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.trows { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }

/* Строка задачи: слева полоса цвета статуса, приоритет, суть, справа — что с ней сейчас. */
.trow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: left;
}

.trow:disabled { opacity: 1; cursor: default; }
.tmain { min-width: 0; }
.ttitle { display: block; font-weight: 600; overflow-wrap: anywhere; }

.tmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 12.5px; }
.tmeta .person { color: var(--ink-2); font-weight: 500; }
.tmeta .from { color: var(--muted); }

.due {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--wash);
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}

.due.soon { background: var(--amber-tint); color: var(--amber-ink); }
.due.late { background: var(--red-tint); color: var(--red); }
.late { color: var(--red); }

.prio {
  min-width: 28px;
  padding: 3px 5px;
  border-radius: 6px;
  background: var(--cobalt-tint);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 750;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.prio.p0 { background: var(--red); color: #fff; }
.prio.p1 { background: var(--orange-tint); color: var(--orange); }
.prio.p3 { background: var(--slate-tint); color: var(--ink-2); }
.prio.pending { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--red); color: var(--red); }

/* Статус и «чего ждёт от тебя» — цветными метками. */
.chip.st-draft { background: var(--violet-tint); color: var(--violet); }
.chip.st-new { background: var(--amber-tint); color: var(--amber-ink); }
.chip.st-in_progress { background: var(--cobalt-tint); color: var(--brand-ink); }
.chip.st-blocked { background: var(--red-tint); color: var(--red); }
.chip.st-done { background: var(--green-tint); color: var(--green-ink); }
.chip.st-cancelled { background: var(--slate-tint); color: var(--slate); text-decoration: line-through; }
.chip.late { background: var(--red); color: #fff; }
.chip.need { color: #fff; }
.chip.need-accept { background: var(--amber); }
.chip.need-p0 { background: var(--red); }
.chip.need-draft { background: var(--violet); }

.chip.src-ceo { background: var(--violet-tint); color: var(--violet); }
.chip.src-manager { background: var(--teal-tint); color: var(--teal); }
.chip.src-meeting { background: var(--sky-tint); color: var(--sky); }
.chip.src-unit { background: var(--magenta-tint); color: var(--magenta); }
.chip.src-report { background: var(--lime-tint); color: var(--lime); }

.trows .dup { display: flex; flex-direction: column; gap: 4px; }

/* «От меня» по людям: имя, сколько задач и в каких статусах, под этим — сами задачи. */
.tgroup { margin-top: 10px; }
.tgroup:first-child { margin-top: 0; }
.tgroup-title { display: flex; align-items: center; gap: 8px; }
.tgroup-title .who { flex: 1; overflow-wrap: anywhere; }
.tgroup-title .count { background: #e8eaee; }
.badges.counts { margin: 6px 0 0; }

/* --- команда ------------------------------------------------------------------------------ */

#team-view { padding-top: 4px; }
#team-view .task-top { padding-top: 10px; }
.people.boxed {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.unit-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.unit-tools .unit-filter { max-width: none; padding: 6px 10px; }
.block > .danger-zone { margin-top: 6px; justify-content: flex-start; }
.block > .danger-zone .btn { padding: 6px 0; min-height: 0; font-size: 13px; }
/* Действие в строке списка: заметное, но не главная кнопка экрана. */
.btn.small.go { padding: 6px 12px; border-color: var(--brand-line); background: var(--brand-tint); color: var(--brand-ink); }
#team-view .people li .unit-filter { max-width: 45%; }
#team-view .people li.hint { color: var(--muted); }

.btn.remove {
  flex: none;
  width: 30px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.btn.remove .icon { width: 15px; height: 15px; }

/* --- карточка задачи: белая шапка с полосой и меткой цвета статуса ----------------------- */

#task-sheet .detail-head, .card-sheet .detail-head {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

#task-sheet .detail-head h1, .card-sheet .detail-head h1 { margin: 0; font-size: 20px; }
.card-sheet .detail-head .hint { margin-top: 6px; font-size: 13px; }

.fields { margin: 0; }

.frow {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.frow:first-child { border-top: 0; padding-top: 0; }
.frow:last-child { padding-bottom: 0; }
.frow dt { color: var(--muted); font-size: 13px; }
.frow dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* --- форма задачи и встречи -------------------------------------------------------------- */

.task-form label, .task-form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.task-form label > span:first-child { display: flex; align-items: center; gap: 6px; }

.task-form select,
.task-form textarea,
.task-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
}

.task-form textarea { display: block; resize: vertical; }
.task-form > .hint.small { margin: -6px 0 12px; }
.task-form .btn { margin-top: 4px; }
.task-form .segmented { background: var(--wash); box-shadow: inset 0 0 0 1px var(--line); }
#f-priority button.active { color: #fff; box-shadow: none; }
#f-priority button.active[data-priority="p0"] { background: var(--red); }
#f-priority button.active[data-priority="p1"] { background: var(--orange); }
#f-priority button.active[data-priority="p2"] { background: var(--cobalt); }
#f-priority button.active[data-priority="p3"] { background: var(--teal); }

.letter, .smart-chip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 750;
}

.letter.ok, .smart-chip.ok { background: var(--green); color: #fff; }
.letter.missing, .smart-chip.missing { background: var(--red-tint); color: var(--red); }
.letter.optional, .smart-chip.optional { background: var(--slate-tint); color: var(--slate); }

.smart { margin: 4px 0 12px; }
.smart-chips { display: flex; gap: 6px; margin-bottom: 6px; }
.smart-chip { width: 28px; height: 28px; border-radius: 7px; font-size: 13px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.unit-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.task-form .people-search { margin-bottom: 8px; }

.unit-picks button {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.unit-picks button.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); }

.pick {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.pick li + li { border-top: 1px solid var(--line); }
.pick li.hint { padding: 12px; font-weight: 500; }

.task-form .pick-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}

.task-form .pick-row.on { background: #f7f9fe; }
.task-form .pick-row input { flex: none; width: 18px; min-height: 0; height: 18px; margin: 0; padding: 0; accent-color: var(--brand); }
.pick-name { flex: 1; overflow-wrap: anywhere; }
.pick .tag { color: var(--muted); font-size: 12px; font-weight: 500; }

.dups { margin: 4px 0 12px; padding: 12px; border: 1px solid var(--amber-line); border-radius: var(--radius); background: var(--amber-tint); }
.dups-title { margin: 0 0 10px; color: var(--amber-ink); font-size: 14px; font-weight: 600; }

/* Кто занят в выбранное время и свободные окна дня: окно нажимается — время подставится. */
.avail {
  margin: -4px 0 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
}

.avail-line { margin: 0 0 8px; font-size: 14px; font-weight: 600; white-space: pre-line; }
.avail-line.ok { color: var(--green-ink); }
.avail-line.warn { color: var(--amber-ink); }
.avail-title { margin: 0; color: var(--ink-2); font-size: 13px; }
.avail-title::first-letter { text-transform: uppercase; }
.free-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.free-chips button {
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.free-chips button.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); }

/* --- служебное --------------------------------------------------------------------------- */

.screen {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--canvas);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(var(--tabbar) + 14px + var(--safe-bottom));
  width: max-content;
  max-width: min(calc(100% - 32px), 520px);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(21, 23, 28, 0.22);
  cursor: pointer;
}

/* --- большой экран: вкладки сверху, календарь и день рядом ---------------------------------- */

@media (min-width: 860px) {
  :root { --tabbar: 0px; }

  .tabbar {
    position: sticky;
    inset: var(--safe-top) 0 auto;
    justify-content: center;
    padding: 8px 14px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  .tabbar button { flex: none; flex-direction: row; gap: 8px; max-width: none; padding: 8px 14px; font-size: 14px; }
  .tabbar button.active { background: var(--brand-tint); }
  .tabbar .icon { width: 18px; height: 18px; }

  #calendar { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; gap: 32px; }
  .day-bar { margin-top: 14px; }
  .toast { bottom: 24px; }
}

[hidden] { display: none !important; }
