/* Студія рілсів. Темна, тиха, акцент — фірмовий блакитний. Рух лише там, де він пояснює:
   відкриття ролика, зміна етапу, прогрес. Часті дії (перемикання фраз, вкладки) — без анімації або ≤160 мс. */
:root {
  --bg: #0b0b0d; --s1: #141417; --s2: #1b1b20; --s3: #26262d; --s4: #30303a;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.13);
  --t1: #f4f4f6; --t2: #a3a3ad; --t3: #6c6c77;
  --acc: #19b3ff; --acc-d: rgba(25,179,255,.16);
  --ok: #34d669; --ok-d: rgba(52,214,105,.15);
  --warn: #ffb224; --warn-d: rgba(255,178,36,.14);
  --bad: #ff4d45; --bad-d: rgba(255,77,69,.14);
  --vio: #b77bff; --vio-d: rgba(183,123,255,.15);
  --ease-out: cubic-bezier(.23,1,.32,1);
  --ease-io: cubic-bezier(.77,0,.175,1);
  --ease-drawer: cubic-bezier(.32,.72,0,1);
  --r: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--bg);
}
body { margin: 0; color: var(--t1); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { font-size: 16px; }
button, a, label.btn, [role="button"], [role="tab"] { touch-action: manipulation; }
button, label.btn, [role="tab"], .chip, .card { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--s3); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--t2); } .small { font-size: 12px; }
[hidden] { display: none !important; }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line2);
  background: var(--s2); color: var(--t1); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--acc); border-color: transparent; color: #001018; }
.btn.ok { background: var(--ok); border-color: transparent; color: #00170a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.big { height: 48px; border-radius: 14px; font-size: 15px; padding: 0 20px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; color: var(--t2);
  display: inline-grid; place-items: center; cursor: pointer; transition: transform 140ms var(--ease-out), background-color 160ms;
}
.icon-btn:active { transform: scale(.94); background: var(--s3); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--s3); border-color: rgba(255,255,255,.2); }
  .btn.primary:hover { background: #45c3ff; }
  .btn.ok:hover { background: #55e283; }
  .btn.ghost:hover { background: var(--s2); }
  .icon-btn:hover { background: var(--s2); color: var(--t1); }
  .card:hover { border-color: var(--line2); background: var(--s2); }
  .phrase:hover { background: var(--s2); }
  .word:hover { background: var(--s3); }
  .chip:hover { color: var(--t1); }
}

/* ── шапка ── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  background: rgba(11,11,13,.82); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 4px var(--acc-d); }
.top-meta { color: var(--t3); font-size: 12px; font-variant-numeric: tabular-nums; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── фільтри етапів (телефон) ── */
.filters {
  display: none; gap: 6px; padding: 10px 16px 6px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity; position: sticky; top: calc(59px + env(safe-area-inset-top, 0px)); z-index: 4; background: var(--bg);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent;
  color: var(--t2); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  scroll-snap-align: start; transition: background-color 160ms, color 160ms, border-color 160ms, transform 140ms var(--ease-out);
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--t1); color: #000; border-color: transparent; }
.chip b { font-weight: 600; opacity: .55; font-variant-numeric: tabular-nums; }

/* ── дошка ── */
.board {
  flex: 1; display: grid; grid-template-columns: repeat(5, minmax(232px, 1fr)); gap: 14px;
  padding: 16px max(18px, env(safe-area-inset-right)) 40px max(18px, env(safe-area-inset-left)); overflow-x: auto; align-items: start;
}
.col { min-width: 0; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; color: var(--t2); font-weight: 600; font-size: 13px; }
.col-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--t3)); }
.col-head b { margin-left: auto; color: var(--t3); font-weight: 500; font-variant-numeric: tabular-nums; }
.col-list { display: flex; flex-direction: column; gap: 10px; min-height: 80px; border-radius: var(--r); }
.col-empty { border: 1px dashed var(--line); border-radius: var(--r); height: 80px; display: grid; place-items: center; color: var(--t3); font-size: 12px; }

.card {
  display: flex; gap: 12px; padding: 10px; border-radius: var(--r); background: var(--s1); border: 1px solid var(--line);
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform 160ms var(--ease-out), background-color 160ms, border-color 160ms;
}
.card:active { transform: scale(.985); }
.card.enter { animation: cardIn 340ms var(--ease-out) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.thumb {
  flex: none; width: 58px; aspect-ratio: 9/16; border-radius: 9px; background: var(--s3) center/cover no-repeat; position: relative; overflow: hidden;
}
.thumb .len {
  position: absolute; right: 3px; bottom: 3px; padding: 0 4px; border-radius: 5px; background: rgba(0,0,0,.62);
  font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 15px;
}
.card-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.card-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--t2); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.card-sub .pill { padding: 0 7px; border-radius: 6px; line-height: 18px; font-weight: 600; font-size: 11px; background: var(--d); color: var(--c); }
.card-job { margin-top: auto; font-size: 12px; color: var(--t2); display: flex; flex-direction: column; gap: 6px; }
.card-job .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-job.err .txt { color: var(--bad); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.upload .thumb { display: grid; place-items: center; color: var(--t3); }

/* прогрес: transform scaleX — без перерахунку макета; невизначений — біжучий відблиск */
.bar { height: 4px; border-radius: 4px; background: var(--s3); overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0; background: var(--acc); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 600ms var(--ease-out); border-radius: 4px; }
.bar.indet i { transform: none; width: 38%; animation: indet 1.25s var(--ease-io) infinite; }
@keyframes indet { from { transform: translateX(-110%); } to { transform: translateX(280%); } }

/* етапи */
[data-st="сире"]         { --c: var(--t2);  --d: var(--s3); }
[data-st="змонтоване"]   { --c: var(--acc); --d: var(--acc-d); }
[data-st="затверджене"]  { --c: var(--ok);  --d: var(--ok-d); }
[data-st="в черзі"]      { --c: var(--warn); --d: var(--warn-d); }
[data-st="опубліковано"] { --c: var(--vio); --d: var(--vio-d); }

/* ── порожньо ── */
.empty { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; padding: 24px; }
.empty-card { max-width: 420px; text-align: center; pointer-events: auto; }
.empty-ico { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 22px; background: var(--s2); display: grid; place-items: center; color: var(--acc); }
.empty h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.01em; }
.empty p { margin: 6px 0; color: var(--t2); }

/* ── аркуш ролика ── */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity 260ms ease; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(900px, max(64vw, 660px), 100vw);
  background: var(--s1); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  transform: translateX(104%); transition: transform 380ms var(--ease-drawer); will-change: transform;
  box-shadow: -30px 0 80px rgba(0,0,0,.45);
}
.sheet.on { transform: none; }
.grab { display: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 8px 10px; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.title-in {
  width: 100%; border: 0; background: transparent; font-size: 20px; font-weight: 700; letter-spacing: -.015em; padding: 4px 6px;
  border-radius: 8px; outline: none; transition: background-color 160ms;
}
.title-in:focus { background: var(--s2); }
.steps { display: flex; gap: 4px; padding: 0 6px; }
.step { flex: 1; display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--t3); font-weight: 600; min-width: 0; }
.step i { height: 3px; border-radius: 3px; background: var(--s3); transition: background-color 300ms ease; }
.step.done i { background: var(--c); }
.step.cur { color: var(--c); }
.step span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { position: relative; display: flex; gap: 2px; padding: 6px 14px 0; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 10px 12px; color: var(--t2); font-weight: 600; cursor: pointer; transition: color 160ms;
}
.tabs button[aria-selected="true"] { color: var(--t1); }
.tab-ink { position: absolute; bottom: -1px; left: 0; height: 2px; width: 10px; background: var(--t1); border-radius: 2px; transform-origin: left;
  transition: transform 260ms var(--ease-out); }
.job { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--s2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.job-row { display: flex; align-items: center; gap: 10px; }
.job-row .txt { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; }
.job.err { border-color: rgba(255,77,69,.35); background: var(--bad-d); }
.job.err .txt { color: #ffb3ae; white-space: pre-wrap; font-weight: 500; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }

/* ── «Ролик» ── */
.view { display: grid; grid-template-columns: minmax(220px, 330px) 1fr; gap: 22px; align-items: start; }
.player { position: relative; width: 100%; aspect-ratio: 9/16; border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player .ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--t3); padding: 20px; font-size: 13px; background: var(--s2) center/cover; }
.player .ph > * , .player .ph p { margin: 0; } .player .ph > div, .player .ph > span { padding: 12px 16px; border-radius: 14px; background: rgba(11,11,13,.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--t1); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.box { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.box h3 { margin: 0; font-size: 13px; color: var(--t2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.box h3 .sp { margin-left: auto; }
.note { padding: 10px 12px; border-radius: 11px; font-size: 13px; line-height: 1.4; }
.note.warn { background: var(--warn-d); color: #ffd69a; }
.note.bad { background: var(--bad-d); color: #ffb3ae; }
.note.ok { background: var(--ok-d); color: #a8f0c0; }
.approve { display: flex; align-items: center; gap: 12px; }
.approve .state { flex: 1; font-weight: 600; }
.approve .state small { display: block; color: var(--t2); font-weight: 500; font-size: 12px; }
textarea.cap {
  width: 100%; min-height: 130px; resize: vertical; border-radius: 11px; border: 1px solid var(--line2); background: var(--s1);
  padding: 10px 12px; line-height: 1.45; outline: none; transition: border-color 160ms;
}
textarea.cap:focus, .field:focus { border-color: var(--acc); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { height: 40px; border-radius: 11px; border: 1px solid var(--line2); background: var(--s1); padding: 0 10px; outline: none; color-scheme: dark; min-width: 0; }
.seg { display: inline-flex; background: var(--s1); border: 1px solid var(--line2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 8px; color: var(--t2); font-weight: 600; cursor: pointer; transition: background-color 160ms, color 160ms; }
.seg button[aria-pressed="true"] { background: var(--s4); color: var(--t1); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--t2); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ── «Нарізка» ── */
.cut { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: auto auto; gap: 16px; }
.cut .player { grid-row: 1; }
.phrases { grid-row: 1; display: flex; flex-direction: column; gap: 2px; max-height: 444px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.phrase {
  display: grid; grid-template-columns: 22px 46px 1fr; gap: 8px; align-items: start; padding: 8px 8px; border-radius: 10px; cursor: pointer;
  transition: background-color 120ms, opacity 160ms;
}
.phrase .tg { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line2); display: grid; place-items: center; margin-top: 1px; transition: background-color 140ms, border-color 140ms; }
.phrase .tg svg { opacity: 0; transition: opacity 120ms; }
.phrase.on .tg { background: var(--acc); border-color: var(--acc); color: #001018; }
.phrase.on .tg svg { opacity: 1; }
.phrase .tm { color: var(--t3); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.phrase .tx { font-size: 14px; line-height: 1.4; }
.phrase:not(.on) .tx { color: var(--t3); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.phrase .why { display: block; font-size: 11px; color: var(--warn); margin-top: 2px; text-decoration: none; }
.phrase.cur { background: var(--s3); }
.phrase.trim .tm::after { content: " ✂"; color: var(--acc); }
.wave-wrap { grid-column: 1 / -1; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
#wave { touch-action: pan-x; }
.wave-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wave-tools .t { font-variant-numeric: tabular-nums; color: var(--t2); font-size: 12px; min-width: 92px; }
.wave-tools input[type=range] { accent-color: var(--acc); width: 120px; }
.wave-tools .sp { margin-left: auto; }
.legend { display: flex; gap: 14px; color: var(--t3); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.applybar {
  position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom, 0px)); grid-column: 1 / -1; margin: 0 -16px -24px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(20,20,23,.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; transform: translateY(110%); transition: transform 300ms var(--ease-out);
}
.applybar.on { transform: none; }
.applybar .txt { flex: 1; font-size: 13px; color: var(--t2); }

/* ── «Монтаж» ── */
.ed { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }
.ed-player { width: min(100%, 300px); aspect-ratio: 9/16; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.ed-player video { width: 100%; height: 100%; object-fit: cover; display: block; transform-origin: 50% 42%; }
.ed-bar { display: flex; align-items: center; gap: 10px; }
.ed-bar .sp { flex: 1; }
.ed-bar .icon-btn.big { width: 44px; height: 44px; font-size: 16px; }
.ed-bar .icon-btn:disabled { opacity: .35; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; color: var(--t2); font-size: 13px; }
.tl { position: relative; overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain; touch-action: pan-x; padding: 6px 0 10px; scrollbar-width: thin; }
.tl-track { display: flex; gap: 3px; width: max-content; padding-right: 40vw; }
.tl-head { position: absolute; top: 0; bottom: 4px; left: 0; width: 2px; background: var(--acc); border-radius: 1px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.clip {
  height: 64px; flex: none; border-radius: 9px; border: 1.5px solid transparent; background: var(--s3); color: var(--t1); cursor: pointer;
  padding: 5px 6px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; overflow: hidden; min-width: 26px;
  transition: border-color 120ms, background-color 120ms;
}
.clip.on { border-color: var(--acc); background: #1d2a33; }
.clip:active { transform: scale(.98); }
.clip .ct { font-size: 11px; line-height: 1.25; color: var(--t2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clip .cb { display: flex; gap: 3px; flex-wrap: wrap; }
.clip .cb b { font-size: 10px; font-weight: 700; background: rgba(0,0,0,.35); padding: 0 4px; border-radius: 4px; color: var(--acc); }
.ed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-row .lbl { font-size: 12px; color: var(--t2); min-width: 78px; }
.ed-row input[type=range] { flex: 1; min-width: 120px; accent-color: var(--acc); }
.ed .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ed .chip { height: 32px; padding: 0 11px; }
.small-btn { height: 32px; padding: 0 10px; font-size: 13px; }
.row.wrap { flex-wrap: wrap; }
.empty-pane { padding: 40px 12px; text-align: center; }

/* ── «Текст» ── */
.text { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.lines { display: flex; flex-direction: column; gap: 6px; }
.line { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 6px 4px; border-radius: 10px; transition: background-color 160ms; }
.line.cur { background: var(--s2); }
.line .tm { color: var(--t3); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 5px; cursor: pointer; }
.words { display: flex; flex-wrap: wrap; gap: 2px; }
.word { padding: 3px 6px; border-radius: 7px; cursor: text; font-size: 15px; transition: background-color 120ms; }
.word.ed { background: var(--acc-d); color: var(--acc); }
.word.gone { text-decoration: line-through; color: var(--t3); }
.word input { width: max(4ch, calc(var(--n) * 1ch + 2ch)); border: 0; outline: 1.5px solid var(--acc); border-radius: 6px; background: var(--s1); padding: 0 4px; font-size: 16px; }
.hint { color: var(--t3); font-size: 12px; margin: 4px 0 12px; }

/* ── «Журнал» ── */
.logs { display: flex; flex-direction: column; gap: 14px; }
pre.mono { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--t2); background: var(--s2); border-radius: 12px; padding: 12px; max-height: 340px; overflow: auto; }

/* ── перетягування файлу, модалка, тости ── */
.drop { position: fixed; inset: 10px; z-index: 40; border: 2px dashed var(--acc); border-radius: 22px; background: rgba(25,179,255,.08);
  display: grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--acc); opacity: 0; pointer-events: none; transition: opacity 160ms ease; }
.drop.on { opacity: 1; }
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 20px; animation: fadeIn 200ms ease both; }
.modal { width: min(380px, 100%); background: var(--s2); border: 1px solid var(--line2); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; text-align: center;
  animation: popIn 260ms var(--ease-out) both; }
.modal h3 { margin: 0; font-size: 17px; }
.modal .qr { background: #fff; border-radius: 14px; padding: 12px; margin: 4px auto; width: 220px; }
.modal .qr img, .modal .qr svg { width: 100%; height: auto; display: block; }
.modal .url { font: 11px ui-monospace, Menlo, monospace; color: var(--t2); word-break: break-all; user-select: all; -webkit-user-select: all; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
.toast { pointer-events: auto; background: #f4f4f6; color: #0b0b0d; font-weight: 600; font-size: 14px; padding: 11px 16px; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.4);
  transition: opacity 260ms ease, transform 300ms var(--ease-out); }
.toast.bad { background: var(--bad); color: #fff; }
@starting-style { .toast { opacity: 0; transform: translateY(12px) scale(.98); } }
.toast.out { opacity: 0; transform: translateY(6px); transition-duration: 180ms; }


/* ── нове 06.12: пошук, версії, варіанти підпису, статистика, розклад ── */
.search { height: 36px; flex: 0 1 280px; min-width: 0; margin-left: auto; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--s1); padding: 0 12px; outline: none; font-size: 14px; }
.search:focus { border-color: var(--acc); }
.top .search + .top-actions { margin-left: 0; }
.pcol { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.seg.ver { align-self: center; }
.caps { display: flex; flex-direction: column; gap: 6px; }
.capv { display: flex; gap: 8px; align-items: flex-start; text-align: left; border: 1px solid var(--line2); background: var(--s1);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.35; color: var(--t2); cursor: pointer;
  transition: transform 120ms var(--ease-out), border-color 120ms ease; }
.capv b { color: var(--t3); font-variant-numeric: tabular-nums; }
.capv:active { transform: scale(.985); }
.capv[aria-pressed="true"] { border-color: var(--acc); color: var(--t1); background: var(--acc-d); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--s1); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--t3); font-size: 11px; }
.card-sub .pill.m, .pill.m { background: var(--vio-d); color: var(--vio); padding: 0 7px; border-radius: 6px; line-height: 18px; font-weight: 600; font-size: 11px; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.modal.wide { width: min(520px, 100%); text-align: left; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.modal label { display: inline-flex; align-items: center; gap: 6px; }
.plist { display: flex; flex-direction: column; gap: 4px; }
.pitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--s1); }
.pitem .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pitem .tg { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line2); background: transparent; display: grid; place-items: center; padding: 0; color: #001018; }
.pitem .tg svg { opacity: 0; } .pitem .tg.on { background: var(--acc); border-color: var(--acc); } .pitem .tg.on svg { opacity: 1; }
.pitem .icon-btn { width: 32px; height: 32px; }
.pplan { background: var(--s1); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pplan b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.legend .keys { margin-left: auto; }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; }
  .search { order: 10; flex: 1 1 100%; margin-left: 0; height: 40px; font-size: 16px; }
  .top-actions { margin-left: auto; }
  .legend .keys { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}

/* ── телефон ── */
@media (max-width: 760px) {
  .top { gap: 10px; }
  .top .lbl { display: none; }
  #phoneBtn { display: none; }
  .top-actions .btn { width: 40px; padding: 0; }
  .filters { display: flex; }
  .board { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 8px 16px calc(40px + env(safe-area-inset-bottom, 0px)); overflow: visible; }
  .board .col { display: contents; }
  .board .col-head, .board .col-empty { display: none; }
  .board .col-list { display: contents; }
  .thumb { width: 64px; }
  .sheet { width: 100%; top: env(safe-area-inset-top, 0px); border-left: 0; border-radius: 18px 18px 0 0; transform: translateY(104%); box-shadow: 0 -20px 60px rgba(0,0,0,.5); }
  .sheet.on { transform: none; }
  .sheet.dragging { transition: none; }
  .grab { display: flex; justify-content: center; padding: 8px 0 0; touch-action: none; cursor: grab; }
  .grab span { width: 38px; height: 5px; border-radius: 3px; background: var(--s4); }
  .sheet-head { padding-top: 4px; touch-action: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; padding: 6px 6px 0; gap: 0; }
  .tabs button { padding-left: 9px; padding-right: 9px; }
  .view, .cut, .text { grid-template-columns: 1fr; }
  .view .player { max-width: 300px; margin: 0 auto; }
  .cut .player { max-width: 210px; margin: 0 auto; }
  .phrases { grid-row: auto; max-height: none; }
  .wave-wrap { grid-row: 2; }
  .text .player { display: none; }
  .step span { visibility: hidden; }
  .step.cur span { visibility: visible; overflow: visible; }
  .seg button { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .card, .applybar, .tab-ink, .bar i { transition-duration: 1ms !important; }
  .card.enter, .modal, .modal-wrap { animation: fadeIn 160ms ease both !important; }
  .bar.indet i { animation: none; width: 100%; opacity: .5; }
}
