/* Палитра и кнопки — как в интерфейсе Битрикс24; компоновка — карточки, плитки, таблицы в рамке */
:root {
  --ground: #eef2f4;
  --surface: #fff;
  --ink: #333;
  --ink-2: #525c69;
  --muted: #828b95;
  --line: #e4e8eb;
  --line-strong: #cfd5da;
  --chip-bg: #f5f7f8;
  --accent: #2fc6f6;
  --accent-dark: #11a9d9;
  --link: #2067b0;
  --cta: #bbed21;
  --cta-hover: #d2f95f;
  --danger: #ff5752;
  --ok-bg: #f1fbd0; --ok-ink: #4f7d00;
  --err-bg: #ffe8e8; --err-ink: #d0312b;
  --info-bg: #e5f9ff; --info-ink: #0b8eb6;
  --warn-bg: #fff4d6; --warn-ink: #8a5a00;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 4px 14px rgba(20, 24, 30, .05);
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 "Golos Text", "Open Sans", "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--err-ink); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.pad { padding: 24px; }

/* ---------- каркас ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg .n { margin-left: 6px; font-size: 12px; opacity: .75; }
.topbar .seg-journal { margin-left: auto; }

.page-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; font-weight: 600; text-wrap: balance; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.thesis { margin: 0; max-width: 78ch; color: var(--ink-2); font-size: 15px; }
.back { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--link); font-size: 14px; }
.back:hover { text-decoration: underline; }

.steps { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.steps span { display: inline-flex; align-items: center; gap: 6px; }
.steps span + span::before { content: ""; width: 18px; height: 1px; background: var(--line-strong); }
.steps i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); font-size: 11px; }
.steps .done i { background: var(--ok-bg); border-color: transparent; color: var(--ok-ink); }
.steps .cur { color: var(--ink); font-weight: 500; }
.steps .cur i { background: var(--accent); border-color: var(--accent); color: #fff; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }

/* ---------- кнопки и поля (ui-btn Битрикс24) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap;
}
.btn:hover { border-color: #a8adb4; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--ink-2); }
.btn-cta:hover:not(:disabled) { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-danger { color: var(--err-ink); }
.btn-l { height: 46px; border-radius: 23px; font-size: 13px; padding: 0 28px; }
.btn-block { width: 100%; }
.x { border: 0; background: var(--surface); color: var(--ink-2); border-radius: 50%; width: 28px; height: 28px; font-size: 16px; line-height: 1; flex: none; }
.x:hover { background: var(--ink-2); color: #fff; }

.input {
  width: 100%; min-height: 38px; padding: 7px 10px; font: inherit; font-size: 14px; color: inherit;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.input:focus { outline: none; border-color: var(--accent); }
.input-s { min-height: 32px; padding: 5px 8px; }
textarea.input { resize: vertical; }
.search { max-width: 360px; }

/* выпадающий список с галочками */
.ms { position: relative; }
.ms > summary {
  list-style: none; cursor: pointer; font-size: 14px; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 30px 8px 10px; min-height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; color: var(--muted);
}
.ms > summary::-webkit-details-marker { display: none; }
.ms > summary::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.ms[open] > summary { border-color: var(--accent); }
.ms.on > summary { color: var(--ink); font-weight: 500; }
.opts {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; min-width: 240px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 8px 28px rgba(20, 24, 30, .14);
  max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 1px;
}
.opts label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.opts label:hover { background: var(--chip-bg); }
.opts input[type=checkbox] { accent-color: var(--accent); margin: 0; flex: none; }
.opts .input { margin-bottom: 4px; }
.opts .group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 8px 4px; }
.opts .item { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; font-size: 14px; }
.opts .item:hover { background: var(--info-bg); }
.opts .none { padding: 8px; color: var(--muted); font-size: 14px; }
.picker { position: relative; display: inline-block; }
.picker > summary { list-style: none; }
.picker > summary::-webkit-details-marker { display: none; }
.picker .opts { right: auto; width: min(380px, 86vw); }

/* метки */
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 6px; white-space: nowrap; background: var(--chip-bg); color: var(--ink-2); }
.pill.info { background: var(--info-bg); color: var(--info-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.err { background: var(--err-bg); color: var(--err-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.soon { background: var(--chip-bg); color: var(--ink); }

/* пустые состояния и подсказки */
.dashed { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px 18px; color: var(--ink-2); background: var(--surface); }
.dashed b { color: var(--ink); font-weight: 600; }

/* ---------- шаг 1: шаблоны ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tcard {
  display: flex; flex-direction: column; gap: 10px; text-align: left; border: 1px solid transparent; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-height: 120px;
}
.tcard:hover { border-color: var(--accent); }
.tcard-dim { box-shadow: none; background: rgba(255, 255, 255, .6); }
.tcard-dim .tcard-name { color: var(--ink-2); }
.tcard-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.tcard-go { margin-top: auto; font-size: 13px; color: var(--link); font-weight: 500; }

/* ---------- шаг 2: фильтры и итог ---------- */
.launch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.launch-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.filter {
  display: grid; grid-template-columns: minmax(140px, 1fr) minmax(175px, 1fr) minmax(200px, 2fr) 28px; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--chip-bg); border-radius: 10px;
}
.filter-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.filter-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: 13px; color: var(--ink-2); }
.req { color: var(--danger); }

.summary { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; }
.big { font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.big.loading { color: var(--line-strong); }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.confirm { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.confirm .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- шаг 3: запуск ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-size: 26px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 13px; color: var(--muted); }
.tile.ok .v { color: var(--ok-ink); }
.tile.err { background: var(--err-bg); box-shadow: none; }
.tile.err .v, .tile.err .k { color: var(--err-ink); }
.status-row { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.status-row .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bar { height: 10px; background: var(--chip-bg); border-radius: 5px; overflow: hidden; display: flex; }
.bar i { height: 100%; transition: width .4s; }
.bar .b-ok { background: var(--cta); }
.bar .b-err { background: var(--danger); }
.minibar { width: 120px; height: 6px; border-radius: 3px; margin-bottom: 4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 8px; border-radius: 3px; display: inline-block; }

/* таблицы */
.tablewrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; border: 1px solid var(--line-strong); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 13px; font-weight: 600; background: var(--chip-bg); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7fbfd; }
td.id { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.title a { font-weight: 500; text-decoration: none; }
tr.click:hover td.title a { text-decoration: underline; }
td.nowrap { white-space: nowrap; }
.items { min-width: 620px; }
.journal { min-width: 780px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

/* расписание */
.seg-full { display: flex; width: 100%; box-shadow: none; background: var(--chip-bg); }
.seg-full button { flex: 1; }
.weekdays { box-shadow: none; background: var(--chip-bg); }
.weekdays button { min-width: 40px; }
.sched-grid { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); gap: 0 16px; }
.sched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.sched-card { display: flex; flex-direction: column; gap: 12px; }
.sched-card .card-head { margin-bottom: 0; align-items: flex-start; flex-wrap: nowrap; }
.sched-rule { font-size: 15px; font-weight: 500; color: var(--info-ink); }
.sched-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 4px; }

/* выбор времени */
.tp > summary { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.tp-pop { width: 300px; right: auto; max-height: none; padding: 12px; gap: 6px; }
.tp-quick { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tp-chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 4px 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.tp-chip:hover { border-color: var(--accent); }
.tp-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.tp-grid { display: grid; gap: 4px; }
.tp-hours { grid-template-columns: repeat(6, 1fr); }
.tp-mins { grid-template-columns: repeat(6, 1fr); }
.tp-cell { border: 0; background: var(--chip-bg); border-radius: 6px; padding: 7px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.tp-cell:hover { background: var(--info-bg); }
.tp-cell[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* избранное, предпросмотр, наборы, справка */
.tcard { position: relative; cursor: pointer; }
.tcard .eyebrow { margin-bottom: -4px; }
.star { position: absolute; top: 10px; right: 10px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--line-strong); padding: 4px; }
.star:hover, .star.on { color: #f5b400; }
.tcard .tcard-name { padding-right: 26px; }
.btn-s { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 11px; }
.preset-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.preset-sel { width: auto; max-width: 240px; }
table.preview td { padding: 7px 12px; }
.repeat { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check-line input { accent-color: var(--accent); margin-top: 2px; flex: none; }
.confirm-ok { background: var(--ok-bg); color: var(--ok-ink); }
.confirm-err { background: var(--err-bg); color: var(--err-ink); }
.confirm .btn-s { background: #fff; }
.onboard { border-left: 4px solid var(--accent); }
.onboard .card-head { margin-bottom: 8px; }
.onboard-steps { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.onboard-steps b { color: var(--ink); }
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.note h2 { margin-bottom: 10px; }
.note ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; color: var(--ink-2); }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .launch { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .notes { grid-template-columns: minmax(0, 1fr); }
  .sched-grid { grid-template-columns: minmax(0, 1fr); }
  .sched-list { grid-template-columns: minmax(0, 1fr); }
  .filter { grid-template-columns: minmax(0, 1fr) 28px; }
  .filter > :not(.filter-name):not(.x) { grid-column: 1 / -1; }
  .filter > .x { grid-row: 1; grid-column: 2; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .seg-journal { margin-left: 0; }
  .status-row .actions { margin-left: 0; }
  .big { font-size: 34px; }
}
@media (max-width: 420px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
}

/* ---------- фокус дня ---------- */
.topbar .refresh { margin-left: auto; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fcards { display: flex; flex-direction: column; gap: 10px; }
.fcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--line-strong); }
.fcard.k-overdue { border-left-color: var(--danger); }
.fcard.k-untouched { border-left-color: #f5b400; }
.fcard.k-noplan { border-left-color: var(--accent); }
.fcard-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fcard-head .reason { font-size: 13px; color: var(--ink-2); }
.fcard-title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.fcard-title a { color: var(--ink); text-decoration: none; }
.fcard-title a:hover { color: var(--link); text-decoration: underline; }
.fcard-meta { font-size: 13px; color: var(--muted); }
.fcard-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
/* меню причин — внутри карточки: всплывающее у нижней карточки обрежет край фрейма Битрикс24 */
.fcard-actions .dismiss[open] { flex-basis: 100%; }
.fcard-actions .dismiss .opts { position: static; width: min(320px, 100%); margin-top: 6px; box-shadow: none; }
.fcard-actions .dismiss > summary { list-style: none; }
.plan { background: var(--chip-bg); border-radius: 10px; padding: 12px 14px; margin-top: 6px; }
.plan .tp-quick { border-bottom: 0; padding-bottom: 0; align-items: center; }
.plan .tp-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.plan .tp-quick .input { width: auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.more { align-self: flex-start; }
.snoozed > summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.snoozed[open] > summary { margin-bottom: 10px; }
.snoozed-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
table.team { min-width: 760px; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.settings .card { display: flex; flex-direction: column; gap: 10px; }
.settings .card-head { margin-bottom: 0; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.num-input { width: 96px; }
select.input { width: auto; }
@media (max-width: 720px) {
  .tiles-4, .tiles-5, .tiles-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* фильтр разделов: переносится по строкам, а не прокручивается — разделов может быть много */
.filters-bar { display: flex; flex-direction: column; gap: 8px; }
.seg-wrap { flex-wrap: wrap; overflow: visible; align-self: flex-start; }
.seg-sub { box-shadow: none; background: var(--chip-bg); }
.seg-sub button[aria-pressed="true"] { background: var(--ink-2); }
.scope-group { display: flex; flex-direction: column; gap: 6px; }
.scope-group + .scope-group { margin-top: 4px; }

/* ---------- плитки-переключатели типа, панель фильтров, таблица фокуса ---------- */
.tile-toggle { text-align: left; border: 2px solid transparent; cursor: pointer; font: inherit; color: inherit; }
.tile-toggle:hover { border-color: var(--line-strong); }
.tile-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--info-bg); }
.tile-toggle.err[aria-pressed="true"] { border-color: var(--danger); background: var(--err-bg); }
.tile-toggle.ok[aria-pressed="true"] { border-color: var(--ok-ink); background: var(--ok-bg); }
.tile .tick, .chip .tick { font-weight: 700; }

.filters { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.frow { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; align-items: start; }
.flabel { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 7px; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fsep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 2px 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
  border-radius: 16px; padding: 5px 12px; font-size: 14px; }
.chip:hover { border-color: var(--accent); }
.chip .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .85); }
.chip-all { font-weight: 600; }
.fsum { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 10px; }

table.ftable { min-width: 920px; }
.ftable td { vertical-align: middle; }
.ftable td.kind { width: 1%; white-space: nowrap; }
.ftable td.title { font-weight: 500; max-width: 260px; overflow-wrap: anywhere; }
.ftable td.title a { color: var(--ink); text-decoration: none; }
.ftable td.title a:hover { color: var(--link); text-decoration: underline; }
.ftable td.where a { color: var(--ink); font-weight: 500; text-decoration: none; }
.ftable td.where a:hover { color: var(--link); text-decoration: underline; }
.ftable .sub { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.ftable td.where, .ftable td.stage { font-size: 13px; color: var(--ink-2); max-width: 200px; }
.ftable td.where { max-width: 300px; font-size: 14px; }
.ftable td.where .sub { font-size: 12px; }
.ftable td.wait { font-weight: 600; }
.ftable td.act, .ftable th.act { width: 1%; white-space: nowrap; text-align: right; }
.ftable td.act .btn + .btn { margin-left: 4px; }
.ftable tr.k-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.ftable tr.k-untouched td:first-child { box-shadow: inset 3px 0 0 #f5b400; }
.ftable tr.k-noplan td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ftable tr.slot-row td { background: var(--chip-bg); border-top: 0; padding: 0 12px 12px; }
.ftable tr.slot-row .plan { margin-top: 0; background: #fff; }
.btn-icon { padding: 0 10px; font-size: 16px; letter-spacing: 0; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.th-sort.on, .th-sort:hover { color: var(--link); }
.more-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 10px; }
.more-actions .flabel { padding: 0 4px 0 10px; }
@media (max-width: 720px) {
  .frow { grid-template-columns: minmax(0, 1fr); }
  .flabel { padding-top: 0; }
}

/* ---------- строка фильтров: выпадающие списки одного вида ---------- */
.fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fbar-sum { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: baseline; gap: 6px; max-width: 360px;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 30px 7px 12px; background: #fff; position: relative; white-space: nowrap; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.dd[open] > summary { border-color: var(--accent); }
.dd.on > summary { border-color: var(--accent); background: var(--info-bg); }
.dd-label { font-size: 13px; color: var(--muted); }
.dd-value { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.dd-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: min(380px, 90vw); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(20, 24, 30, .16); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dd-list { max-height: 340px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.dd-group + .dd-group { border-top: 1px solid var(--line); padding-top: 4px; }
.dd-ghead { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 2px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); }
.dd-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.dd-opt:hover { background: var(--chip-bg); }
.dd-opt input { accent-color: var(--accent); margin: 0; flex: none; }
.dd-opt .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dd-opt.empty { color: var(--muted); }
.dd-hint { display: block; font-size: 12px; color: var(--muted); }
.dd-foot { border-top: 1px solid var(--line); padding: 6px 8px 0; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--link); font: inherit; font-size: 12px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.linkbtn:hover { text-decoration: underline; }
.ftags { display: flex; flex-wrap: wrap; gap: 6px; }
.ftag { display: inline-flex; align-items: center; gap: 4px; background: var(--info-bg); color: var(--info-ink); border-radius: 14px;
  padding: 3px 4px 3px 10px; font-size: 13px; }
.ftag-x { border: 0; background: none; color: inherit; width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 1; padding: 0; }
.ftag-x:hover { background: rgba(11, 142, 182, .15); }
.th-sort .arrow { color: var(--line-strong); }
.th-sort.on .arrow { color: inherit; }
@media (max-width: 720px) {
  .fbar-sum { margin-left: 0; width: 100%; }
  .dd, .dd > summary { width: 100%; max-width: none; }
}

/* панель «Написать в поддержку» под верхним меню */
.support { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--accent); }
.support .card-head { margin-bottom: 0; }
.support-ctx { color: var(--ink-2); }
.note.ok { border-radius: 10px; padding: 12px 14px; font-size: 14px; background: var(--ok-bg); color: var(--ok-ink); }

/* загрузка: крутилка в строке и заготовка экрана, пока считаем */
.spinner { display: inline-block; flex: none; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
.spinner-l { width: 36px; height: 36px; border-width: 4px; border-color: var(--info-bg); border-top-color: var(--accent); }
.loading-line { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.page-loader { display: flex; flex-direction: column; gap: 12px; }
.loader-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 20px; border-left: 4px solid var(--accent); }
.loader-title { font-weight: 600; font-size: 16px; }
.loader-card > div { flex: 1; min-width: 0; }
.loader-bar { height: 4px; margin-top: 10px; border-radius: 2px; background: var(--info-bg); overflow: hidden; position: relative; }
.loader-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; border-radius: 2px; background: var(--accent); animation: bar 1.3s ease-in-out infinite; }
@keyframes bar { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.skel { background: linear-gradient(90deg, var(--chip-bg) 25%, var(--surface) 50%, var(--chip-bg) 75%); background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite; }
.tile.skel { min-height: 92px; box-shadow: none; }
.skel-rows { display: flex; flex-direction: column; gap: 6px; }
.skel-row { height: 44px; border-radius: var(--radius); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .spinner, .skel, .loader-bar::after { animation-duration: 3s; } }
@media (max-width: 980px) { .tiles-5, .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .tiles-5, .tiles-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* длинный текст в ячейках таблиц — одной строкой, не влезло — «…» в конце; целиком его видно в самой сущности.
   Ширины подобраны так, чтобы при 1180 px таблица помещалась вместе с кнопками */
.clip { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ftable td.title .clip { max-width: 200px; }
.ftable td.where .clip { max-width: 220px; }
.ftable td.stage .clip { max-width: 120px; }
table.team td.title .clip { max-width: 260px; }

/* ---------- календарь ---------- */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.cal-bar .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { font-size: 16px; margin-left: 6px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-col { padding: 10px; min-height: 260px; display: flex; flex-direction: column; gap: 6px; }
.cal-col.today, .cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-dh { font-size: 13px; color: var(--muted); text-transform: capitalize; }
.cal-dh.today .linkbtn { color: var(--accent); font-weight: 600; }
.cal-empty { font-size: 12px; color: var(--muted); }
.ev { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 8px; padding: 6px 8px;
  font-size: 13px; cursor: default; min-width: 0; }
.ev[draggable="true"] { cursor: grab; }
.ev.k-overdue { border-left-color: var(--danger); background: var(--err-bg); }
.ev.k-today { border-left-color: var(--ok-ink); background: var(--ok-bg); }
.ev.k-tomorrow { border-left-color: var(--accent); }
.ev-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ev-time { font-variant-numeric: tabular-nums; color: var(--ink-2); flex: none; }
.ev-title { flex: 1; min-width: 0; font-weight: 500; }
.ev-title a { color: var(--ink); text-decoration: none; }
.ev-title a:hover { color: var(--link); text-decoration: underline; }
.ev .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ev-done { flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; width: 22px; height: 22px; padding: 0;
  cursor: pointer; font-size: 12px; line-height: 1; }
.ev-done:hover { border-color: var(--ok-ink); color: var(--ok-ink); }
.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.cal-day { padding: 6px 12px; }
.cal-hour { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); min-height: 40px; }
.cal-hour:first-child { border-top: none; }
.cal-hl { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.cal-hev { display: flex; flex-direction: column; gap: 6px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 6px; min-width: 780px; }
.cal-wd { font-size: 12px; color: var(--muted); padding: 0 4px; }
.cal-cell { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-height: 104px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.out { opacity: .55; }
.cal-num { align-self: flex-start; font-size: 13px; font-weight: 600; }
.cal-cell .ev { padding: 3px 6px; font-size: 12px; }
.cal-more { font-size: 12px; align-self: flex-start; }
@media (max-width: 980px) { .cal-week { grid-template-columns: minmax(0, 1fr); } .cal-col { min-height: 0; } }
.ev-head .grow { flex: 1; min-width: 0; }
.ev-kind { font-size: 11px; color: var(--muted); }
.ev.k-overdue .ev-kind { color: var(--err-ink); }
.ev-name { font-weight: 500; margin-top: 2px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.ev-name a { color: var(--ink); text-decoration: none; }
.ev-name a:hover { color: var(--link); text-decoration: underline; }
.ev-who { font-size: 11px; color: var(--ink-2); background: var(--chip-bg); border-radius: 4px; padding: 0 4px; margin-right: 4px; white-space: nowrap; }
.ev-who.me { background: var(--info-bg); color: var(--accent); }
.cal-bar .dd { min-width: 200px; }
.cal-bar .dd-pop { left: auto; right: 0; }
.ftable tr.total td { border-top: 2px solid var(--line-strong); background: var(--chip-bg); }
.rep-dates { display: inline-flex; align-items: center; gap: 6px; }
.rep-dates .input { width: 140px; }
.rep-legend { padding: 14px 18px; }
.rep-legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.rep-legend dt { font-weight: 600; }
.rep-legend dd { margin: 0; color: var(--ink-2); }
@media (max-width: 640px) { .rep-legend dl { grid-template-columns: 1fr; } .rep-legend dd { margin-bottom: 6px; } }
.ftable.rep th.grp { text-align: center; border-left: 1px solid var(--line-strong); }
.ftable.rep .gstart { border-left: 1px solid var(--line-strong); }
.rep-legend .hint { margin-top: 8px; }
.ftable.rep th, .ftable.rep td { padding-left: 8px; padding-right: 8px; }
.ftable.rep td:first-child { white-space: nowrap; }
.ftable.rep td.where .clip { max-width: 120px; }
.ftable.rep td.title .clip { max-width: 170px; }
.rep-bar .dd-pop { left: 0; right: auto; }  /* в отчёте списки слева, в календаре — справа */
.topbar .aux { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.aux-link { border: 0; background: none; padding: 0; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.aux-link:hover, .aux-link.on { color: var(--link); }
/* знакомство — как в «Гигиене CRM»: окно поверх приложения и ярлычок у правого края */
.tour-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(23, 32, 43, .55); display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; overflow-y: auto; }
.tour { width: min(880px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); overflow: hidden; outline: none; }
.tour-shot { background: #eef2f4; border-bottom: 1px solid var(--line-strong); height: 340px; display: flex; align-items: center; overflow: hidden; }
.tour-shot img { display: block; width: 100%; height: auto; }
.tour-body { padding: 18px 24px 20px; display: flex; flex-direction: column; gap: 10px; }
.tour-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tour-head h2 { margin: 2px 0 0; }
.tour-text { margin: 0; line-height: 1.5; color: var(--ink-2); }
.tour-example { background: var(--chip-bg); color: var(--ink); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.5; }
.tour-close { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.tour-close:hover { background: var(--chip-bg); color: var(--ink); }
.tour-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.tour-foot .row { display: flex; gap: 8px; }
.tour-dots { display: flex; gap: 6px; align-items: center; }
.tour-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; background: var(--line-strong); cursor: pointer; }
.tour-dots button.on { width: 22px; background: var(--accent); }
@media (max-width: 600px) { .tour-overlay { padding: 8px; } .tour-body { padding: 14px 16px 16px; } .tour-shot { height: 190px; } }
/* ярлычок у правого края: окно приложения растянуто по содержимому, поэтому он стоит у верха, рядом с меню */
.tour-tab { position: fixed; right: 0; top: 96px; z-index: 5; writing-mode: vertical-rl; transform: rotate(180deg); border: 0; border-radius: 0 8px 8px 0;
  background: var(--accent); color: #fff; padding: 12px 5px; font-size: 13px; box-shadow: var(--shadow); cursor: pointer; }
.tour-tab:hover { background: var(--accent-dark); }
@media (max-width: 700px) { .tour-tab { display: none; } }
/* настройки сохраняются сами: состояние — в заголовке блока, как в «Гигиене CRM» */
.head-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.save-status { font-size: 13px; color: var(--muted); }
.save-status.ok { color: var(--ok-ink); }
.save-status.err { color: var(--err-ink); }
.seg.seg-s { box-shadow: none; background: var(--chip-bg); align-self: flex-start; }
.seg.seg-s button { padding: 5px 14px; font-size: 13px; }
.ftable td.kind .sub { white-space: normal; max-width: 120px; line-height: 1.3; }
