/* Палитра и кнопки — как в интерфейсе Битрикс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); }

/* пустые состояния и подсказки */
.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(150px, 1.1fr) minmax(130px, .8fr) 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; }
.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; }
}
