/* Контент-завод: страница для телефона и компьютера. Светлая и тёмная тема по настройке устройства. */

:root {
  color-scheme: light dark;
  --bg: #f7f4f2;
  --surface: #ffffff;
  --surface-2: #f2edea;
  --surface-3: #e9e2de;
  --line: #e4dcd8;
  --line-strong: #cfc5c0;
  --text: #221e20;
  --muted: #6e6568;
  --faint: #9a9093;
  --accent: #a3436a;
  --accent-hover: #8e3659;
  --accent-ink: #ffffff;
  --accent-soft: #f6e5ec;
  --ok: #2c8556;
  --ok-soft: #e3f3ea;
  --warn: #a8700f;
  --warn-soft: #fbf0d6;
  --err: #c0392b;
  --err-soft: #fbe5e2;
  --info: #3a6ab0;
  --info-soft: #e5eef9;
  --mark-err: #f9cfc9;
  --mark-warn: #f8e3a8;
  --shadow: 0 1px 2px rgba(40, 20, 30, .05), 0 6px 20px rgba(40, 20, 30, .05);
  --shadow-up: 0 -6px 24px rgba(40, 20, 30, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --nav-h: 60px;
  --backdrop: rgba(15, 10, 13, .45);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141113;
    --surface: #1d191c;
    --surface-2: #262125;
    --surface-3: #312a2f;
    --line: #342d32;
    --line-strong: #4a4147;
    --text: #efe9ec;
    --muted: #b0a5aa;
    --faint: #857a80;
    --accent: #e07fa3;
    --accent-hover: #ec98b7;
    --accent-ink: #1d1016;
    --accent-soft: #3a2230;
    --ok: #5cc28c;
    --ok-soft: #1b3326;
    --warn: #e2b04f;
    --warn-soft: #3a2f17;
    --err: #f0786b;
    --err-soft: #3d1f1c;
    --info: #7fa7e8;
    --info-soft: #1d2a3d;
    --mark-err: #6b2a24;
    --mark-warn: #5e4a14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-up: 0 -6px 24px rgba(0, 0, 0, .4);
    --backdrop: rgba(0, 0, 0, .62);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  overflow-wrap: anywhere;
}
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.err-text { color: var(--err); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── каркас ── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);   /* без backdrop-filter: он ломает position: fixed у нижнего меню */
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.top .spacer { flex: 1; }
.top-spend { font-size: 13.5px; color: var(--muted); white-space: nowrap; display: none; }
.top-spend.blocked { color: var(--err); }
.who-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px 0 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--accent-soft); color: var(--accent);
}
.avatar.oleg { background: var(--info-soft); color: var(--info); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--shadow-up);
}
.nav a {
  flex: 1 1 0; max-width: 220px; min-height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; position: relative;
}
.nav a .ico { width: 24px; height: 24px; }
.nav a.on { color: var(--accent); }
.nav .badge { position: absolute; top: 6px; left: calc(50% + 8px); }

main {
  max-width: 680px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
}
main.wide { max-width: 1180px; }

@media (min-width: 760px) {
  .nav {
    position: static; background: none; border: 0; box-shadow: none; padding: 0; gap: 4px;
    justify-content: flex-start; margin-left: 12px;
  }
  .nav a {
    flex: 0 0 auto; flex-direction: row; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 15px;
  }
  .nav a .ico { width: 20px; height: 20px; }
  .nav a.on { background: var(--accent-soft); }
  .nav .badge { position: static; margin-left: 4px; }
  .top-spend { display: inline; }
  main { padding-bottom: 48px; padding-top: 24px; }
}

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.badge.err { background: var(--err); color: #fff; }
.badge.quiet { background: var(--surface-3); color: var(--muted); }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 15.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s, transform .05s;
  -webkit-user-select: none; user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--err); border-color: var(--line-strong); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.btn-danger:hover { background: var(--err-soft); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-soft:hover { background: var(--surface-3); background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.btn-big { min-height: 54px; font-size: 17px; border-radius: 14px; padding: 0 22px; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 14.5px; border-radius: 10px; }
.btn .spin { width: 18px; height: 18px; }
.link-btn {
  background: none; border: 0; padding: 10px 4px; min-height: 44px; color: var(--accent);
  font-weight: 600; cursor: pointer; font-size: 15px;
}
.link-btn.muted { color: var(--muted); }
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--muted); text-decoration: none; font-weight: 600; margin: -6px 0 6px -4px; padding: 0 4px;
}
.back:hover { color: var(--text); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* ── карточки ── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card.flat { box-shadow: none; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.note {
  border-radius: 12px; padding: 12px 14px; background: var(--surface-2); color: var(--text); font-size: 15px;
}
.note.err { background: var(--err-soft); color: var(--err); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--info-soft); color: var(--info); }
.note b { font-weight: 700; }

/* ── поля ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.input, .textarea, select.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  font-size: 16.5px; line-height: 1.45; transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 110px; display: block; }
.input:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea.big { min-height: 120px; font-size: 18px; border-radius: 14px; padding: 14px 16px; }
.textarea.caption { min-height: 260px; font-size: 16px; }
.counter { font-size: 13px; color: var(--muted); text-align: right; }
.counter.over { color: var(--err); font-weight: 700; }

/* ── чипы и вкладки ── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  min-height: 44px; padding: 0 15px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.chip img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; margin-left: -8px; }
.chip-group { display: flex; flex-direction: column; gap: 6px; }
.chip-group > span { font-size: 13px; color: var(--muted); font-weight: 600; }

.tabs {
  display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 14px; border-radius: 11px; border: 0; background: none;
  color: var(--muted); font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs.seg { overflow: visible; }
.tabs.seg .tab { flex: 1 1 0; padding: 0 4px; min-width: 0; font-size: 15px; }
.tabs.seg .tab[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tab .dot { width: 8px; height: 8px; }
.tabs.small .tab { min-height: 40px; font-size: 14.5px; }

/* ── точки статуса ── */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.dot.chernovik { background: var(--faint); }
.dot.waiting { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.odobreno, .dot.v_ocheredi { background: var(--warn); }
.dot.otpravka, .dot.v_buffer { background: var(--info); }
.dot.vyshlo { background: var(--ok); }
.dot.oshibka { background: var(--err); }
.dot.neyasno { background: #e0712c; }
.dot.otmena { background: var(--line-strong); }
.dot.err { background: var(--err); }
.dot.warn { background: var(--warn); }
.dot.ok { background: var(--ok); }

/* ── экран входа ── */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  padding-top: calc(24px + env(safe-area-inset-top));
}
.gate-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.gate-logo { width: 64px; height: 64px; border-radius: 18px; box-shadow: var(--shadow); }
.gate h1 { font-size: 26px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 10px;
  border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow); cursor: pointer; font-size: 17px; font-weight: 650;
}
.who-card:hover { border-color: var(--accent); }
.who-card .avatar { width: 56px; height: 56px; font-size: 22px; }

/* ── главная ── */
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.create .textarea { margin-bottom: 12px; }
.create-opts { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.create-opts .row { gap: 8px; }
.opt-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 2px; }
details.more { border-top: 1px dashed var(--line); padding-top: 4px; }
details.more > summary {
  cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 600; font-size: 15px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋"; font-weight: 700; color: var(--accent); }
details.more[open] > summary::before { content: "−"; }
.more-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 0 10px; }
.spend-line { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.spend-line.blocked { color: var(--err); font-weight: 600; }
.meter { flex: 0 0 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.meter i.mid { background: var(--warn); }
.meter i.high { background: var(--err); }

.topics { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.topic {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; min-height: 44px;
}
.topic:hover { border-color: var(--accent); }
.topic .num {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.topic .t { font-weight: 650; font-size: 16px; }
.topic .b { font-size: 14px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic .go { margin-left: auto; color: var(--accent); font-weight: 700; align-self: center; white-space: nowrap; font-size: 15px; }

.list { display: flex; flex-direction: column; }
.post-row {
  display: flex; gap: 12px; align-items: center; padding: 12px 4px; min-height: 64px;
  text-decoration: none; color: inherit; border-bottom: 1px solid var(--line);
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover .pr-title { color: var(--accent); }
.thumb {
  flex: 0 0 52px; width: 52px; height: 65px; border-radius: 8px; overflow: hidden; position: relative;
  background: var(--surface-2); border: 1px solid var(--line);
}
.thumb.story { height: 72px; flex-basis: 41px; width: 41px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.pr-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.pr-meta .sep::before { content: "·"; }
.pr-go { color: var(--faint); font-size: 22px; flex: 0 0 auto; }
.empty { padding: 26px 8px; text-align: center; color: var(--muted); }

/* ── пост ── */
.post-head { display: flex; flex-direction: column; gap: 10px; }
.brief { font-size: 17px; font-weight: 600; white-space: pre-wrap; }
.brief.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.understood {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--text); font-size: 15px;
}
.understood .lbl { font-weight: 700; color: var(--accent); white-space: nowrap; }
.understood .grow { padding-top: 1px; }
.meta-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.progress { display: flex; flex-direction: column; gap: 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 5%; background: var(--accent); border-radius: 4px; transition: width .6s ease; }
.bar.indet i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.spin {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(128, 128, 128, .3); border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  animation: spin .8s linear infinite; flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin, .bar.indet i { animation-duration: 3s; }
  .bar i { transition: none; }
}

.variants { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 760px) { .variants { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .variants { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.variant { position: relative; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.variant.chosen { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.v-head { display: flex; flex-direction: column; gap: 4px; }
.v-head .row { gap: 8px; }
.v-head h3 { font-size: 17px; min-width: 0; }
.v-angle { font-size: 14.5px; color: var(--muted); }

.viewer { display: flex; flex-direction: column; gap: 10px; }
.frame {
  position: relative; width: 100%; overflow: hidden; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
  touch-action: pan-y;
}
.frame::before { content: ""; display: block; padding-top: 125%; }
.send-grid .frame { max-width: 480px; margin: 0 auto; }
.frame.story, .send-grid .frame.story { width: 74%; max-width: 340px; margin: 0 auto; }
.frame.story::before { padding-top: 177.78%; }
.frame iframe {
  position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff;
}
.frame .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.frame-count {   /* внизу справа: вверху у шаблонов бейдж и пометки #AD */
  position: absolute; right: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px;
  background: rgba(20, 15, 18, .62); color: #fff; font-size: 12.5px; font-weight: 600; pointer-events: none;
}
.frame-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .88); color: #222; font-size: 20px; cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.frame-nav.prev { left: 8px; }
.frame-nav.next { right: 8px; }
@media (hover: none) { .frame-nav { display: none; } }
.frame-chips .chip { min-height: 36px; padding: 0 12px; font-size: 13.5px; }

.v-design { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.v-design .btn { padding: 0 8px; font-size: 14px; white-space: normal; line-height: 1.15; text-align: center; min-width: 0; }
.v-design .group { display: flex; gap: 0; min-width: 0; }
.v-design .group .btn { flex: 1 1 auto; }
.v-design .group .btn:last-child { flex: 0 0 44px; }
.more-btn { font-size: 18px; letter-spacing: 1px; }
.v-design .group .btn:first-child { border-radius: 10px 0 0 10px; }
.v-design .group .btn:last-child { border-radius: 0 10px 10px 0; border-left: 0; }

.caption {
  white-space: pre-wrap; font-size: 15.5px; line-height: 1.5; position: relative;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2);
}
.caption.clamp { max-height: 210px; overflow: hidden; }
.caption.clamp::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(to bottom, transparent, var(--surface-2)); border-radius: 0 0 12px 12px;
}
.caption.off { opacity: .55; }
mark { border-radius: 4px; padding: 0 2px; color: inherit; }
mark.err { background: var(--mark-err); box-shadow: inset 0 -2px 0 var(--err); }
mark.warn { background: var(--mark-warn); box-shadow: inset 0 -2px 0 var(--warn); }

.flags { display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 14.5px;
}
.flag.err { background: var(--err-soft); }
.flag.warn { background: var(--warn-soft); }
.flag .dot { margin-top: 6px; }
.flag .phrase { font-weight: 700; }
.flag .where { color: var(--muted); font-size: 13px; }
.flag .hint { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.flags-ok { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ok); }

.editor { display: flex; flex-direction: column; gap: 12px; }
.editor .imgfields { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.save-state { font-size: 13.5px; color: var(--muted); min-height: 20px; }
.save-state.err { color: var(--err); }
.save-state.ok { color: var(--ok); }

.v-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.v-actions .btn { flex: 1 1 auto; }
.v-actions .btn-primary { flex-basis: 100%; }
.v-busy {
  position: absolute; inset: 0; border-radius: var(--radius); z-index: 3;
  background: var(--surface); opacity: .96;
  background: color-mix(in srgb, var(--surface) 78%, transparent); opacity: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center; font-weight: 600;
}
.v-busy .bar { width: 70%; }

.panel { display: flex; flex-direction: column; gap: 16px; }
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 900px) {
  .send-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
  .send-grid .panel { position: sticky; top: 80px; }
}
.toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.times { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.times .t-row { display: flex; gap: 8px; align-items: baseline; }
.times .t-lang { font-weight: 700; width: 30px; flex: 0 0 auto; }
.reason { font-size: 14.5px; color: var(--err); text-align: center; }
.reason.muted { color: var(--muted); }

.status-head { display: flex; flex-direction: column; gap: 10px; }
.status-big { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.status-big .dot { width: 14px; height: 14px; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-items: start; }
.assets a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.assets img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.assets a.story img { aspect-ratio: 9 / 16; }
.units { display: flex; flex-direction: column; }
.unit { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.unit:last-child { border-bottom: 0; }
.unit .u-main { display: flex; gap: 10px; align-items: center; }
.unit .u-what { font-weight: 600; }
.unit .u-when { color: var(--muted); font-size: 14px; }
.unit .u-st { margin-left: auto; font-size: 14px; color: var(--muted); white-space: nowrap; }
.unit .u-err { color: var(--err); font-size: 14px; }
.history { font-size: 14px; }
.history summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--muted); }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; gap: 10px; }
.history .h-at { color: var(--faint); white-space: nowrap; flex: 0 0 auto; min-width: 104px; }

/* ── библиотека ── */
.lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .lib-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .lib-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.lib-item {
  position: relative; padding: 0; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface-2); cursor: pointer; aspect-ratio: 1 / 1; display: block; width: 100%;
}
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.lib-item .lib-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11.5px; color: #fff;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .6)); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.lib-item.on::after {
  content: "✓"; position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700;
}
.lib-grid .empty { grid-column: 1 / -1; }
.lib-none {
  aspect-ratio: 1 / 1; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: none;
  color: var(--muted); font-weight: 600; cursor: pointer; font-size: 14px; padding: 6px;
}
.lib-none.on { border-color: var(--accent); color: var(--accent); }
.upload-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; }
.lib-big { width: 100%; border-radius: 12px; background: #fff; display: block; max-height: 60vh; object-fit: contain; }

/* ── окна снизу ── */
.sheet-back {
  position: fixed; inset: 0; z-index: 50; background: var(--backdrop);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-up); animation: up .2s ease-out; overscroll-behavior: contain;
}
.sheet.wide { max-width: 760px; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 8px; }
.sheet-head h2 { flex: 1; font-size: 18px; }
.x-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted);
  font-size: 20px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto;
}
.sheet .btns { display: flex; gap: 10px; margin-top: 16px; }
.sheet .btns .btn { flex: 1; }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list .btn { justify-content: flex-start; border-color: transparent; background: var(--surface-2); }
@media (min-width: 760px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 20px; padding-bottom: 20px; }
}
@keyframes fade { from { background-color: rgba(15, 10, 13, 0); } }
@keyframes up { from { transform: translateY(30px); } }

/* ── всплывающие сообщения ── */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); pointer-events: none; padding: 0 16px;
}
@media (min-width: 760px) { .toasts { bottom: 24px; } }
.toast {
  max-width: 520px; padding: 12px 16px; border-radius: 14px; background: #2a2427; color: #fff;
  font-size: 15px; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); pointer-events: auto;
  animation: up .2s ease-out; transition: opacity .3s, transform .3s;
}
.toast.err { background: #a8322a; }
.toast.ok { background: #256f48; }
.toast.out { opacity: 0; transform: translateY(8px); }

.about dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 4px 16px; }
.about dt { color: var(--muted); font-size: 14px; margin-top: 10px; }
.about dd { margin: 0; font-weight: 600; }
@media (min-width: 560px) {
  .about dl { grid-template-columns: 220px 1fr; }
  .about dt { margin-top: 0; }
}
.feat { display: flex; flex-wrap: wrap; gap: 6px; }

.boot { min-height: 70vh; display: grid; place-items: center; color: var(--muted); }

.swatch { display: inline-flex; margin-right: 2px; }
.swatch i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--surface); margin-left: -5px; display: block; }
.swatch i:first-child { margin-left: 0; }

/* ── правки после проверки на телефоне ── */
/* «Исправить красное» */
.btn-fix { color: var(--err); background: var(--err-soft); border-color: transparent; }
/* кнопка одобрения, прилипшая к низу экрана (над нижним меню), пока панели одобрения не видно */
.sticky-approve {
  position: sticky; z-index: 15; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom));
  margin-top: 12px; padding: 10px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-up); display: flex; flex-direction: column; gap: 6px;
}
.sticky-approve .row { flex-wrap: nowrap; }
.sticky-approve .grow { flex: 1 1 auto; min-width: 0; }
.sticky-approve .sa-reason { font-size: 13.5px; color: var(--err); line-height: 1.3; }
@media (min-width: 760px) { .sticky-approve { bottom: 12px; } }
@media (min-width: 900px) { .sticky-approve { display: none !important; } }
/* крутилка не уезжает на отдельную строку от длинного текста */
.spin { flex: none; }
.progress .row { flex-wrap: nowrap; align-items: flex-start; }
.progress .row > :last-child { min-width: 0; }
/* «Как я понял»: на узком экране текст уходит под подпись, а не в узкую колонку */
.understood { flex-wrap: wrap; }
.understood .grow { flex: 1 1 200px; min-width: 0; }
/* формат «Карусель» на 320 px не вылезает из кнопки */
.tabs.seg .tab { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .tabs.seg .tab { font-size: 12.5px; padding: 0 1px; letter-spacing: -.015em; } }
