/* Системные шрифты: ничего не грузится со сторонних серверов. Свой только знак кредита U+E000
   (монета со звёздочкой, ops/brand/make_credit_font.py): браузер берёт его лишь для этого символа */
@font-face { font-family: "AI Credit"; src: url("../fonts/credit.woff") format("woff"); unicode-range: U+E000; font-display: block; }
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --raised: #ffffff;
  --border: #e5e2db;
  --border-strong: #d3cfc6;
  --text: #1d1c1a;
  --muted: #74716a;
  --accent: #c2542d;
  --accent-text: #ffffff;
  --accent-soft: #f7e9e2;
  --ok: #2f7d4f;
  --ok-soft: #e3f1e8;
  --err: #b3261e;
  --err-soft: #fbe6e3;
  --warn-soft: #fbf1d9;
  --warn: #c98a0c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(30, 25, 15, .06);
  --shadow: 0 1px 2px rgba(30, 25, 15, .04), 0 6px 24px rgba(30, 25, 15, .06);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --font: "AI Credit", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="grey"]) {
    --bg: #121211;
    --surface: #1b1b19;
    --surface-2: #242422;
    --raised: #34332f;
    --border: #2f2e2a;
    --border-strong: #45433e;
    --text: #edebe5;
    --muted: #9e9b93;
    --accent: #e0703f;
    --accent-text: #161514;
    --accent-soft: #3b271d;
    --ok: #6cc68f;
    --ok-soft: #1c3326;
    --err: #f08a80;
    --err-soft: #3d1f1c;
    --warn-soft: #3a321d;
    --warn: #e8b84a;
    --shadow-sm: none;
    --shadow: none;
    color-scheme: dark;
  }
}
/* выбор «Тёмная» в меню под аватаркой (static/js/theme.js) */
:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1b1b19;
  --surface-2: #242422;
  --raised: #34332f;
  --border: #2f2e2a;
  --border-strong: #45433e;
  --text: #edebe5;
  --muted: #9e9b93;
  --accent: #e0703f;
  --accent-text: #161514;
  --accent-soft: #3b271d;
  --ok: #6cc68f;
  --ok-soft: #1c3326;
  --err: #f08a80;
  --err-soft: #3d1f1c;
  --warn-soft: #3a321d;
  --warn: #e8b84a;
  --shadow-sm: none;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 650; }
small { font-size: 13px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link-muted { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 550; }
.link-muted:hover { color: var(--accent); }

/* --- шапка --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; height: 60px; padding: 0 24px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 680; font-size: 16px; letter-spacing: -0.01em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); flex: none; }
.brand-mark svg { width: 16px; height: 16px; fill: var(--accent-text); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 7px 14px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 560; font-size: 14.5px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
/* черта между генерацией у поставщиков и нашими разработками (студии) */
.nav-sep { flex: none; align-self: center; width: 1px; height: 20px; margin: 0 8px; background: var(--border-strong); }
.nav-badge { margin-left: 4px; padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 650; }
/* меню под аватаркой */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary { background: var(--surface-2); }
.chevron { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.account-menu[open] .chevron { transform: rotate(180deg); }
.account-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; display: grid; gap: 2px; min-width: 230px; padding: 6px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 15, 5, .14);
}
.account-head { display: grid; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.account-head span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.account-pop a, .account-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; font: inherit; font-size: 14.5px; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.account-pop a:hover, .account-pop button:hover, .account-pop a:focus-visible, .account-pop button:focus-visible, .account-pop a.active {
  background: var(--surface-2); outline: none;
}
.account-pop svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-pop form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account form { margin: 0; }
/* приветствие и мини-тур новичка: static/css/tour.css, подключается только на время тура (base.html) */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.user { color: var(--muted); font-size: 14px; }
/* баланс кольцом вокруг аватарки (как у Higgsfield): доля оставшихся кредитов, красное, когда почти кончились */
.avatar-ring { position: relative; display: grid; place-items: center; width: 38px; height: 38px; flex: none; }
.avatar-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.avatar-ring circle { fill: none; stroke-width: 2.6; }
.ring-bg { stroke: var(--border); }
.ring-fg { stroke: var(--ok); stroke-linecap: round; transition: stroke-dasharray .4s, stroke .4s; }
.avatar-ring.mid .ring-fg { stroke: var(--warn); }
.avatar-ring.low .ring-fg { stroke: var(--err); }
img.avatar { object-fit: cover; }
.avatar-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.avatar-big { display: grid; place-items: center; width: 96px; height: 96px; flex: none; overflow: hidden; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 38px; font-weight: 700; }
.avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: grid; gap: 8px; min-width: 0; }
.avatar-actions h2 { margin: 0; }
.avatar-actions p { margin: 0; }
.avatar-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
/* «Имя» в карточке фото профиля, отдельной строкой под фото (templates/profile.html, patch_display_name.py) */
.name-form { flex: 1 1 100%; display: grid; gap: 8px; margin: 0; padding-top: 16px; border-top: 1px solid var(--border); }
.name-form h2, .name-form p { margin: 0; }
.name-row { display: flex; gap: 8px; max-width: 460px; }
.name-row input { flex: 1; min-width: 0; }
.name-row .btn { flex: none; }
/* длинное имя у аватарки обрезается многоточием (целиком оно в меню); в меню длинная почта или имя переносятся */
.profile-link .user { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head .account-name, .account-head .account-login { overflow-wrap: anywhere; }
.account-credits b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.account-credits.low b { color: var(--err); }
.admin-money { color: var(--muted); }
.profile-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; padding: 3px 8px 3px 3px; border-radius: 99px; }
.profile-link:hover, .profile-link.active { background: var(--surface-2); }
.profile-balance { display: grid; gap: 2px; margin-bottom: 6px; }
.profile-balance b { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
/* страница «Оплата»: подписка, тарифы и пакеты (templates/topup.html, aigen/payments_web.py) */
.sub-card { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 16px; border-color: var(--accent); }
.sub-card h2 { margin: 2px 0 4px; font-size: 22px; }
.sub-card p { margin: 0; color: var(--muted); }
.sub-renew { display: grid; justify-items: end; gap: 8px; max-width: 360px; text-align: right; font-size: 14px; }
.buy-form { display: grid; gap: 18px; }
.buy-form fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; }
.buy-form legend { margin-bottom: 8px; font-weight: 680; font-size: 16px; }
.buy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.buy-grid-packs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.buy-option { position: relative; display: grid; gap: 2px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.buy-option input { position: absolute; opacity: 0; pointer-events: none; }
.buy-option b { font-size: 15.5px; }
.buy-option span { font-size: 18px; font-weight: 700; }
.buy-option small { color: var(--muted); }
.buy-option:hover { border-color: var(--border-strong); }
.buy-option.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.buy-option:has(input:focus-visible) { box-shadow: var(--ring); }
.buy-form .btn-primary { justify-self: start; padding: 12px 20px; }
@media (max-width: 800px) {
  .buy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buy-grid-packs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sub-renew { justify-items: start; text-align: left; }
}
.pay-hook dt { margin-top: 12px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pay-hook dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.pay-hook pre { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; overflow-x: auto; }
/* оплата через Т-Банк: согласия, итог возврата из банка, пять тарифов в ряд (aigen/payments_web.py) */
.buy-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.buy-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.buy-check input { flex: none; margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); }
.buy-check[hidden] { display: none; }
.alert.alert-ok { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 800px) { .buy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pay-token { display: block; margin-top: 6px; }
.crumbs { margin: 0 0 4px !important; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.secret-box {
  display: grid; gap: 10px; padding: 14px 16px; margin-bottom: 16px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 12px;
}
.secret-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secret-row code {
  padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; word-break: break-all;
}
.notice { background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.admin-grid .table-card { margin-top: 0; }
.admin-form { margin-top: 14px; }
.admin-tabs { margin: 0; }
.prices-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px 28px; }
.control { display: grid; gap: 8px; }
.control-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-row input[type="range"] { flex: 1; min-width: 160px; }
.control-row input[type="number"] { width: 110px; }
.prices-head { flex-wrap: wrap; margin-bottom: 6px; }
.prices-head h2 { margin-bottom: 0 !important; }
.legend { font-size: 13px; margin: 0 0 10px; }
.tag-red { color: var(--err); font-weight: 650; }
.tag-yellow { color: #a87a00; font-weight: 650; }
.prices-table td { vertical-align: middle; }
.prices-table .price-input { width: 88px; padding: 6px 8px; text-align: right; }
.prices-table td.price-actions { display: flex; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.prices-table tr.row-red td { background: var(--err-soft); }
.prices-table tr.row-yellow td { background: var(--warn-soft); }
.prices-table tr.dynamic td { color: var(--muted); }
.src { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.src-override { background: var(--accent-soft); color: var(--accent); }
td.plus { color: var(--ok); }
td.minus { color: var(--err); }
.stat small { display: block; margin-top: 2px; font-size: 12.5px; }

/* --- страница --- */
.page { max-width: 1320px; margin: 0 auto; padding: 28px 24px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.history-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.page-center {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}

/* --- карточки, поля, кнопки --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; padding: 30px 28px; }
.login-head { display: grid; gap: 14px; margin-bottom: 4px; }
.login-head h1 { font-size: 24px; }
.login-head p { margin: 4px 0 0; color: var(--muted); }

.field { display: grid; gap: 8px; margin-bottom: 20px; }
.label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.label small, .label output { font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 600; }
.label output { color: var(--text); }
.hint { color: var(--muted); font-size: 13px; }
.login-card .field > span:first-child { font-size: 13px; font-weight: 600; }
input, select, textarea {
  font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 128px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--accent); background: transparent; box-shadow: none; }
/* поле пароля с кнопкой «показать»; свой глаз у Edge прячем, чтобы не было двух */
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 44px; }
.password-wrap input::-ms-reveal { display: none; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed, .password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; padding: 12px 16px; }
.btn-lg { padding: 13px 30px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

.alert { background: var(--err-soft); color: var(--err); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }

/* сегментированный переключатель */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.segmented button, .segmented a {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border: 0; border-radius: 9px; background: none;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--muted);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.segmented button:hover, .segmented a:hover { color: var(--text); }
.segmented .active, .segmented [aria-pressed="true"], .segmented [aria-selected="true"] {
  background: var(--raised); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.segmented button:focus-visible { outline: none; box-shadow: var(--ring); }
.segmented svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.segmented-full { display: flex; width: 100%; }
.segmented-lg { margin-bottom: 22px; }
.segmented-lg button { padding: 10px 14px; font-size: 15px; }

/* --- форма генерации --- */
.layout { display: grid; grid-template-columns: 448px minmax(0, 1fr); gap: 32px; align-items: start; }
.form-card { padding: 22px 22px 0; }

.model-list { display: grid; gap: 8px; }
.model-option {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 14px;
  width: 100%; padding: 12px 14px; text-align: left;
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.model-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.model-option:focus-visible { outline: none; box-shadow: var(--ring); }
.model-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.model-name { font-weight: 650; font-size: 15px; }
.model-meta { grid-column: 1; font-size: 13px; color: var(--muted); }
.model-price { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.model-price small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.dropzone {
  display: grid; justify-items: center; gap: 4px; padding: 20px 16px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2);
  color: var(--muted); cursor: pointer; font-size: 14px; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dropzone b { color: var(--text); font-weight: 600; }
.dropzone small { font-size: 12.5px; }
.dropzone svg { width: 26px; height: 26px; margin-bottom: 4px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .n { position: absolute; left: 4px; bottom: 4px; font-size: 10px; white-space: nowrap; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .62); color: #fff; }
.thumb button {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; line-height: 20px; padding: 0; font-size: 13px;
}

.aspect-list { display: flex; flex-wrap: wrap; gap: 6px; }
.aspect {
  display: inline-grid; justify-items: center; align-content: end; gap: 6px; min-width: 56px; height: 58px; padding: 8px 8px 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.aspect i { display: block; border: 1.5px solid currentColor; border-radius: 3px; }
.aspect:hover { color: var(--text); }
.aspect:focus-visible { outline: none; box-shadow: var(--ring); }
.aspect[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.range-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -4px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; margin-bottom: 20px; cursor: pointer; font-weight: 560; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 38px; height: 22px; flex: none; border-radius: 99px; background: var(--border-strong); transition: background .2s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

/* цена и кнопка прилипают к низу экрана, пока форма длиннее окна */
.submit-bar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  margin: 4px -22px 0; padding: 16px 22px 18px;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}
.estimate { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.estimate-label { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.estimate b { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.estimate small { color: var(--muted); font-size: 12.5px; }

/* --- лента заданий --- */
.feed-head { margin-bottom: 14px; }
.jobs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.jobs-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.empty-state {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 72px 24px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--muted);
}
.empty-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h3 { margin-top: 6px; font-size: 18px; color: var(--text); }
.empty-state p { margin: 0; max-width: 380px; }

.job { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.job-media { position: relative; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.job-media video { display: block; width: 100%; height: auto; background: #000; }
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--border); }
.media-grid.single { grid-template-columns: 1fr; }
.media-item { position: relative; background: var(--surface-2); }
/* картинка во всю ширину в своих пропорциях; выше 9:16 вписана, по бокам её размытая копия */
.media-open { display: block; position: relative; overflow: hidden; }
.media-item img { position: relative; display: block; width: 100%; height: auto; object-fit: contain; }
.media-item.tall .media-open::before {
  content: ""; position: absolute; inset: -40px; background: var(--img) center / cover; filter: blur(28px) brightness(.85);
}
/* значки под картинкой и видео: слева сердечко, справа остальное */
.media-bar { position: relative; display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: var(--surface); }
.media-tools { display: flex; gap: 2px; margin-left: auto; }
/* озвучка: плеер во всю ширину, под ним те же значки */
.tts-media .tts-audio { display: block; width: calc(100% - 24px); margin: 14px 12px 8px; }
.tts-media .music-pending { border-radius: 0; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; padding: 0; border-radius: 10px;
  background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.fav.on { color: #e5484d; }
.icon-btn.fav.on svg { fill: currentColor; }
.fav-filter { display: inline-flex; align-items: center; gap: 6px; }
.fav-filter svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.fav-filter.active svg { fill: #e5484d; stroke: #e5484d; }
.upscale-panel {
  display: grid; gap: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.upscale-panel .field { margin-bottom: 0; }
.upscale-panel .switch { margin-bottom: 0; }
.upscale-head { display: flex; align-items: center; justify-content: space-between; }
.upscale-fields { display: grid; gap: 12px; }
.upscale-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.upscale-price { display: grid; gap: 2px; }
.upscale-price b { font-size: 22px; font-weight: 720; font-variant-numeric: tabular-nums; }
.use-menu {
  position: fixed; z-index: 50; display: grid; gap: 2px; min-width: 220px; padding: 4px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.use-menu button {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; background: none;
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.use-menu button:hover, .use-menu button:focus-visible { background: var(--surface-2); outline: none; }
.use-menu svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.use-menu span { display: grid; }
.use-menu b { font-size: 14px; font-weight: 650; white-space: nowrap; }
.use-menu small { font-size: 12px; color: var(--muted); }
.media-pending {
  display: grid; place-items: center; align-content: center; gap: 6px; min-height: 150px;
  color: var(--muted); font-size: 13.5px;
  background: linear-gradient(110deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.8s linear infinite;
}
.pending-label { color: var(--text); font-weight: 600; }
.pending-note { font-size: 12.5px; color: var(--muted); }
/* ждущее задание: почему ждёт и кнопка «Отменить» (aigen/job_queue.py) */
.pending-hint { font-size: 12px; color: var(--muted); text-align: center; max-width: 36ch; padding: 0 12px; }
.job-foot .job-cancel { margin-left: auto; }
.tick { font-variant-numeric: tabular-nums; }
.media-pending .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0; background: transparent; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.media-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.job-body { display: grid; gap: 10px; padding: 14px 16px 16px; }
.job-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.job-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; min-width: 0; }
.job-title svg { flex: none; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.job-price { margin-left: auto; font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-price.est { color: var(--muted); font-weight: 650; }
.job-price.zero { color: var(--muted); font-size: 13px; font-weight: 550; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--err-soft); color: var(--err); }
.badge.active { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.job-prompt {
  margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.job-prompt.open { -webkit-line-clamp: unset; }
/* озвучка ElevenLabs: текст в три строки, у остальных карточек в две (Александр, 30.10.2026) */
.tts-job .job-prompt:not(.open) { -webkit-line-clamp: 3; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip-user { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.refs-row { display: flex; flex-wrap: wrap; gap: 6px; }
.refs-row a { display: block; border-radius: 6px; cursor: zoom-in; }
.refs-row a:focus-visible { outline: none; box-shadow: var(--ring); }
.refs-row img, .refs-row .ref-file { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); transition: border-color .15s; }
.refs-row .ref-file { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.refs-row .ref-file svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.refs-row a:hover img, .refs-row a:hover .ref-file { border-color: var(--accent); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .6s ease; }
.progress.indeterminate > i { width: 30%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.job-error { background: var(--err-soft); color: var(--err); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13.5px; }
.job-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px;
  padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted);
}
.job-foot .btn { margin-left: auto; }
.render-box { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.render-box .btn { margin-left: 0; }
.render-until { font-size: 12px; color: var(--muted); }
.render-error { color: var(--err); }

.pager { display: flex; gap: 10px; justify-content: center; margin: 28px 0 0; }

/* --- музыка: форма --- */
.field-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.field-actions .muted { font-weight: 500; }
.tool-panel {
  display: grid; gap: 10px; padding: 14px; margin-top: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.tool-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tool-row .segmented button { padding: 6px 12px; font-size: 13px; }
.variants { display: grid; gap: 10px; }
.variants:empty { display: none; }
.variant { display: grid; gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.variant-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.variant pre {
  margin: 0; max-height: 150px; overflow: auto; white-space: pre-wrap; font: 13px/1.5 var(--font); color: var(--muted);
}

/* --- музыка: карточка и плеер --- */
.music-pending {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 22px 16px 26px; overflow: hidden;
  border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13.5px;
}
.music-pending .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0; background: transparent; }
.tracks { display: grid; gap: 4px; }
.track {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 4px 12px;
  padding: 8px; margin: 0 -8px; border-radius: 12px; transition: background .15s;
  container: track / inline-size;
}
.track:hover, .track.playing { background: var(--surface-2); }
.track-cover { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.track-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-empty { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.cover-empty svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.track-play {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  background: rgba(20, 20, 18, .28); color: #fff; opacity: 0; transition: opacity .15s;
}
.track:hover .track-play, .track.playing .track-play, .track-play:focus-visible { opacity: 1; }
.track-play svg { width: 26px; height: 26px; fill: currentColor; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.track-main { display: grid; gap: 2px; min-width: 0; }
.track-title {
  font-weight: 650; line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.track-tags { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-wave { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.wave { flex: 1; min-width: 0; height: 30px; cursor: pointer; }
.track-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* строка значков под треком (static/js/app.js, mediaBar с классом track-bar): во всю ширину трека, на его фоне;
   «Действия» и «Текст» короткими словами. В узкой карточке (история и генератор у окна около 1000–1200 px) значки
   и отступы меньше, чтобы всё стояло в одну строку; на телефоне значки 28 px (правило .media-bar ниже) */
.track-bar { grid-column: 1 / -1; margin: 0 -6px -4px; padding: 0; background: none; }
.track-bar .btn { padding: 6px 9px; }
.track-bar .media-tools { align-items: center; }
.track:hover .track-bar :is(.icon-btn, .btn):hover, .track.playing .track-bar :is(.icon-btn, .btn):hover { background: var(--border); }
@container track (max-width: 330px) {
  .track-bar { gap: 2px; }
  .track-bar .icon-btn { width: 30px; height: 30px; }
  .track-bar .btn { padding: 6px 5px; }
}
@container track (max-width: 280px) {
  .track-bar .icon-btn { width: 28px; height: 28px; }
  .track-bar .btn { padding: 6px 4px; font-size: 12.5px; }
  .track-bar .media-tools { gap: 0; }
}
.track-lyrics {
  grid-column: 1 / -1; margin: 6px 0 4px; padding: 12px 14px; max-height: 320px; overflow: auto;
  white-space: pre-wrap; font: 13.5px/1.6 var(--font); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.music-job .job-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-job .job-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* в истории карточка с музыкой шире: плееру нужно место под волну */
@media (min-width: 1100px) {
  .jobs-grid .music-job { grid-column: span 2; }
}

/* --- расходы --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px 20px; }
.stat span { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; margin-top: 6px; font-size: 28px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.table-card { margin-top: 16px; }
.table-card h2 { margin-bottom: 14px; }
.month-form input[type="month"] { width: auto; padding: 8px 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td { font-weight: 700; border-bottom: 0; }

/* --- адаптивность --- */
@media (max-width: 1040px) {
  .layout, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .form-card { max-width: 640px; }
}
@media (max-width: 640px) {
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { padding: 6px 11px; }
  .nav-badge { display: none; }
  .user { display: none; }
  .page { padding: 20px 16px 40px; }
  h1 { font-size: 24px; }
  .page-head { margin-bottom: 16px; }
  .card { padding: 18px; }
  .form-card { padding: 18px 18px 0; }
  .submit-bar { margin: 4px -18px 0; padding: 14px 18px 16px; }
  .estimate b { font-size: 22px; }
  .btn-lg { padding: 12px 22px; }
  .jobs, .jobs-grid { grid-template-columns: minmax(0, 1fr); }
  .empty-state { padding: 48px 20px; }
  .segmented-lg button { padding: 9px 8px; font-size: 14px; gap: 6px; }
  .segmented-lg svg { width: 16px; height: 16px; }
  .track { grid-template-columns: 56px minmax(0, 1fr); }
  .track-cover { width: 56px; height: 56px; }
}

/* общая форма: поля из описания параметров модели */
.field > .switch { margin-bottom: 0; }
.field > .hint[hidden] { display: none; }
.segmented-wrap { flex-wrap: wrap; }
.segmented-wrap button { flex: 1 1 40%; white-space: normal; text-align: center; }

/* голосовой ввод в поле промпта */
.prompt-wrap { position: relative; }
.prompt-wrap textarea { width: 100%; padding-right: 48px; }
.mic-btn {
  position: absolute; right: 8px; bottom: 10px; width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--muted);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.mic-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mic-btn:hover { color: var(--accent); border-color: var(--accent); }
.mic-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.mic-btn.recording { background: var(--accent); border-color: var(--accent); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-btn.busy { opacity: .6; cursor: progress; }
.mic-btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.mic-status { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.mic-status[hidden] { display: none; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .mic-btn.recording { animation: none; } }
.seed-row { display: flex; gap: 8px; align-items: center; }
.seed-row input { flex: 1; min-width: 0; }
.thumb-file { display: flex; align-items: center; justify-content: center; width: 120px; padding: 6px 6px 20px; background: var(--surface-2); }
.thumb-name { font-size: 11px; line-height: 1.25; text-align: center; word-break: break-all; overflow: hidden; max-height: 42px; }
.more-settings { margin: -4px 0 20px; border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; }
.more-settings > summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.more-settings > summary::-webkit-details-marker { display: none; }
.more-settings > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.more-settings[open] > summary::before { transform: rotate(45deg); }
.more-settings[open] > summary { margin-bottom: 4px; }

/* действия с треком Suno (static/js/music-actions.js) */
.track-title .chip { margin-left: 8px; vertical-align: 1px; }
.music-actions {
  grid-column: 1 / -1; display: grid; gap: 12px; margin: 6px 0 4px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.music-actions .field { margin-bottom: 0; }
.music-actions .alert { margin: 0; }
.action-group { display: grid; gap: 6px; }
.action-list { display: flex; flex-wrap: wrap; gap: 6px; }
.music-action-form { display: grid; gap: 12px; }
.music-action-form .hint { margin: 0; }
.music-versions ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.music-versions li { display: grid; gap: 4px; padding-left: 10px; border-left: 2px solid var(--border); }
.music-versions li.current { border-left-color: var(--accent); }
.music-versions audio { width: 100%; height: 32px; }
.version-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-title { font-weight: 600; }
.music-files { display: flex; flex-wrap: wrap; gap: 8px; }
.music-action-form .seed-row { flex-wrap: wrap; }
.music-action-form .seed-row input { flex: 1 1 90px; }
.music-action-form .seed-row .muted { font-size: 12.5px; }

/* выбор модели: кнопка и раскрывающийся список по семействам */
.model-picker { position: relative; }
.picker-button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.picker-button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.picker-button:focus-visible, .picker-button[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.picker-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.picker-main .model-name, .model-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-note { font-size: 12.5px; color: var(--muted); }
.picker-button .model-price, .picker-option .model-price { flex: none; }
.picker-arrow {
  flex: none; width: 8px; height: 8px; margin: -4px 2px 0 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
.picker-button[aria-expanded="true"] .picker-arrow { transform: rotate(-135deg); margin-top: 4px; }
.picker-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: min(440px, 62vh); overflow-y: auto;
  overscroll-behavior: contain; padding: 6px; background: var(--raised, var(--surface)); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 14px 36px rgba(30, 25, 15, .16);
}
.picker-menu:focus { outline: none; }
.picker-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.picker-option { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.picker-option.active { background: var(--surface-2); }
.picker-option[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.picker-option .model-name { font-size: 14.5px; }

/* Suno, этап 3: своё аудио, голоса, выбор других треков */
.music-tools { display: grid; gap: 10px; margin-top: 18px; }
.music-tools .more-settings { margin: 0; }
.music-tools .music-action-form { padding-bottom: 14px; }
.track-picker { display: grid; gap: 4px; max-height: 240px; overflow-y: auto; }
.track-pick { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.track-pick:hover { background: var(--surface-2); }
.track-pick input { width: auto; }
.voice-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.music-voices { padding-bottom: 14px; display: grid; gap: 10px; }
.music-action-form audio { width: 100%; height: 36px; }

/* --- чат (static/js/chat.js) --- */
.chat-page { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; height: calc(100dvh - var(--topbar-h, 61px)); }
.chat-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 18px 0; }
.chat-new { justify-content: center; gap: 8px; }
.chat-new svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chat-list { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 2px; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.chat-list-empty { margin: 0; padding: 8px 12px; color: var(--muted); font-size: 13.5px; }
.chat-item {
  display: flex; align-items: center; gap: 6px; padding: 7px 6px 7px 12px; border-radius: 10px;
  color: var(--muted); font-size: 14px; cursor: pointer;
}
.chat-item:hover, .chat-item:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.chat-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.chat-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-del {
  display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer; opacity: 0;
}
.chat-item:hover .chat-item-del, .chat-item.active .chat-item-del, .chat-item-del:focus-visible, .chat-item-del.confirm { opacity: 1; }
.chat-item-del:hover, .chat-item-del.confirm { color: var(--err); background: var(--err-soft); }
.chat-item-del.confirm { font-size: 12px; font-weight: 650; }
.chat-item-del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-bar { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; }
.chat-side-toggle { display: none; }
#chat-settings-btn { margin-left: auto; }
.chat-model { position: relative; min-width: 0; }
.model-btn {
  display: flex; align-items: center; gap: 16px; max-width: 100%; padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.model-btn:hover, .model-btn[aria-expanded="true"] { background: var(--surface-2); }
.model-btn > svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.model-btn-name { display: grid; min-width: 0; line-height: 1.25; }
.model-btn-name b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-btn-name small { color: var(--muted); font-size: 12px; }
.meters { display: inline-flex; align-items: center; gap: 12px; }
.meter { display: grid; gap: 3px; }
.meter small { color: var(--muted); font-size: 10.5px; line-height: 1; }
.meter-dots { display: inline-flex; align-items: center; gap: 3px; height: 12px; }
.meter-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.meter-dots i.on { background: var(--accent); }
.model-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px;
  width: min(580px, calc(100vw - 24px)); max-height: min(72vh, 600px); padding: 8px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(20, 15, 5, .16);
}
.model-sorts { display: flex; width: 100%; }
.model-sorts button { flex: 1; padding: 6px 8px; font-size: 13px; }
.model-list { display: grid; gap: 2px; overflow-y: auto; }
.model-group { padding: 8px 10px 4px; color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.model-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.model-row:hover, .model-row:focus-visible { background: var(--surface-2); outline: none; }
.model-row.active { background: var(--accent-soft); }
.model-row-name { display: grid; gap: 1px; min-width: 0; }
.model-row-name b { font-weight: 650; }
.model-row-name small { color: var(--muted); font-size: 12.5px; }
.chat-settings { display: grid; gap: 12px; margin-bottom: 8px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.chat-settings .switch { align-items: flex-start; margin-bottom: 0; }
.chat-settings .switch small { display: block; font-weight: 450; }
.chat-settings .field { margin-bottom: 0; }
.chat-settings textarea { min-height: 72px; }

.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-thread { display: grid; gap: 22px; max-width: 780px; margin: 0 auto; padding: 12px 4px 24px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-bubble {
  max-width: 85%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 16px 16px 4px 16px;
  background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-assistant { display: grid; gap: 4px; }
.msg-meta { display: flex; align-items: center; gap: 8px; min-height: 36px; color: var(--muted); font-size: 12.5px; }
.msg-tools { display: flex; gap: 2px; margin-left: auto; }
.msg-error { margin-top: 8px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--err-soft); color: var(--err); font-size: 13.5px; }
.msg-thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dot-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: chat-pulse 1.2s ease-in-out infinite; }
@keyframes chat-pulse { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.md { line-height: 1.62; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h3 { margin: 18px 0 8px; font-size: 18px; }
.md h4 { margin: 16px 0 6px; font-size: 16px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.md hr { margin: 16px 0; border: 0; border-top: 1px solid var(--border); }
.md a { color: var(--accent); }
.md code { padding: 1px 5px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; }
.md-code { margin: 0 0 12px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.md-code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.md-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.5; }
.md-code pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.md-copy { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.md-copy:hover { background: var(--surface); color: var(--text); }
.md-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.md-table { margin: 0 0 12px; overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; }
.md th, .md td { padding: 6px 10px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); }
.chat-empty { display: grid; justify-items: center; gap: 10px; padding: 7vh 12px 20px; text-align: center; }
.chat-empty h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.chat-empty p { max-width: 460px; margin: 0 0 12px; }
.chat-suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 620px; }
.chip-btn {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.chip-btn:hover { background: var(--surface-2); }

.chat-composer { padding: 6px 0 12px; }
.chat-input-box {
  display: flex; align-items: flex-end; gap: 8px; max-width: 780px; margin: 0 auto; padding: 7px 7px 7px 14px;
  border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.chat-input-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.chat-input-box textarea, .chat-input-box textarea:focus {
  flex: 1; min-height: 24px; max-height: 40vh; padding: 7px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  font: inherit; font-size: 15px; line-height: 1.5; resize: none;
}
.chat-send {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); cursor: pointer;
}
.chat-send svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chat-send.stop { background: var(--text); color: var(--surface); }
.chat-send.stop svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.chat-hint { max-width: 780px; margin: 6px auto 0; color: var(--muted); font-size: 12px; text-align: center; }
.chat-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px;
  border-radius: 12px; background: var(--text); color: var(--surface); font-size: 14px; transform: translateX(-50%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
@media (max-width: 900px) {
  .chat-page { padding: 0 12px; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .chat-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; width: min(300px, 84vw); padding: 16px;
    background: var(--surface); border-right: 1px solid var(--border); transform: translateX(-102%); transition: transform .2s;
  }
  .chat-side.open { transform: none; }
  .chat-side-shade { position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .35); }
  .chat-side-toggle { display: grid; }
  .chat-item-del { opacity: 1; }
  .model-row .meters { gap: 8px; }
  .chat-suggest { grid-template-columns: minmax(0, 1fr); }
  .chat-empty { padding-top: 4vh; }
}

/* --- студия предметки (static/js/studio.js): узлы слева направо, как в нодовом редакторе --- */
.studio-page { max-width: 1800px; }
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.studio-head p { max-width: 560px; margin: 6px 0 0; }
.studio-sessions { display: flex; gap: 8px; flex-wrap: wrap; }
.studio-thumb {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0; overflow: hidden; border: 1px solid var(--border);
  border-radius: 12px; background: #fff; color: var(--muted); font-size: 24px; cursor: pointer;
}
.studio-thumb img { width: 100%; height: 100%; object-fit: contain; }
.studio-thumb.active { box-shadow: 0 0 0 2px var(--accent); }
.studio-thumb-new { background: var(--surface); }
.studio-thumb-new:hover { background: var(--surface-2); color: var(--text); }
.studio-flow {
  display: flex; align-items: flex-start; overflow-x: auto; min-height: 560px; padding: 28px 24px;
  border: 1px solid var(--border); border-radius: 18px; background-color: var(--surface-2);
  background-image: radial-gradient(color-mix(in srgb, var(--border-strong) 80%, transparent) 1px, transparent 1.4px);
  background-size: 20px 20px;
}
.node {
  flex: 0 0 210px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  box-shadow: 0 6px 18px rgba(20, 15, 5, .07); transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.node-wide { flex-basis: 260px; }
.node-results { flex: 1 0 330px; }
.node[data-state="idle"] { opacity: .7; }
.node[data-state="active"], .node[data-state="running"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 18px rgba(20, 15, 5, .07); }
.node-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.node-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.node-num { color: var(--muted); font-size: 12px; font-weight: 700; }
.node-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.node[data-state="active"] .node-dot { background: var(--accent); }
.node[data-state="running"] .node-dot { background: var(--accent); animation: chat-pulse 1.2s ease-in-out infinite; }
.node[data-state="done"] .node-dot { background: #2f9e5b; }
.node[data-state="failed"] .node-dot { background: var(--err); }
/* minmax(0, 1fr): содержимое не раздвигает узел шире его карточки, а ужимается в неё */
.node-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
.node-body > p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.node-body .switch { margin-bottom: 0; font-size: 13.5px; }
.node-body .field { margin-bottom: 0; }
.node-body textarea { min-height: 88px; }
/* связь между узлами: стрелка, после готового узла она цветная */
.node-link { position: relative; flex: 0 0 28px; height: 2px; margin-top: 21px; background: var(--border-strong); }
.node-link::after {
  content: ""; position: absolute; right: -2px; top: -5px; border-style: solid; border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent var(--border-strong);
}
.node[data-state="done"] + .node-link, .node[data-state="off"] + .node-link { background: var(--accent); }
.node[data-state="done"] + .node-link::after, .node[data-state="off"] + .node-link::after { border-left-color: var(--accent); }
/* шесть узлов в строку влезают от ~1740 px; уже доска в две строки (1–4 и 5–6), вбок не прокручивается */
@media (min-width: 901px) and (max-width: 1760px) {
  .studio-flow { flex-wrap: wrap; row-gap: 14px; }
  .node-link-break { flex-basis: 100%; height: 0; margin: 0; }
  .node-link-break::before { content: ""; position: absolute; left: -24px; top: 35px; width: 16px; height: 2px; background: var(--border-strong); }
  .node-link-break::after { left: -8px; right: auto; top: 30px; }
  .node[data-state="done"] + .node-link-break::before, .node[data-state="off"] + .node-link-break::before { background: var(--accent); }
}
.node-img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.studio-drop {
  display: grid; justify-items: center; gap: 6px; padding: 22px 12px; border: 2px dashed var(--border-strong);
  border-radius: 12px; background: var(--surface-2); text-align: center; font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s;
}
.studio-drop small { font-size: 12px; }
.studio-drop:hover, .studio-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.studio-drop-text b { color: var(--accent); }
.studio-wait { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-size: 13.5px; }
.studio-canvas { position: relative; }
.studio-cut-inset {
  position: absolute; left: 8px; bottom: 8px; width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.studio-range input { width: 100%; accent-color: var(--accent); }
.studio-range .label { font-size: 12px; }
.studio-range .hint { font-size: 12px; }
.studio-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-modes { display: flex; width: 100%; }
.studio-modes button { flex: 1; padding: 6px 8px; font-size: 13px; }
.studio-modes.segmented-wrap button { flex: 1 1 40%; }
.studio-swatches { display: flex; align-items: center; gap: 8px; }
.studio-swatch { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; cursor: pointer; }
.studio-swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.studio-swatches input[type="color"] { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 50%; background: none; cursor: pointer; }
.studio-presets .chip-btn { padding: 6px 9px; font-size: 12.5px; }
.studio-run { display: grid; gap: 8px; }
.studio-run + .studio-run { padding-top: 12px; border-top: 1px solid var(--border); }
.studio-run-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.studio-variants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.studio-variants.single { grid-template-columns: minmax(0, 1fr); max-width: 320px; }
.studio-variants figure { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; }
.studio-variants img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.studio-variants figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .studio-flow { flex-direction: column; align-items: stretch; min-height: 0; padding: 14px; overflow: visible; }
  .node, .node-wide, .node-results { flex: none; }
  .node-link { flex: none; width: 2px; height: 26px; margin: 0 0 0 24px; }
  .node-link::after { right: -5px; top: auto; bottom: -2px; border-width: 8px 6px 0 6px; border-color: var(--border-strong) transparent transparent transparent; }
  .node[data-state="done"] + .node-link::after, .node[data-state="off"] + .node-link::after { border-left-color: transparent; border-top-color: var(--accent); }
  .studio-variants { grid-template-columns: minmax(0, 1fr); }
}

/* --- обратная связь (static/js/feedback.js) --- */
.feedback-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 560; cursor: pointer; white-space: nowrap;
}
.feedback-btn:hover { background: var(--surface-2); }
.feedback-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.feedback {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 20px; border: 1px solid var(--border);
  border-radius: 18px; background: var(--raised); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.feedback::backdrop { background: rgba(20, 16, 10, .45); }
.feedback-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.feedback-head h2 { margin: 0; font-size: 20px; }
.feedback-head svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.feedback-form { display: grid; gap: 12px; }
.feedback-form > p { margin: 0; }
.feedback-text { position: relative; }
.feedback-text textarea { width: 100%; min-height: 130px; padding-right: 52px; }
.feedback-text .mic-btn { position: absolute; right: 8px; bottom: 10px; }
.feedback-shots { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-shots:empty { display: none; }
.feedback-shot { position: relative; width: 84px; height: 84px; }
.feedback-shot img { width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--border); border-radius: 10px; }
.feedback-shot-del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: var(--text); color: var(--surface); font-size: 15px; line-height: 22px; cursor: pointer;
}
.feedback-attach { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feedback-attach label { cursor: pointer; }
.feedback-status { margin: 0; color: var(--muted); font-size: 13.5px; }
.feedback-status.error, .mic-status.error { color: var(--err); }
.feedback-actions { display: flex; justify-content: flex-end; }
.feedback-done { display: grid; justify-items: center; gap: 10px; padding: 34px 0 20px; font-size: 17px; }
.feedback-done svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--accent-soft); fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) {
  .feedback-btn span { display: none; }
  .feedback-btn { padding: 6px 9px; }
}

/* --- SMM-студия (static/js/smm.js): узлы как у студии предметки --- */
.smm-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.smm-thumbs:empty { display: none; }
.smm-thumb { position: relative; display: grid; gap: 2px; margin: 0; }
.smm-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.smm-thumb figcaption { color: var(--muted); font-size: 11px; text-align: center; }
.smm-logo { height: 22px; margin-left: 6px; vertical-align: middle; border-radius: 4px; background: #fff; }
.node-body select, .node-body input[type="text"] { width: 100%; }
.smm-plan { display: grid; gap: 10px; font-size: 13.5px; }
.smm-plan > p { margin: 0; }
.smm-scenes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.smm-scenes li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start; }
.smm-scenes li > div { display: grid; gap: 2px; }
.smm-scenes small, .smm-variant small { color: var(--muted); font-size: 12px; }
.smm-scene-photo {
  display: grid; place-items: center; width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 11px;
}
.smm-onscreen { font-weight: 600; }
.smm-variants { display: grid; gap: 10px; }
.smm-variant { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.smm-variant p { margin: 2px 0; }
.smm-headline { font-size: 15px; font-weight: 700; }

/* --- раскрывающийся пункт меню «SMM-студия» (base.html, static/js/menu.js) --- */
.nav-menu { position: relative; }
.nav-menu > summary {
  display: flex; align-items: center; gap: 4px; padding: 7px 10px 7px 14px; border-radius: 9px; color: var(--muted);
  font-weight: 560; font-size: 14.5px; white-space: nowrap; list-style: none; cursor: pointer;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary:hover, .nav-menu[open] > summary { color: var(--text); background: var(--surface-2); }
.nav-menu > summary.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.nav-menu[open] .chevron { transform: rotate(180deg); }
.nav-pop {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 40; display: grid; gap: 2px; min-width: 250px; padding: 6px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 15, 5, .14);
}
.nav .nav-pop a { display: grid; gap: 1px; padding: 9px 12px; white-space: normal; }
.nav-pop a b { color: var(--text); font-weight: 650; }
.nav-pop a small { color: var(--muted); font-size: 12.5px; font-weight: 450; }
.nav .nav-narrow { display: none; }
@media (max-width: 640px) {
  .nav-menu { display: none; }
  .nav .nav-narrow { display: block; }
}

/* --- SMM-студия: образец и карусель --- */
.smm-eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.studio-head .smm-eyebrow { margin: 0 0 2px; }
.node-opt { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.smm-ref { display: grid; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.smm-ref p { margin: 0; }
.smm-frames { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.smm-frames figure { flex: none; display: grid; gap: 2px; margin: 0; }
.smm-frames img { width: 64px; height: 88px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.smm-frames figcaption { color: var(--muted); font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.smm-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.smm-chip { padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.smm-palette { display: flex; gap: 6px; }
.smm-palette span { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); }
.smm-list { margin: 2px 0 0; padding-left: 18px; }
.smm-list li { margin: 1px 0; }
.smm-more { display: grid; gap: 8px; }
.smm-more > summary { color: var(--accent); cursor: pointer; font-weight: 600; }
.smm-more[open] > summary { margin-bottom: 6px; }
.smm-more > *:not(summary) { margin: 0 0 8px; }
.smm-ref-pick { display: grid; gap: 6px; }
/* «Заменить образец» и «Убрать образец» вверху шага, крестик у образца в списке (01.11.2026) */
.smm-ref-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.smm-ref-item { position: relative; display: inline-grid; }
.smm-ref-item:hover .smm-draft-del { opacity: 1; }
.smm-ref-drop { min-height: 64px; }
/* «Из сгенерированных» и «Из загруженных» (static/js/pick-photos.js) */
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pick-row svg { width: 16px; height: 16px; margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.pick-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pick-dialog::backdrop { background: rgba(20, 18, 15, .45); }
.pick-head, .pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.pick-head h2 { margin: 0; font-size: 17px; }
.pick-foot { border-top: 1px solid var(--border); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px 18px 14px; }
.pick-item { aspect-ratio: 1; padding: 0; overflow: hidden; border: 3px solid transparent; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.pick-item img, .pick-item video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.pick-item.picked { border-color: var(--accent); }
.pick-item:focus-visible { outline: none; box-shadow: var(--ring); }
/* материалы: ссылка, файлы, текст о товаре (aigen/materials.py) */
.smm-source { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.smm-source summary { cursor: pointer; line-height: 1.4; }
.smm-source[open] summary { margin-bottom: 12px; }
.smm-source .field { margin-bottom: 12px; }
.smm-source input[type=url], .smm-source textarea { width: 100%; }
.smm-docs-btn { justify-self: start; }
.smm-material { display: grid; gap: 10px; margin: 12px 0 8px; }
.smm-material textarea { width: 100%; }
.smm-material-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.smm-material-image { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; }
.smm-material-image img { width: 100%; height: 100%; object-fit: cover; }
.smm-material-image input { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; accent-color: var(--accent); }
.smm-notes-view { white-space: pre-line; margin: 0; font-size: 14px; }
/* под вырезанным товаром шахматка, как в редакторах: видно, где прозрачно (Александр, 29.10.2026) */
.studio-stage { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 12px; cursor: grab; touch-action: none; user-select: none;
  background: repeating-conic-gradient(#d6d6d6 0% 25%, #fff 0% 50%) 0 0 / 20px 20px; }
.studio-stage.dragging { cursor: grabbing; }
.studio-stage-cut { position: absolute; max-width: none; pointer-events: none; transform-origin: 50% 50%; }
.studio-stage-band { position: absolute; top: 0; bottom: 0; left: 12.5%; right: 12.5%; border-left: 2px dashed rgba(0, 0, 0, .35); border-right: 2px dashed rgba(0, 0, 0, .35); pointer-events: none; }
.studio-stage-band small { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 11px; white-space: nowrap; }
.studio-stage-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-warn { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft, #fbefd9); color: var(--warn, #a15c07); font-size: 13.5px; }
/* видеообложка студии предметки (aigen/studio_cover.py) */
#cover-body input[type=text] { width: 100%; }
#cover-body .field > input + input { margin-top: 6px; }
.cover-video { display: block; width: 100%; max-width: 320px; margin-top: 14px; border-radius: 14px; background: #000; }
.cover-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.smm-video { display: block; width: 100%; max-width: 360px; aspect-ratio: 9 / 16; margin-top: 14px; border-radius: 14px; background: #000; }
.smm-video-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.smm-error { color: var(--err); margin-top: 10px; }
.smm-caption { padding: 10px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; white-space: pre-line; }

/* --- SMM-студия: полоса шагов сверху и один шаг во всю ширину (templates/smm.html, static/js/smm.js, 30.10.2026) --- */
.smm-studio { max-width: 1040px; margin: 0 auto; }
/* SMM-студия не прилипает к краям на ноутбуке и планшете (30.10.2026) */
@media (min-width: 900px) { .smm-studio { padding-inline: 24px; } }
.smm-steps {
  position: relative; display: flex; gap: 2px; margin: 0 0 14px; padding: 6px; list-style: none; overflow-x: auto;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm);
  scrollbar-width: thin; scroll-margin-top: 76px;
}
.smm-steps > li { flex: 1 1 0; min-width: 158px; display: flex; align-items: center; }
/* стрелка между шагами */
.smm-steps > li + li::before {
  content: ""; flex: none; width: 6px; height: 6px; margin: 0 7px 0 3px; border: solid var(--border-strong);
  border-width: 1.6px 1.6px 0 0; transform: rotate(45deg);
}
.smm-step {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 11px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s, color .15s;
}
.smm-step:hover { background: var(--surface-2); }
.smm-step:focus-visible { outline: none; box-shadow: var(--ring); }
.smm-step[aria-current="step"] { background: var(--accent-soft); }
.smm-step-num {
  position: relative; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1.5px solid var(--border-strong);
  border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.smm-step-text { display: grid; min-width: 0; line-height: 1.3; }
.smm-step-title { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smm-step-sum { display: block; min-height: 1.3em; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* состояния из mark(): нужно сделать, готов, идёт работа, ещё рано, необязательный; открытый шаг залит акцентом */
.smm-step[data-state="active"] .smm-step-num { border-color: var(--accent); color: var(--accent); }
.smm-step[data-state="done"] .smm-step-num { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.smm-step[data-state="done"] .smm-step-num::after {
  content: "✓"; position: absolute; right: -6px; bottom: -5px; display: grid; place-items: center; width: 15px; height: 15px;
  border-radius: 50%; background: var(--ok); color: var(--surface); box-shadow: 0 0 0 2px var(--surface); font-size: 9.5px; font-weight: 800; line-height: 1;
}
.smm-step[data-state="running"] .smm-step-num { border-color: var(--accent); color: var(--accent); }
.smm-step[data-state="running"] .smm-step-num::after {
  content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface); animation: chat-pulse 1.2s ease-in-out infinite;
}
.smm-step[data-state="off"] .smm-step-num { border-style: dashed; }
.smm-step[data-state="idle"]:not([aria-current]) { color: var(--muted); }
.smm-step[data-state="idle"]:not([aria-current]) .smm-step-num { opacity: .75; }
.smm-step[aria-current="step"] .smm-step-num { border-color: var(--accent); border-style: solid; background: var(--accent); color: var(--accent-text); opacity: 1; }
.smm-step[aria-current="step"] .smm-step-num::after { box-shadow: 0 0 0 2px var(--accent-soft); }
/* область шага */
.smm-stage { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.smm-panel { padding: 24px 28px 28px; }
.smm-panel[hidden] { display: none; }
.smm-panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 20px; }
.smm-panel-head h2 { margin: 0; font-size: 21px; font-weight: 680; letter-spacing: -.01em; }
.smm-panel-num {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: 14px; font-weight: 700;
}
.smm-panel-head .node-opt { margin-left: 0; padding: 2px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-2); font-size: 12px; }
.smm-panel .node-body { gap: 16px; padding: 0; }
.smm-panel .node-body > p { font-size: 14px; }
.smm-panel .node-body > .btn, .smm-panel .node-body > .studio-wait { justify-self: start; }
.smm-panel .studio-modes button { padding: 8px 10px; font-size: 14px; }
/* 1. материалы: фото сеткой, о товаре карточкой с полями нормальной ширины */
#files-body .studio-drop { padding: 30px 16px; }
.smm-panel .pick-row { margin-top: -4px; }
.smm-panel .smm-thumbs { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.smm-panel .smm-thumb img { border-radius: 10px; }
.smm-panel .smm-thumb figcaption { font-size: 12px; }
.smm-panel .smm-source { margin-top: 0; padding: 14px 18px; border: 1px solid var(--border); }
.smm-source-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.smm-source-row .field { align-content: start; }
.smm-panel .smm-material-images { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
/* 2. задача: настройки слева, тексты справа */
.smm-task { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px 32px; align-items: start; }
.smm-task-opts, .smm-task-text { display: grid; gap: 18px; align-content: start; min-width: 0; }
/* 3–4. образец и дизайн-код: читаемая ширина */
#ref-body { max-width: 820px; }
#brand-body { max-width: 560px; }
/* 5. варианты, слайды и сценарий карточками в несколько колонок */
.smm-panel .smm-variants { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.smm-panel .smm-variant { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 14px; }
.smm-panel .smm-variant .smm-scene-photo { width: 96px; height: 96px; border-radius: 10px; }
.smm-panel .smm-plan { font-size: 14px; }
.smm-panel .smm-scenes { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 24px; }
.smm-panel .smm-scenes li { grid-template-columns: 64px minmax(0, 1fr); }
.smm-panel .smm-scenes .smm-scene-photo { width: 64px; height: 64px; }
.smm-panel .smm-caption, .smm-panel .smm-music { max-width: 820px; }
/* 6. результат */
#result-body > .field { max-width: 820px; }
.smm-panel .smm-posts { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
/* «Назад» и «Дальше» под шагом */
.smm-pager {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px 28px;
  border-top: 1px solid var(--border); border-radius: 0 0 18px 18px; background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}
#smm-back { grid-column: 1; justify-self: start; }
.smm-pos { grid-column: 2; color: var(--muted); font-size: 13px; }
#smm-next { grid-column: 3; justify-self: end; }
.smm-pager .btn[hidden] { display: none; }
@media (max-width: 760px) {
  .smm-task { grid-template-columns: minmax(0, 1fr); }
  .smm-source-row { grid-template-columns: minmax(0, 1fr); }
}
/* телефон: полоса шагов компактная и прокручивается вбок, шаг во всю ширину */
@media (max-width: 640px) {
  .smm-steps { gap: 0; margin-bottom: 12px; padding: 4px; border-radius: 14px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .smm-steps::-webkit-scrollbar { display: none; }
  .smm-steps > li { flex: none; min-width: 0; scroll-snap-align: center; }
  .smm-steps > li + li::before { margin: 0 5px 0 2px; }
  .smm-step { gap: 8px; padding: 6px 10px 6px 6px; }
  .smm-step-num { width: 24px; height: 24px; font-size: 12px; }
  .smm-step-title { font-size: 13px; }
  .smm-step-sum { max-width: 118px; font-size: 11.5px; }
  .smm-stage { border-radius: 16px; }
  .smm-panel { padding: 18px 16px 20px; }
  .smm-panel-head { margin-bottom: 16px; }
  .smm-panel-head h2 { font-size: 19px; }
  .smm-panel-num { width: 26px; height: 26px; font-size: 13px; }
  .smm-panel .smm-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .smm-panel .smm-variants, .smm-panel .smm-scenes, .smm-panel .smm-posts { grid-template-columns: minmax(0, 1fr); }
  .smm-panel .smm-variant { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .smm-panel .smm-variant .smm-scene-photo { width: 72px; height: 72px; }
  .smm-pager { padding: 12px 16px; border-radius: 0 0 16px 16px; }
  .smm-pos { display: none; }
}

/* --- главная как Explore (aigen/home.py, templates/home.html) и быстрые инструменты (aigen/tools.py) --- */
.home { max-width: 1320px; }
/* цвет карточки без картинки: классы, а не style="" (CSP запрещает встроенные стили) */
.hue-0 { --h: 12; }
.hue-1 { --h: 28; }
.hue-2 { --h: 200; }
.hue-3 { --h: 160; }
.hue-4 { --h: 262; }
.hue-5 { --h: 340; }
.hue-6 { --h: 45; }
.hue-7 { --h: 290; }
.home-hero { position: relative; margin-bottom: 18px; }
.home-hero-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 22px; }
.home-hero-track::-webkit-scrollbar { display: none; }
.home-slide {
  position: relative; flex: 0 0 100%; min-height: 300px; display: flex; align-items: flex-end; overflow: hidden; scroll-snap-align: start;
  border-radius: 22px; color: #fff; text-decoration: none;
  background: linear-gradient(120deg, hsl(var(--h) 45% 22%), hsl(calc(var(--h) + 35) 55% 38%));
}
.home-slide img, .home-slide video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .home-slide video { display: none; } }
.home-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .62), rgba(0, 0, 0, .1) 70%); }
.home-slide-text { position: relative; z-index: 1; display: grid; justify-items: start; gap: 10px; max-width: 560px; padding: 32px 34px; }
.home-slide h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 760; letter-spacing: -0.02em; text-wrap: balance; }
.home-slide p { margin: 0; color: rgba(255, 255, 255, .86); font-size: 16px; }
.home-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.home-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.home-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: width .2s, background .2s; }
.home-dots button.active { width: 22px; background: var(--accent); }
.home-create { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 34px; }
.home-create a {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); font-weight: 620; text-decoration: none; transition: border-color .15s, transform .15s;
}
.home-create a:hover { border-color: var(--accent); transform: translateY(-1px); }
.home-create .home-icon { width: 22px; height: 22px; color: var(--accent); }
.home-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.home-section { margin-top: 34px; }
.home-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.home-section-head h2 { font-size: 21px; font-weight: 700; }
.home-section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.home-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.home-tool, .home-studio, .home-lesson { display: grid; gap: 4px; color: var(--text); text-decoration: none; }
.home-tool b, .home-studio b, .home-lesson b, .home-soon-card b { font-size: 15.5px; font-weight: 660; }
.home-tool > span, .home-studio span, .home-lesson span, .home-soon-card > span:last-child { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.home-tool small { display: block; margin-top: 2px; font-size: 12px; }
.home-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 8px; overflow: hidden; border-radius: 14px;
  background: linear-gradient(135deg, hsl(var(--h) 60% 90%), hsl(calc(var(--h) + 40) 55% 80%));
  color: hsl(var(--h) 45% 32%); transition: transform .2s;
}
.home-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.home-thumb .home-icon { width: 44px; height: 44px; stroke-width: 1.4; }
.home-tool:hover .home-thumb img, .home-studio:hover .home-thumb img { transform: scale(1.04); }
/* ролик в карточке инструмента (флаг video в home.py) лежит поверх постера; при «уменьшить движение» скрыт, виден постер (patch_home_upscale_video.py) */
.home-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.home-tool:hover .home-thumb video { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .home-thumb video { display: none; } }
.home-tool:hover b, .home-studio:hover b, .home-lesson:hover b { color: var(--accent); }
.home-badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(20, 18, 15, .62); color: #fff; font-size: 11.5px; font-weight: 600; }
.home-studios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-studio { grid-template-columns: 1fr; padding: 10px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.home-studio .home-thumb { aspect-ratio: 16 / 9; margin-bottom: 4px; }
.home-studio > div:last-child { display: grid; gap: 4px; padding: 4px 6px 6px; }
.home-soon { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-soon-card { display: grid; justify-items: start; gap: 6px; padding: 18px; border: 1px dashed var(--border-strong); border-radius: 16px; }
.home-soon-card .home-tag { background: var(--accent-soft); color: var(--accent); }
.home-lessons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-lesson { padding: 16px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.home-lesson small { color: var(--accent); font-size: 12px; font-weight: 650; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="grey"]) .home-thumb { background: linear-gradient(135deg, hsl(var(--h) 30% 22%), hsl(calc(var(--h) + 40) 30% 16%)); color: hsl(var(--h) 55% 72%); }
}
:root[data-theme="dark"] .home-thumb { background: linear-gradient(135deg, hsl(var(--h) 30% 22%), hsl(calc(var(--h) + 40) 30% 16%)); color: hsl(var(--h) 55% 72%); }
/* «Дизайн-код» в тёмной теме: фон карточки светлее страницы, чёрный кадра ролика смешивается с ним (patch_home_tool_card.py) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="grey"]) .home-tool-design .home-thumb { background: #26262b; }
  :root:not([data-theme="light"]):not([data-theme="grey"]) .home-tool-design .home-thumb img { mix-blend-mode: lighten; }
}
:root[data-theme="dark"] .home-tool-design .home-thumb { background: #26262b; }
:root[data-theme="dark"] .home-tool-design .home-thumb img { mix-blend-mode: lighten; }
@media (max-width: 900px) {
  .home-create { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-studios, .home-soon, .home-lessons { grid-template-columns: minmax(0, 1fr); }
  .home-slide { min-height: 260px; }
  .home-slide-text { padding: 22px 20px; }
  /* «Песни и звуки» на телефоне: ролик лежит под текстом, поэтому притемнён и сдвинут вправо (patch_home_music_slide.py) */
  .home-slide-music img, .home-slide-music video { object-position: 95% 50%; filter: brightness(.42) saturate(.85); }
  .home-slide-music::after { background: linear-gradient(90deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, .35)); }
  /* SMM-студия на телефоне: ролик лежит под текстом, поэтому притемнён и сдвинут вправо (patch_home_smm_slide.py) */
  .home-slide-smm img, .home-slide-smm video { object-position: 88% 50%; filter: brightness(.42) saturate(.85); }
  .home-slide-smm::after { background: linear-gradient(90deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, .35)); }
  /* дизайн-код на телефоне: ролик светлый и лежит под текстом, поэтому притемнён и сдвинут вправо (patch_home_mobile_dim.py) */
  .home-slide-design img, .home-slide-design video { object-position: 82% 50%; filter: brightness(.42) saturate(.85); }
  .home-slide-design::after { background: linear-gradient(90deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, .35)); }
}
@media (max-width: 520px) {
  .home-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
.lesson-back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 14px; }
.lesson-back:hover { color: var(--accent); }
.lesson-body { display: grid; justify-items: start; gap: 12px; max-width: 720px; }
.lesson-lead { margin: 0; font-size: 17px; color: var(--muted); }
.lesson-steps { display: grid; gap: 10px; margin: 6px 0; padding-left: 22px; font-size: 16px; line-height: 1.55; }
.lesson-tips { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.lesson-tips ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.tool-hint { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 14px; }
/* «Повторить»: что вернулось в форму и что не перенеслось (static/js/app.js, repeatNote) */
.repeat-note { display: grid; gap: 6px; justify-items: start; line-height: 1.45; scroll-margin-top: 130px; }
.repeat-note p { margin: 0; }
.repeat-lost { color: var(--muted); }
/* буфер обмена: надпись над значками после копирования, кнопка вставки под окном загрузки */
.media-tools { flex-wrap: wrap; justify-content: flex-end; }
.track { position: relative; }
.copy-note {
  position: absolute; right: 6px; bottom: calc(100% + 6px); z-index: 3; max-width: 240px; padding: 5px 9px;
  border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.35; pointer-events: none;
}
.copy-note.bad { background: #b42318; color: #fff; }
.paste-btn { justify-self: start; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tool-in { display: grid; gap: 12px; }
.tool-in .studio-drop { padding: 48px 16px; }
.studio-drop.busy { opacity: .7; pointer-events: none; }
.checker { background: repeating-conic-gradient(#d6d6d6 0% 25%, #fff 0% 50%) 0 0 / 20px 20px; }
.tool-result { display: grid; place-items: center; border-radius: 12px; overflow: hidden; }
.tool-result img { display: block; max-width: 100%; max-height: 560px; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0 0; }
.tool-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tool-recent a { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.tool-recent img { max-width: 100%; max-height: 100%; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
/* замена персонажа (templates/tool_swap.html, static/js/swap.js) */
.swap-video { display: grid; gap: 8px; }
.swap-video video { width: 100%; max-height: 320px; border-radius: 12px; background: #000; }
.swap-video-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); min-width: 0; }
.swap-video-meta span { min-width: 0; overflow-wrap: anywhere; }
.swap-options { display: flex; flex-wrap: wrap; gap: 0 18px; }
.swap-models { margin-bottom: 2px; }
#swap-model-text { margin: 0 0 4px; }
.swap-options .field { margin-bottom: 12px; }
.swap-go { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.swap-price { font-size: 14px; color: var(--muted); }
.swap-price b { color: var(--text); font-size: 16px; }
.tool-in .hint { margin: 0; }
.swap-status { margin-bottom: 12px; font-size: 14px; }
.swap-status:empty { display: none; }
.swap-empty h2 { margin: 0 0 10px; font-size: 18px; }
.swap-empty ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.tool-result video { display: block; max-width: 100%; max-height: 560px; border-radius: 12px; background: #000; }
.swap-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.swap-recent-item { display: grid; place-items: center; min-height: 120px; border-radius: 12px; overflow: hidden; background: var(--surface-2, var(--surface)); border: 1px solid var(--border); }
.swap-recent-item video { width: 100%; max-height: 300px; display: block; background: #000; }
.swap-recent-item p { margin: 0; padding: 12px; font-size: 13px; text-align: center; }
/* окно «Музыка к ролику» (static/js/music-pick.js) и музыка в SMM-ролике */
.music-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 4px 18px 16px; max-height: 64vh; overflow-y: auto; }
.music-body > *, .music-pane > * { min-width: 0; }
.music-tabs { display: flex; justify-self: start; max-width: 100%; }
.music-tabs button { white-space: nowrap; }
@media (max-width: 480px) { .music-body { padding-inline: 12px; } .music-tabs { justify-self: stretch; } .music-tabs button { flex: 1 1 0; padding-inline: 6px; font-size: 13px; } }
.music-pane { display: grid; gap: 10px; }
.music-pane textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.music-pane input[type=file] { max-width: 100%; }
.music-go { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.music-go .hint { margin: 0; }
.music-list { display: grid; gap: 10px; }
.music-row { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.music-row-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.music-row-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row audio, .smm-music-now audio { width: 100%; height: 36px; }
.music-keep { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.music-dialog .pick-foot .msg-error { margin: 0; }
.smm-music { display: grid; gap: 8px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.smm-music p { margin: 0; }
.smm-music-now { display: grid; gap: 6px; font-size: 14px; }
.smm-music-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.smm-music-pre { display: grid; gap: 6px; }
.smm-duration { display: grid; gap: 8px; }
.smm-duration-row { display: flex; align-items: center; gap: 12px; }
.smm-duration-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.smm-duration-value { min-width: 44px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.smm-duration-presets { justify-self: start; }
.smm-style { margin-bottom: 12px; }
.smm-style-options { flex-wrap: wrap; justify-self: start; }
.smm-music-pre p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.pick-head-tools { display: flex; align-items: center; gap: 8px; }
.pick-fav[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pick-fav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pick-fav[aria-pressed="true"] svg { fill: currentColor; }

/* --- публичные страницы: описание (/about) и тарифы (/pricing), aigen/home.py, aigen/plans.py --- */
.pub { max-width: 1180px; }
/* «Тарифы» шире на мониторе: карточки шире и короче, кнопка в одну строку (patch_pricing_wide.py) */
.pub:has(.plan-grid) { max-width: 1480px; }
.pub-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -8px 0 28px; }
.pub-head .brand { color: var(--text); text-decoration: none; }
.pub-nav { display: flex; align-items: center; gap: 6px; }
.pub-nav a:not(.btn) { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 560; text-decoration: none; }
.pub-nav a.active, .pub-nav a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.pub-hero { display: grid; justify-items: start; gap: 16px; max-width: 860px; padding: 28px 0 8px; }
.pub-hero h1 { font-size: clamp(30px, 4.6vw, 52px); font-weight: 760; line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance; }
.pub-hero-small h1 { font-size: clamp(30px, 4vw, 44px); }
.pub-lead { margin: 0; max-width: 64ch; color: var(--muted); font-size: 18px; line-height: 1.55; }
.pub-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.pub-cta .btn { padding: 12px 20px; font-size: 15.5px; }
.pub-section { margin-top: 56px; }
.pub-section > h2, .pub-final h2 { margin-bottom: 16px; font-size: 26px; font-weight: 720; letter-spacing: -0.02em; }
.pub-muted { margin: -6px 0 16px; color: var(--muted); }
.pub-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.pub-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pub-card { display: grid; align-content: start; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.pub-card b { font-size: 18px; }
.pub-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.pub-card small { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.pub-card-big { padding: 26px; background: var(--surface-2); border-color: transparent; }
.pub-card-big b { font-size: 21px; }
.pub-steps { list-style: none; counter-reset: st; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; }
.pub-steps li { counter-increment: st; display: grid; gap: 6px; padding: 20px; border-top: 3px solid var(--accent); background: var(--surface); border-radius: 0 0 16px 16px; }
.pub-steps li::before { content: counter(st); color: var(--accent); font-size: 28px; font-weight: 760; line-height: 1; }
.pub-steps b { font-size: 17px; }
.pub-steps span { color: var(--muted); line-height: 1.5; }
.pub-final { display: grid; justify-items: start; gap: 10px; margin-top: 56px; padding: 32px; border-radius: 22px; background: var(--accent-soft); }
.pub-final p { margin: 0; color: var(--muted); }
.plan-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 28px; align-items: stretch; }
@media (max-width: 1300px) { .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.plan-card h2 { font-size: 22px; font-weight: 740; }
.plan-main { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.plan-flag { position: absolute; top: -11px; left: 18px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 650; }
.plan-for { margin: 0; color: var(--muted); font-size: 14px; min-height: 2.9em; }
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font-size: 32px; font-weight: 780; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--muted); }
.plan-credits { font-weight: 650; font-size: 16px; }
.plan-parallel { color: var(--muted); font-size: 14px; }   /* patch_queue_plans.py */
.plan-enough { flex: 1; padding-top: 10px; border-top: 1px solid var(--border); }
.plan-enough small { color: var(--muted); font-size: 12.5px; }
.plan-enough ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.plan-btn { width: 100%; justify-content: center; margin-top: 6px; }
/* кнопка «Сравнение всех тарифов» под карточками (templates/pricing.html, страница /pricing/compare) */
.plan-compare { align-items: center; margin-top: 18px; }
.plan-compare span { color: var(--muted); font-size: 14.5px; }
.pack-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pack-card { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.pack-credits { font-size: 20px; font-weight: 720; }
.pack-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.faq summary { cursor: pointer; font-weight: 640; }
.faq p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
@media (max-width: 1000px) {
  .pub-grid, .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pub-grid, .pub-grid-2, .plan-grid, .pub-steps { grid-template-columns: minmax(0, 1fr); }
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pub-head { flex-wrap: wrap; }
}
/* шапка гостя с «Войти» и «Получить доступ» (templates/_public_header.html, aigen/access.py): на телефоне в две строки,
   «Войти» справа от логотипа, под ними «О сервисе», «Тарифы» и «Получить доступ» (помещается и на 360 px) */
@media (max-width: 640px) {
  .pub-head { position: relative; gap: 10px; }
  .pub-nav { width: 100%; gap: 6px 2px; }
  .pub-nav a:not(.btn) { padding: 6px 8px; }
  .pub-nav .btn:not(.btn-primary) { position: absolute; top: -2px; right: 0; }
  .pub-nav .btn-primary { margin-left: auto; }
}
:root[data-theme="grey"] .pub-head .brand { color: var(--on-bg); }
:root[data-theme="grey"] .pub-nav a:not(.btn) { color: var(--on-bg-muted); }
:root[data-theme="grey"] .pub-nav a.active, :root[data-theme="grey"] .pub-nav a:not(.btn):hover { color: var(--text); }

/* дизайн-коды (templates/designs.html, design_new.html, design_edit.html, static/js/designs.js) */
.design-head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.smm-design-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 0; font-size: 14px; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.design-card { display: grid; gap: 10px; padding: 14px; color: inherit; text-decoration: none; }
.design-card:hover { border-color: var(--accent); }
.design-card-body { display: grid; gap: 2px; min-width: 0; }
.design-card-body b, .design-card-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.design-mini { display: grid; gap: 8px; }
.design-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.design-swatches span { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); }
.design-empty { max-width: 640px; }
.design-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.design-variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.design-variant { display: grid; gap: 8px; padding: 14px; align-content: start; }
.design-variant p { margin: 0; font-size: 13.5px; }

/* превью: пост 4:5 и сторис 9:16 в цветах и шрифтах дизайн-кода (переменные ставит designs.js) */
.dp { position: relative; overflow: hidden; border-radius: 14px; background: var(--dp-bg, #F7F6F3); color: var(--dp-fg, #16130F);
  border: 1px solid var(--border); container-type: inline-size; }
.dp-post { aspect-ratio: 4 / 5; width: 100%; }
.dp-story { aspect-ratio: 9 / 16; width: 100%; }
.dp-shape { position: absolute; right: -18%; top: 22%; width: 70%; aspect-ratio: 1; border-radius: 50%; background: var(--dp-accent, #C2542D); opacity: .9; }
.dp-logo { position: absolute; left: 7%; top: 6%; max-width: 30%; max-height: 10%; object-fit: contain; }
.dp-tag { position: absolute; left: 7%; top: 20%; padding: .35em .8em; border-radius: 999px; background: var(--dp-accent2, #2F5D8A);
  color: var(--dp-bg, #fff); font: var(--dp-text-weight, 600) 4.2cqw/1 var(--dp-text-font, sans-serif); }
.dp-head { position: absolute; left: 7%; right: 12%; top: 31%; font: var(--dp-head-weight, 800) 10.5cqw/1.02 var(--dp-head-font, sans-serif);
  letter-spacing: -.01em; overflow-wrap: anywhere; }
.dp-text { position: absolute; left: 7%; right: 18%; bottom: 20%; font: var(--dp-text-weight, 500) 4.6cqw/1.35 var(--dp-text-font, sans-serif); opacity: .85; }
.dp-cta { position: absolute; left: 7%; bottom: 7%; padding: .7em 1.2em; border-radius: 999px; background: var(--dp-fg, #16130F);
  color: var(--dp-bg, #fff); font: var(--dp-text-weight, 600) 4.2cqw/1 var(--dp-text-font, sans-serif); }
.dp-story .dp-head { top: 36%; font-size: 13cqw; }
.dp-story .dp-text { bottom: 22%; font-size: 5.4cqw; }
.dp-small { border-radius: 10px; }

/* редактор */
.design-editor { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.design-form { display: grid; gap: 4px; min-width: 0; }
.design-colors { display: grid; gap: 8px; }
.design-color { display: grid; grid-template-columns: 40px 96px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.design-color input[type=color] { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: none; }
.design-hex { font-variant-numeric: tabular-nums; text-transform: uppercase; }
.design-font-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.design-custom summary { cursor: pointer; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.design-custom-body { display: grid; gap: 8px; margin-top: 8px; }
.design-font-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.switch-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.design-logos { display: flex; flex-wrap: wrap; gap: 10px; }
.design-logo { position: relative; display: grid; gap: 4px; justify-items: center; width: 96px; padding: 8px; border: 1px solid var(--border);
  border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 14px 14px; }
.design-logo img { max-width: 80px; max-height: 56px; object-fit: contain; }
.design-logo small { font-size: 11px; color: var(--muted); text-align: center; }
.design-logo .icon-btn { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; }
.design-logo-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.design-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.design-save-row #de-delete { margin-left: auto; }
.design-assist { display: grid; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.design-preview { position: sticky; top: 90px; display: grid; gap: 10px; }
.design-preview-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.design-preview-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) {
  .design-editor { grid-template-columns: minmax(0, 1fr); }
  .design-preview { position: static; order: -1; }
}

/* презентации (templates/slides.html, static/js/slides.js) */
.slides-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.slides-steps { display: grid; gap: 18px; max-width: 1100px; }
.slides-step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 20px; }
.step-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; }
.slides-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.slides-material { margin-bottom: 16px; }
.slides-material summary { cursor: pointer; }
.slides-material-body { display: grid; gap: 10px; margin-top: 10px; }
.slides-material-body textarea { width: 100%; box-sizing: border-box; }
.slides-plan { display: grid; gap: 12px; margin: 0 0 14px; padding-left: 22px; }
.slides-plan-item { display: grid; gap: 6px; }
.slides-plan-item textarea, .slides-plan-item input { width: 100%; box-sizing: border-box; }
.slides-plan-head { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.slides-plan-head input { font-weight: 650; }
.slides-plan-actions, .slides-actions, .slides-build { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.slides-build textarea, .slides-build .prompt-wrap { flex: 1 1 320px; min-width: 0; }
/* микрофон у пожелания к пересборке: подсказка записи строкой ниже кнопки, во всю ширину */
.slides-build .mic-status { flex-basis: 100%; order: 1; margin-top: -4px; }
.slides-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.slides-previews a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16 / 9; background: var(--surface-2); }
.slides-previews img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 700px) { .slides-row { grid-template-columns: minmax(0, 1fr); } }

/* память в чате: блок в профиле (templates/_memory_profile.html, static/js/memory.js) */
.memory-card .switch { margin: 14px 0 12px; align-items: flex-start; }
.memory-card .switch small { display: block; font-weight: 450; }
.memory-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.memory-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 10px; }
.memory-list li:nth-child(odd) { background: var(--surface-2); }
.memory-list li span { min-width: 0; overflow-wrap: anywhere; }
.memory-list .btn { flex: none; }
.memory-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.chat-settings .switch small a { color: var(--accent); }

/* юридические документы и подвал с реквизитами (aigen/legal.py, templates/legal_*.html, _legal_footer.html) */
.legal-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 44px; align-items: start; margin-top: 8px; }
.legal-nav { position: sticky; top: 20px; display: grid; gap: 2px; }
.legal-nav a { padding: 7px 10px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 560; text-decoration: none; }
.legal-nav a.active, .legal-nav a:hover { color: var(--text); background: var(--surface-2); }
.legal-doc { max-width: 80ch; }
.legal-doc h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 740; letter-spacing: -0.02em; text-wrap: balance; }
.legal-meta { margin: 10px 0 24px; color: var(--muted); font-size: 14px; }
.legal-lead { margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); line-height: 1.6; }
.legal-doc h2 { margin: 30px 0 10px; font-size: 19px; font-weight: 700; }
.legal-doc p { margin: 0 0 10px; line-height: 1.65; }
.legal-doc ul, .legal-doc ol { display: grid; gap: 5px; margin: 0 0 12px; padding-left: 22px; line-height: 1.6; }
.legal-doc a { color: var(--accent); }
.legal-table-wrap { overflow-x: auto; margin: 4px 0 14px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.legal-table th, .legal-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; line-height: 1.5; white-space: normal; }
.legal-table th { color: var(--muted); font-weight: 600; }
.legal-table tbody tr:hover td { background: none; }
.legal-table small { color: var(--muted); }
.legal-todo { padding: 1px 4px; border-radius: 5px; background: var(--warn-soft); color: inherit; box-shadow: inset 0 0 0 1px var(--warn); }
.legal-req { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; margin: 0 0 14px; }
.legal-req dt { color: var(--muted); }
.legal-req dd { margin: 0; }
.legal-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.legal-card { color: var(--text); text-decoration: none; }
.legal-card:hover { border-color: var(--accent); }
.pub-legal-note { max-width: 860px; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.pub-legal-note a, .faq a { color: var(--accent); }
.legal-foot { display: grid; gap: 6px; justify-items: center; text-align: center; margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }
.legal-foot p { margin: 0; }
.legal-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 4px; }
.legal-foot a { color: var(--muted); text-decoration: none; }
.legal-foot a:hover { color: var(--accent); }
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .legal-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .legal-index { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .legal-req { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .legal-req dd { margin-bottom: 8px; }
}

/* остатки у поставщиков в админке (templates/admin_funds.html) */
.funds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 12px; }
.fund-card { display: grid; gap: 8px; align-content: start; border-top: 4px solid var(--border); }
.fund-card.ok { border-top-color: var(--ok); }
.fund-card.warn { border-top-color: var(--warn); }
.fund-card.low, .fund-card.error { border-top-color: var(--err); }
.fund-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fund-head h2 { margin: 0; }
.fund-card p { margin: 0; }
.fund-sum b { font-size: 28px; font-weight: 700; margin-right: 8px; }

/* обратная связь в админке (templates/admin_feedback.html) */
.fb-filter { margin-bottom: 14px; flex-wrap: wrap; }
.fb-item { display: grid; gap: 10px; margin-bottom: 12px; border-left: 4px solid var(--border); }
.fb-item.new { border-left-color: var(--err); }
.fb-item.work { border-left-color: var(--accent); }
.fb-item.dev { border-left-color: var(--warn); }
.fb-item.answered, .fb-item.closed { border-left-color: var(--ok); }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fb-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-shots { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-shots img { display: block; width: 160px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.fb-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fb-form input[name="note"] { flex: 1 1 280px; min-width: 0; }
.fb-item .hint { margin: 0; }

/* набросок композиции (static/js/sketch.js) */
.sketch-dialog { width: min(1180px, calc(100vw - 24px)); height: min(860px, calc(100vh - 24px)); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); overflow: hidden; }
.sketch-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.sketch-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.sketch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sketch-head h2 { margin: 0 0 2px; font-size: 18px; }
.sketch-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.sketch-stage { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 14px; background: var(--surface-2); }
.sketch-canvas { display: block; touch-action: none; border-radius: 4px; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); }
.sketch-panel { display: grid; align-content: start; gap: 14px; padding: 14px; overflow-y: auto; border-left: 1px solid var(--border); }
.sketch-group { display: grid; gap: 6px; }
.sketch-tools, .sketch-swatches, .sketch-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sketch-tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.sketch-swatch { width: 26px; height: 26px; padding: 0; border: 2px solid var(--border); border-radius: 50%; cursor: pointer; }
.sketch-swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.sketch-custom { width: 34px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.sketch-label { width: 100%; }
.sketch-layers { display: grid; gap: 4px; }
.sketch-layer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; gap: 4px; align-items: center;
  padding: 3px 6px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.sketch-layer.active { border-color: var(--accent); background: var(--accent-soft); }
.sketch-layer-name { min-width: 0; padding: 4px; border: 0; background: transparent; color: inherit; font: inherit; }
.sketch-layer-count { min-width: 16px; color: var(--muted); font-size: 12px; text-align: right; }
.sketch-layer .icon-btn { width: 26px; height: 26px; }
.sketch-foot { justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 860px) {
  .sketch-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(240px, 1fr) auto; }
  .sketch-panel { max-height: 46vh; border-left: 0; border-top: 1px solid var(--border); }
}
.field-note { margin-top: -2px; color: var(--err); font-size: 12.5px; line-height: 1.35; }

/* несколько картинок одного задания: отдельные карточки в сетке ленты (static/js/app.js, renderJob) */
.job-group { display: contents; }
.job-part { color: var(--muted); font-size: 12.5px; }

/* фильтры ленты под генератором (templates/index.html) */
.feed-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 14px; }
.feed-kinds { flex-wrap: wrap; }
.feed-filters select { max-width: 240px; min-width: 0; }
.feed-none { margin: 8px 0; }

/* карточка Suno: содержимое ужимается, а не растягивает карточку (цена не у самого края) */
.music-job .job-body { grid-template-columns: minmax(0, 1fr); }
.music-job .job-body > * { min-width: 0; }

/* фильтры ленты: кнопка у заголовка, лёгкие переключатели-пилюли, метка включённого фильтра */
.feed-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.feed-title h2 { margin: 0; }
.feed-toggle svg { width: 15px; height: 15px; margin-right: 5px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; vertical-align: -2px; }
.feed-toggle[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.feed-active { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.feed-active button { padding: 2px 8px; border: 0; background: none; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.feed-filters { gap: 6px; margin: -2px 0 14px; }
.feed-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-kinds button { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.feed-kinds button:hover { color: var(--text); }
.feed-kinds button[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--surface); }
.feed-filters select { height: auto; padding: 5px 30px 5px 12px; border-radius: 99px; font-size: 13px; }

/* выбор проекта в окне «Из сгенерированных» (static/js/pick-photos.js) */
.pick-project { max-width: 200px; height: auto; padding: 5px 28px 5px 10px; border-radius: 99px; font-size: 13px; }

/* «Повторить»: форма на секунду вспыхивает рамкой акцентного цвета (static/js/app.js, flashForm) */
@keyframes form-flash {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  30% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 35%, transparent); background-color: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.form-flash { animation: form-flash 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .form-flash { animation: none; outline: 2px solid var(--accent); } }

/* «Прослушать» у голосов озвучки (static/js/app.js, voiceButton) */
.voice-pick { display: flex; gap: 8px; align-items: center; }
.voice-pick select { flex: 1; min-width: 0; }
.voice-play { flex: none; }
.voice-play.playing { color: var(--accent); }
.sketch-move-layer { max-width: 150px; height: auto; padding: 4px 26px 4px 8px; border-radius: 8px; font-size: 13px; }

/* пометки поверх референса (static/js/markup.js): кнопка ✎ на картинке, подсказка про модель */
.thumb .thumb-mark { left: 4px; right: auto; }
.thumb .thumb-mark.on { background: var(--accent); }
.markup-canvas { cursor: crosshair; }
.markup-warn { margin: 2px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 12.5px; line-height: 1.4; }

/* кадр в редакторе пометок (static/js/crop.js): прозрачное поле вокруг фото под ручки рамки, кнопки пропорций,
   значок кадра на миниатюре у фото для видео */
.markup-canvas.crop-mode { box-shadow: none; border-radius: 0; }
.crop-ratios { display: flex; flex-wrap: wrap; gap: 6px; }
.crop-ratio { min-width: 44px; }
.crop-ratio[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.crop-rotate { gap: 5px; }
.crop-rotate svg { width: 14px; height: 14px; }
.crop-group .btn:disabled { opacity: .45; cursor: default; }
.crop-size { font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .crop-ratio, .crop-rotate, .crop-buttons .btn { min-height: 36px; } }
.thumb .thumb-crop svg { display: block; width: 12px; height: 12px; margin: auto; fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* готовые посты SMM-студии (static/js/smm.js, drawPosts) */
.smm-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.smm-post { margin: 0; display: grid; gap: 6px; }
.smm-post img { display: block; width: 100%; height: auto; border-radius: 10px; box-shadow: 0 1px 6px rgba(0, 0, 0, .12); }
.smm-post figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
/* --- SMM-студия, «Результат»: предпросмотр «Как в ленте» (static/js/smm.js, feedPreview; 30.10.2026) --- */
.smf-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.smf-seg button { padding: 7px 14px; font-size: 13.5px; }
.smf-safe { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.smf {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 368px)); justify-content: center;
  align-items: start; gap: 22px 16px; margin-top: 4px;
}
.smf-vertical { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 340px)); }
.smf-item { display: grid; gap: 6px; min-width: 0; }
.smf-card {
  overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); font-size: 14px; line-height: 1.4;
}
.smf-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.smf-icon-more { stroke-width: 2.8; }
.smf-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.smf-head .smf-icon-more { margin-left: auto; }
.smf-avatar {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; box-shadow: 0 0 0 1px var(--border);
}
.smf-login { font-size: 14px; font-weight: 650; }
.smf-media { position: relative; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); }
.smf-media.smf-4-5 { aspect-ratio: 4 / 5; }
.smf-media.smf-9-16 { aspect-ratio: 9 / 16; }
.smf-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.smf-track::-webkit-scrollbar { display: none; }
.smf-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; user-select: none; -webkit-user-drag: none; }
.smf-count {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(18, 18, 18, .7); color: #fff;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.smf-arrow {
  position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 30px; height: 30px; margin-top: -15px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #262626; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer;
}
.smf-arrow .smf-icon { width: 18px; height: 18px; stroke-width: 2.4; }
.smf-prev { left: 10px; }
.smf-next { right: 10px; }
.smf-actions { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 12px 6px; }
.smf-act { display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--text); }
button.smf-act { cursor: pointer; }
.smf-like[aria-pressed="true"] { color: var(--err); }
.smf-like[aria-pressed="true"] .smf-icon { fill: currentColor; }
.smf-save { margin-left: auto; }
.smf-dots { position: absolute; left: 50%; top: calc(50% + 2px); display: flex; gap: 4px; transform: translate(-50%, -50%); }
.smf-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.smf-dots span.on { background: var(--accent); }
.smf-likes { margin: 0; padding: 0 12px; font-weight: 650; }
.smf-text { position: relative; padding: 4px 12px 0; }
.smf-caption { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.smf-caption.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* «… ещё» в конце второй строки, как в приложении */
.smf-more {
  position: absolute; right: 12px; bottom: 0; padding: 0 0 0 30px; border: 0; color: var(--muted); font: inherit; line-height: inherit;
  background: linear-gradient(90deg, transparent, var(--surface) 26px); cursor: pointer;
}
.smf-more::before { content: "… "; color: var(--text); }
.smf-tag { color: color-mix(in srgb, #3b82f6 62%, var(--text)); }
.smf-time { margin: 6px 0 0; padding: 0 12px 14px; color: var(--muted); font-size: 12px; }
.smf-under { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 0 4px; color: var(--muted); font-size: 13px; }
/* сторис и рилс: интерфейс белым поверх картинки, как в приложении */
.smf-story { overflow: hidden; border-radius: 16px; background: #000; color: #fff; box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.35; }
.smf-story .smf-media { background: #111; }
.smf-story .smf-avatar { width: 30px; height: 30px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }
.story-top {
  position: absolute; inset: 0 0 auto; z-index: 1; display: grid; gap: 10px; padding: 8px 10px 28px;
  background: linear-gradient(rgba(0, 0, 0, .5), transparent); pointer-events: none;
}
.story-bars { display: flex; gap: 3px; }
.story-bars span { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, .4); }
.story-bars span.on { background: #fff; }
.story-user { display: flex; align-items: center; gap: 8px; }
.story-user small { color: rgba(255, 255, 255, .75); font-size: 12.5px; }
.story-user .smf-icon { width: 22px; height: 22px; }
.story-user .smf-icon-more { margin-left: auto; }
.story-bottom {
  position: absolute; inset: auto 0 0; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 34px 12px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .5)); pointer-events: none;
}
.story-input { flex: 1; min-width: 0; padding: 9px 14px; border: 1px solid rgba(255, 255, 255, .75); border-radius: 99px; color: rgba(255, 255, 255, .9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-shade { position: absolute; inset: 45% 0 0; z-index: 1; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); pointer-events: none; }
.reels-side { position: absolute; right: 8px; bottom: 92px; z-index: 1; display: grid; justify-items: center; gap: 16px; font-size: 12px; font-weight: 600; pointer-events: none; }
.reels-side span { display: grid; justify-items: center; gap: 3px; }
.reels-side .smf-icon { width: 26px; height: 26px; }
.reels-info { position: absolute; left: 0; right: 56px; bottom: 0; z-index: 1; display: grid; gap: 8px; padding: 0 12px 16px; pointer-events: none; }
.reels-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.reels-user b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reels-follow { flex: none; padding: 3px 10px; border: 1px solid rgba(255, 255, 255, .8); border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.reels-caption { margin: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.reels-audio { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.reels-audio span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reels-audio .smf-icon { flex: none; width: 15px; height: 15px; }
.smf-story .smf-tag { color: #fff; font-weight: 600; }
/* безопасная зона: примерно где картинку закрывает интерфейс */
.safe-zone {
  position: absolute; z-index: 2; display: grid; place-items: center; padding: 4px; border: 1.5px dashed rgba(255, 255, 255, .9);
  background: repeating-linear-gradient(135deg, rgba(229, 57, 53, .34) 0 8px, rgba(229, 57, 53, .2) 8px 16px);
  color: #fff; font-size: 11.5px; font-weight: 650; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); pointer-events: none;
}
.safe-top { inset: 0 0 auto; height: 14%; place-items: end center; }
.safe-bottom { inset: auto 0 0; height: 20%; place-items: start center; }
.smf-story.reels .safe-bottom { height: 35%; }
.safe-right { top: 45%; right: 0; bottom: 35%; width: 16%; }
@media (max-width: 640px) {
  .smm-panel .smf { margin-inline: -16px; gap: 22px; }
  .smf-card { border-inline: 0; border-radius: 0; box-shadow: none; }
  .smf-story { border-radius: 0; }
  .smf-under { padding: 0 16px; }
  .smf-seg button { padding: 7px 10px; }
}

/* панель правки над холстом наброска и пометок (static/js/sketch.js, markup.js): отменить, вернуть, удалить фигуру.
   Стоит в .sketch-stage у левого края холста, не перекрывая его; fit() вычитает её высоту, холст вписывается целиком */
.sketch-stage { grid-template-rows: auto auto; align-content: center; justify-content: center; row-gap: 8px; }
.sketch-actions { justify-self: start; display: flex; align-items: center; gap: 2px; padding: 2px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.sketch-actions .icon-btn { width: 36px; height: 36px; }
.sketch-actions .icon-btn:disabled { opacity: .35; background: none; color: var(--muted); cursor: default; }
.sketch-actions .sketch-trash:not(:disabled):hover { color: var(--err); }
.sketch-actions-sep { flex: none; width: 1px; height: 20px; margin: 0 3px; background: var(--border); }
@media (max-width: 860px), (pointer: coarse) { .sketch-actions .icon-btn { width: 40px; height: 40px; } }
@media (max-width: 860px) { .sketch-stage { padding: 8px; row-gap: 6px; } }
/* телефон: высоту под панель правки (около 40px) берём у прокручиваемой панели инструментов, холст не мельчает;
   в низком окне (телефон лёжа) раскладка прежняя */
@media (max-width: 860px) and (min-height: 520px) {
  .sketch-body { grid-template-rows: minmax(min(280px, 62%), 1fr) auto; }
  .sketch-panel { max-height: calc(46vh - 40px); }
}

/* шапка окна выбора на телефоне (static/js/pick-photos.js): заголовок и крестик в первой строке,
   выбор проекта и «Избранное» во второй, ничего не уезжает за экран */
.pick-head h2 { flex: 1; min-width: 0; }
.pick-head > .icon-btn { flex: none; }
@media (max-width: 560px) {
  .pick-head { flex-wrap: wrap; row-gap: 8px; }
  .pick-head-tools { order: 3; flex: 1 0 100%; min-width: 0; }
  .pick-head-tools .pick-project { flex: 1; min-width: 0; max-width: none; }
}

/* инструменты наброска (static/js/sketch.js): значок слева от слова; «Выбрать» отдельной строкой с пояснением,
   под тонкой чертой фигуры, ниже кисть и ластик */
.sketch-tool { gap: 6px; }
.sketch-tool svg { flex: none; width: 15px; height: 15px; }
.sketch-pick { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.sketch-pick .hint { font-size: 12.5px; line-height: 1.3; }

/* набросок: «Выбирать несколько» под «Выбрать», кнопка «Добавить фото» с источниками (static/js/sketch.js) */
.sketch-pick { align-items: flex-start; }
.sketch-pick-text { display: grid; gap: 6px; min-width: 0; }
.sketch-multi { color: var(--muted); font-size: 13px; cursor: pointer; }
.sketch-photo { display: grid; justify-items: start; gap: 6px; }
.sketch-photo-row { display: flex; flex-wrap: wrap; gap: 4px; }
.sketch-photo-row[hidden], .sketch-photo .hint:empty { display: none; }
.sketch-add-photo[aria-expanded="true"] { background: var(--surface-2); }

/* набросок: подсказка про слой фото, кнопка «Убрать фон» у выделенного фото (static/js/sketch.js) */
.sketch-photo-row .hint { flex-basis: 100%; margin: 2px 0 0; }
.sketch-cut[hidden] { display: none; }

/* вкладки админки на телефоне (templates/_admin_tabs.html): переносятся, а не уходят за край */
.admin-tabs { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 640px) {
  .admin-tabs a { flex: 1 1 auto; padding: 7px 10px; font-size: 13px; }
}

/* серая тема (выбор «Серая» в меню под аватаркой, static/js/theme.js): средне-серый фон и слегка серые карточки,
   чтобы оценивать фото не только на белом и чёрном. От системной тёмной не зависит */
:root[data-theme="grey"] {
  --bg: #82817c;
  --surface: #e4e3de;
  --surface-2: #d6d5d0;
  --raised: #edece7;
  --border: #bfbeb8;
  --border-strong: #7b7a75;
  --text: #151412;
  --muted: #3b3a36;
  --accent: #a3401c;
  --accent-text: #ffffff;
  --accent-soft: #c3a293;
  --ok: #1d5a36;
  --ok-soft: #a3baa8;
  --err: #8a1a13;
  --err-soft: #c4a29d;
  --warn-soft: #c2b58f;
  --warn: #6f4c05;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 24px rgba(0, 0, 0, .1);
  color-scheme: light;
}

/* переключатель темы в меню под аватаркой (templates/base.html, static/js/theme.js) */
.theme-switch { display: grid; gap: 6px; padding: 8px 12px 10px; }
.theme-switch > span { font-size: 12px; color: var(--muted); }
.theme-switch .segmented { display: flex; }
/* кнопки меню под аватаркой растянуты влево и подсвечиваются при наведении: здесь свой вид переключателя */
.account-pop .theme-switch .segmented button { justify-content: center; width: auto; padding: 5px 8px; font-size: 12.5px; color: var(--muted); background: none; }
.account-pop .theme-switch .segmented button:hover { color: var(--text); background: none; }
.account-pop .theme-switch .segmented button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.account-pop .theme-switch .segmented button:focus-visible { box-shadow: var(--ring); }

/* полоса прокрутки верхнего меню на телефоне: скрыта, видна только пока листают; затухание справа,
   пока меню не долистано до конца (классы ставит static/js/menu.js) */
@media (max-width: 640px) {
  .nav { scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav.is-scrolling { scrollbar-width: thin; }
  .nav.has-more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
                  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
}
/* мышь: полоса заняла бы место и меню прыгало бы по высоте, листают колесом или тачпадом */
@media (max-width: 640px) and (hover: hover) {
  .nav.is-scrolling { scrollbar-width: none; }
}

/* ошибка задания и «Сообщить о проблеме» (static/js/job-report.js, aigen/job_report.py) */
.job-error-text { margin: 0; overflow-wrap: anywhere; }
.job-error-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-top: 6px; }
.job-error-hint { color: var(--muted); font-size: 12px; line-height: 1.35; }
.job-report-btn {
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 560; cursor: pointer; white-space: nowrap;
}
.job-report-btn:hover:not(:disabled) { background: var(--surface-2); }
.job-report-btn:disabled { cursor: default; color: var(--muted); background: transparent; }
.job-report textarea { width: 100%; }
.fb-job { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.fb-job-title { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-job-data { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13.5px; }
.fb-job-data dt { color: var(--muted); }
.fb-job-data dd { margin: 0; overflow-wrap: anywhere; }
.fb-job-error { color: var(--err); }
.fb-job-prompt { white-space: pre-wrap; max-height: 9em; overflow: auto; }
@media (max-width: 560px) {
  .fb-job-data { grid-template-columns: 1fr; gap: 2px; }
  .fb-job-data dd { margin-bottom: 6px; }
}

/* удаление задания (static/js/app.js, aigen/job_delete.py): корзина справа внизу карточки, вопрос на её месте */
.job-delete {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: auto; padding: 0; border: 0;
  border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.job-delete:hover { background: var(--err-soft); color: var(--err); }
.job-delete svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.job-foot .btn ~ .job-delete, .job-foot .render-box ~ .job-delete { margin-left: 4px; }
.job-delete-ask { color: var(--text); }
.job-delete-q.error { color: var(--err); }
.job-delete-actions { display: inline-flex; gap: 6px; margin-left: auto; }
.job-delete-ask .btn { margin-left: 0; }
.job-delete-yes { color: var(--err); background: var(--err-soft); border-color: transparent; }
.job-delete-yes:hover { background: var(--err); color: #fff; }
.history-clean-ask { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }

/* ремарки озвучки под полем текста и окно «Как управлять голосом» (static/js/tts-tags.js) */
.tts-tags { display: grid; gap: 8px; margin-top: 2px; }
.tts-tags-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tts-tags-title { color: var(--muted); font-size: 13px; font-weight: 600; }
.tts-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: -2px; }
.tts-tabs button {
  padding: 3px 9px; border: 0; border-radius: 99px; background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 560; cursor: pointer;
}
.tts-tabs button:hover { color: var(--text); }
.tts-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.tts-tabs button:focus-visible, .tts-info:focus-visible, .tts-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.tts-info {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 8px 3px 5px; border: 0; border-radius: 99px;
  background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 560; cursor: pointer;
}
.tts-info:hover { background: var(--surface-2); color: var(--accent); }
.tts-info svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tts-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tts-chip {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.35; cursor: pointer; transition: border-color .15s, color .15s;
}
.tts-chip:hover { border-color: var(--accent); color: var(--accent); }
.tts-chip:active { background: var(--accent-soft); }
.tts-note code, .voice-guide code {
  padding: 0 4px; border-radius: 5px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em;
}
.voice-guide { width: min(640px, calc(100vw - 24px)); }
.voice-guide-body { display: grid; gap: 2px; font-size: 14.5px; line-height: 1.5; }
.voice-guide-body h3 { margin: 14px 0 6px; font-size: 15.5px; }
.voice-guide-body ul { display: grid; gap: 5px; margin: 0; padding-left: 20px; }
.voice-guide-intro { margin: 0 0 4px; color: var(--muted); }
.voice-guide-example { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; white-space: pre-line; }
.voice-guide-example code { background: var(--surface); }
.voice-guide-source { margin: 16px 0 0; color: var(--muted); font-size: 13px; }

/* переключатель темы значками: четыре кнопки в одну строку, название выбранной темы в подписи */
.account-pop .theme-switch .segmented button { flex: 1; padding: 6px 0; }
.theme-switch .segmented svg { width: 18px; height: 18px; }
.theme-switch .segmented svg .fill { fill: currentColor; stroke: none; }

/* «Поделиться» под картинкой, видео, озвучкой и треком (static/js/share-file.js, aigen/file_share.py): меню как у
   «Использовать как исходник» (.use-menu); вкладка «Ссылки» в админке */
.share-menu { min-width: 250px; max-width: calc(100vw - 16px); }
.share-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text);
  text-decoration: none; }
.share-menu a:hover, .share-menu a:focus-visible { background: var(--surface-2); outline: none; }
.share-menu button:disabled { opacity: .55; cursor: progress; }
.share-menu small { white-space: normal; }
.share-menu .danger b, .share-menu .danger svg { color: var(--err); }
.share-menu-status { display: flex; align-items: center; gap: 6px; padding: 7px 10px 5px; color: var(--muted); font-size: 13px;
  font-weight: 600; }
.share-menu .share-menu-status span { display: inline; }
.share-menu-status.ok { color: var(--ok); }
.share-menu-status.bad { color: var(--err); font-weight: 550; }
.share-menu .share-menu-status svg { width: 16px; height: 16px; stroke-width: 2.2; }
.share-menu-url { margin: 0 6px 4px; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.admin-link-thumb { width: 40px; height: 40px; margin-right: 8px; border-radius: 6px; object-fit: cover; vertical-align: middle; }

/* значки под файлом на телефоне: сердечко, «Поделиться» и семь значков справа в одну строку */
@media (max-width: 640px) {
  .media-bar { gap: 2px; }
  .media-bar .icon-btn { width: 28px; height: 28px; }
}

/* промпт в карточке: под раскрытым кнопка «Скопировать промпт» (static/js/app.js, promptBlock) */
.job-prompt-box { position: relative; display: grid; gap: 6px; justify-items: start; }
.job-prompt-copy { gap: 6px; padding: 4px 8px; margin-left: -8px; }
.job-prompt-copy svg { width: 16px; height: 16px; }

/* ремарки: группы друг на друге в одной ячейке, высота по самой длинной (static/js/tts-tags.js) */
.tts-stack { display: grid; }
.tts-layer { grid-area: 1 / 1; display: grid; gap: 8px; align-content: start; visibility: hidden; }
.tts-layer.on { visibility: visible; }

/* серая тема: надписи прямо на сером фоне светлые, на карточках остаются тёмными (30.10.2026) */
:root[data-theme="grey"] { --on-bg: #f7f6f2; --on-bg-muted: #e4e3de; }
:root[data-theme="grey"] :is(.page-head h1, .studio-head h1, .feed-title h2, .home-section-head h2, .empty-state h3,
  .chat-empty h2, .home-tool > b, .home-soon-card > b) { color: var(--on-bg); }
:root[data-theme="grey"] :is(.page-head p, .studio-head p.muted, .feed-toggle, .feed-head .link-muted,
  .home-section-head p, .empty-state p, .home-tool > span, .home-soon-card > span:last-child, .legal-foot, .legal-foot a,
  .chat-list-empty, .chat-empty p, .chat-hint) { color: var(--on-bg-muted); }
:root[data-theme="grey"] :is(.feed-toggle, .feed-head .link-muted, .legal-foot a):hover { color: var(--on-bg); }

/* набросок и пометки на телефоне: окно во весь видимый экран (dvh учитывает панель браузера), шапка короче */
.sketch-dialog { height: min(860px, calc(100dvh - 24px)); }
@media (max-width: 640px) {
  .sketch-dialog { width: 100vw; height: 100dvh; margin: 0; inset: 0; border-radius: 0; }
  .sketch-head { padding: 10px 12px; align-items: center; }
  .sketch-head h2 { font-size: 16px; }
  .sketch-head small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .sketch-head .btn { padding: 8px 14px; white-space: nowrap; }
  .sketch-ok-more { display: none; }
}

/* чат: «Поиск в интернете» и микрофон под полем сообщения, источники под ответом (static/js/chat.js, 30.10.2026) */
.chat-input-box { display: grid; gap: 2px; padding: 6px 7px 7px 14px; }
.chat-tools { display: flex; align-items: center; gap: 4px; margin-left: -6px; }
.chat-search-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; margin-right: auto; padding: 0 12px 0 9px;
  border: 1px solid var(--border); border-radius: 99px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 560; cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.chat-search-btn svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-search-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.chat-search-btn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.chat-search-btn[aria-pressed="true"]:hover { color: var(--accent); background: var(--accent-soft); }
.chat-search-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.chat-search-btn:disabled { opacity: .45; cursor: default; }
.chat-tools .mic-btn { position: static; width: 38px; height: 38px; border-color: transparent; background: transparent; }
.chat-tools .mic-btn svg { width: 19px; height: 19px; }
.chat-tools .mic-btn:hover { border-color: transparent; background: var(--surface-2); }
.chat-tools .mic-btn.recording { border-color: var(--accent); background: var(--accent); color: #fff; }
.chat-composer .mic-status { max-width: 780px; margin: 6px auto 0; font-size: 12.5px; text-align: center; }
.msg-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.msg-sources-label { margin-right: 2px; color: var(--muted); font-size: 12.5px; }
.md a.msg-source {
  display: inline-block; max-width: 220px; padding: 2px 10px; overflow: hidden; border: 1px solid var(--border);
  border-radius: 99px; background: var(--surface); color: var(--text); font-size: 12.5px; line-height: 1.6;
  text-decoration: none; text-overflow: ellipsis; white-space: nowrap;
}
.md a.msg-source:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 520px) { .chat-search-more { display: none; } }
:root[data-theme="grey"] .chat-composer .mic-status { color: var(--on-bg-muted); }

/* справка модели «Как это работает» (static/js/model-guide.js): значок «i» у заголовка «Режим» или «Модель» и окно.
   Окно общее с «Как управлять голосом» озвучки: классы .voice-guide выше */
.guide-slot:empty { display: none; }
.guide-btn {
  display: inline-flex; align-items: center; gap: 5px; margin: -6px -6px -6px auto; padding: 5px 8px 5px 5px; border: 0;
  border-radius: 99px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 560;
  letter-spacing: 0; text-transform: none; cursor: pointer; white-space: nowrap;
}
.guide-btn:hover { background: var(--surface-2); color: var(--accent); }
.guide-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.guide-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.voice-guide-body ul.model-guide-modes { gap: 8px; padding-left: 0; list-style: none; }
.model-guide-modes li { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.model-guide-modes li.on { border-color: var(--accent); background: var(--accent-soft); }
.model-guide-mode { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.model-guide-mode b { font-weight: 650; }
.model-guide-mode small { color: var(--accent); font-size: 12px; font-weight: 650; }
.model-guide-summary { margin: 0 0 6px; }
/* кнопка внизу окна режимов «Как писать промпт для …» и обратно «← Назад к режимам» */
.model-guide-next {
  display: block; width: 100%; margin-top: 16px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--accent); font: inherit; font-size: 14.5px; font-weight: 620; text-align: left; cursor: pointer;
}
.model-guide-next:hover { background: var(--surface-2); }
.model-guide-back {
  justify-self: start; margin-top: 14px; padding: 4px 0; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 560; cursor: pointer;
}
.model-guide-back:hover { color: var(--accent); }
.model-guide-next:focus-visible, .model-guide-back:focus-visible { outline: none; box-shadow: var(--ring); }
/* заголовок окна с крестиком остаётся сверху, пока справку листают (на телефоне окно во весь экран) */
.voice-guide .feedback-head {
  position: sticky; top: -20px; z-index: 1; margin: -20px -20px 6px; padding: 14px 20px 8px; background: var(--raised);
}

/* SMM-студия: образец учтён (static/js/smm.js, refUsed): миниатюра и подпись в «Образце», «Вариантах», «Результате» */
.smm-ref-used { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.smm-ref-used img { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }

/* --- студия предметки по шагам: полоса сверху и один шаг во всю ширину, как в SMM-студии
   (templates/studio.html, static/js/studio.js, patch_studio_steps.py, 31.10.2026) --- */
.studio-stepped { max-width: 1200px; margin: 0 auto; }
.studio-steps {
  position: relative; display: flex; gap: 2px; margin: 0 0 14px; padding: 6px; list-style: none; overflow-x: auto;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm);
  scrollbar-width: thin; scroll-margin-top: 76px;
}
.studio-steps > li { flex: 1 1 0; min-width: 170px; display: flex; align-items: center; }
/* стрелка между шагами */
.studio-steps > li + li::before {
  content: ""; flex: none; width: 6px; height: 6px; margin: 0 7px 0 3px; border: solid var(--border-strong);
  border-width: 1.6px 1.6px 0 0; transform: rotate(45deg);
}
.studio-step {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 11px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s, color .15s;
}
.studio-step:hover { background: var(--surface-2); }
.studio-step:focus-visible { outline: none; box-shadow: var(--ring); }
.studio-step[aria-current="step"] { background: var(--accent-soft); }
.studio-step-num {
  position: relative; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1.5px solid var(--border-strong);
  border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.studio-step-text { display: grid; min-width: 0; line-height: 1.3; }
.studio-step-title { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-step-sum { display: block; min-height: 1.3em; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* состояния из mark(): нужно сделать, готов, идёт работа, ошибка, ещё рано; открытый шаг залит акцентом */
.studio-step[data-state="active"] .studio-step-num { border-color: var(--accent); color: var(--accent); }
.studio-step[data-state="done"] .studio-step-num { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.studio-step[data-state="done"] .studio-step-num::after {
  content: "✓"; position: absolute; right: -6px; bottom: -5px; display: grid; place-items: center; width: 15px; height: 15px;
  border-radius: 50%; background: var(--ok); color: var(--surface); box-shadow: 0 0 0 2px var(--surface); font-size: 9.5px; font-weight: 800; line-height: 1;
}
.studio-step[data-state="running"] .studio-step-num { border-color: var(--accent); color: var(--accent); }
.studio-step[data-state="running"] .studio-step-num::after {
  content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface); animation: chat-pulse 1.2s ease-in-out infinite;
}
.studio-step[data-state="failed"] .studio-step-num { border-color: var(--err); color: var(--err); }
.studio-step[data-state="failed"] .studio-step-sum { color: var(--err); }
.studio-step[data-state="idle"]:not([aria-current]) { color: var(--muted); }
.studio-step[data-state="idle"]:not([aria-current]) .studio-step-num { opacity: .75; }
.studio-step[aria-current="step"] .studio-step-num { border-color: var(--accent); background: var(--accent); color: var(--accent-text); opacity: 1; }
.studio-step[aria-current="step"] .studio-step-num::after { box-shadow: 0 0 0 2px var(--accent-soft); }
/* область шага */
.studio-area { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.studio-pane { padding: 24px 28px 28px; }
.studio-pane[hidden] { display: none; }
.studio-pane-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 20px; }
.studio-pane-head h2 { margin: 0; font-size: 21px; font-weight: 680; letter-spacing: -.01em; }
.studio-pane-num {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: 14px; font-weight: 700;
}
.studio-pane .node-body { gap: 16px; padding: 0; }
.studio-pane .node-body > p { font-size: 14px; }
.studio-pane .node-body > .btn, .studio-pane .node-body > .studio-wait { justify-self: start; }
.studio-pane .studio-modes button { padding: 8px 10px; font-size: 14px; }
/* 1. фото: место для загрузки во всю ширину; загруженное фото слева, кнопки справа */
.studio-pane #photo-body { max-width: 860px; }
.studio-pane .studio-drop { gap: 8px; padding: 48px 20px; font-size: 15px; }
.studio-pane .studio-drop small { font-size: 13px; }
.studio-pane .pick-row { margin-top: -4px; }
.studio-pane .node-img { max-width: 420px; }
#photo-body:has(> .studio-photo-side) { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 16px 28px; align-items: start; }
.studio-photo-side { display: grid; gap: 12px; align-content: start; justify-items: start; min-width: 0; }
.studio-photo-side > * { margin: 0; }
.studio-photo-side .studio-photo-actions { margin-top: 0; }
/* 2. товар на кадре: кадр крупно слева, подсказка, ползунки и кнопки справа */
#cut-body:has(> .studio-cut-side) { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 16px 32px; align-items: start; }
.studio-pane .studio-stage { max-width: 520px; }
.studio-cut-side { display: grid; gap: 18px; align-content: start; min-width: 0; max-width: 460px; }
.studio-cut-side .hint { font-size: 13.5px; line-height: 1.5; }
.studio-pane .studio-range .label { font-size: 12.5px; }
/* 3. фон: форма читаемой ширины */
.studio-pane #scene-body { max-width: 720px; }
.studio-pane #scene-body .studio-modes { max-width: 380px; }
.studio-pane #scene-body textarea { min-height: 96px; }
.studio-pane .studio-presets .chip-btn { padding: 7px 12px; font-size: 13.5px; }
/* 4. варианты: кадры парой, однотонный кадр один */
.studio-pane .studio-run { gap: 10px; max-width: 900px; }
.studio-pane .studio-run + .studio-run { padding-top: 18px; }
.studio-pane .studio-run-head { font-size: 14.5px; font-weight: 600; }
.studio-pane .studio-run-head .muted { font-weight: 400; }
.studio-pane .studio-variants { gap: 16px; }
.studio-pane .studio-variants.single { max-width: 442px; }
/* белый однотонный кадр не сливается со страницей */
.studio-pane .studio-variants img { border: 1px solid var(--border); }
.studio-pane .studio-variants figcaption { font-size: 12.5px; }
/* 5. видеообложка: настройки слева, готовая обложка справа */
#cover-body:has(> .cover-result) { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 18px 36px; align-items: start; }
.studio-pane #cover-body { max-width: 1000px; }
.cover-form { display: grid; gap: 16px; align-content: start; max-width: 560px; min-width: 0; }
.cover-form > .btn { justify-self: start; }
.cover-result { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cover-result .cover-video { margin-top: 0; max-height: 72vh; width: auto; max-width: 100%; }
.cover-result .cover-actions { margin-top: 0; }
/* «Назад» и «Дальше» под шагом */
.studio-pager {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px 28px;
  border-top: 1px solid var(--border); border-radius: 0 0 18px 18px; background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}
#studio-back { grid-column: 1; justify-self: start; }
.studio-pos { grid-column: 2; color: var(--muted); font-size: 13px; }
#studio-next { grid-column: 3; justify-self: end; max-width: 100%; white-space: nowrap; }
#studio-next-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.studio-pager .btn[hidden] { display: none; }
@media (max-width: 760px) {
  #photo-body:has(> .studio-photo-side), #cut-body:has(> .studio-cut-side), #cover-body:has(> .cover-result) { grid-template-columns: minmax(0, 1fr); }
  .studio-pane .node-img, .studio-pane .studio-stage { max-width: none; }
  .studio-cut-side, .cover-form { max-width: none; }
}
/* телефон: полоса шагов компактная и прокручивается вбок, шаг во всю ширину */
@media (max-width: 640px) {
  .studio-steps { gap: 0; margin-bottom: 12px; padding: 4px; border-radius: 14px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .studio-steps::-webkit-scrollbar { display: none; }
  .studio-steps > li { flex: none; min-width: 0; scroll-snap-align: center; }
  .studio-steps > li + li::before { margin: 0 5px 0 2px; }
  .studio-step { gap: 8px; padding: 6px 10px 6px 6px; }
  .studio-step-num { width: 24px; height: 24px; font-size: 12px; }
  .studio-step-title { font-size: 13px; }
  .studio-step-sum { max-width: 118px; font-size: 11.5px; }
  .studio-area { border-radius: 16px; }
  .studio-pane { padding: 18px 16px 20px; }
  .studio-pane-head { margin-bottom: 16px; }
  .studio-pane-head h2 { font-size: 19px; }
  .studio-pane-num { width: 26px; height: 26px; font-size: 13px; }
  .studio-pane .studio-drop { padding: 32px 16px; }
  .studio-pane .studio-variants { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .studio-pager { grid-template-columns: auto minmax(0, 1fr); padding: 12px 16px; border-radius: 0 0 16px 16px; }
  .studio-pos { display: none; }
  #studio-next { grid-column: 2; }
}

/* скидка первого месяца (plans.FIRST_DISCOUNT, D:/Claude-temp/patches/patch_discount.py): плашка «−30%» у «Пополнить»,
   на карточках тарифов и странице «Оплата»; значок на аватарке: точка (plans.FIRST_BADGE = "dot") или «%» ("pct") */
.deal-tag { display: inline-flex; align-items: center; flex: none; padding: 1px 7px; border-radius: 99px; background: var(--ok-soft);
  color: var(--ok); font-size: 11.5px; font-style: normal; font-weight: 700; line-height: 1.5; letter-spacing: 0;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.avatar-deal { position: absolute; top: -3px; right: -3px; z-index: 1; border: 2px solid var(--surface); border-radius: 50%;
  background: var(--ok); pointer-events: none; }
.avatar-deal-dot { width: 10px; height: 10px; }
.avatar-deal-pct { display: grid; place-items: center; top: -6px; right: -7px; width: 17px; height: 17px; color: var(--surface);
  font-size: 10.5px; font-weight: 800; line-height: 1; }
.account-menu[open] .avatar-deal { border-color: var(--surface-2); }
.plan-price s { color: var(--muted); font-size: 17px; font-weight: 550; }
.plan-first { margin-top: -4px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.plan-first .deal-tag { margin-right: 6px; vertical-align: 1px; }
.buy-option { align-content: start; }   /* карточки разной высоты: текст сверху, а не растянут по высоте */
.buy-option .deal-tag { position: absolute; top: 12px; right: 12px; font-size: 11.5px; }
.buy-option span s { color: var(--muted); font-size: 14px; font-weight: 550; }
.pay-deal { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin: -4px 0 0; padding: 10px 14px;
  border-radius: 12px; background: var(--ok-soft); color: var(--text); font-size: 14.5px; }
.pay-deal .deal-tag { background: var(--surface); }
.stat-first b { font-size: 20px; }

/* смена тарифа (D:/Claude-temp/patches/patch_plan_rollover.py): строка у тарифов на «Оплате» */
.plan-carry { margin: 0; }

/* «Оплата» по статусу подписки (D:/Claude-temp/patches/patch_topup_by_status.py): предупреждение над пакетами крупно,
   остаток кредитов пакетов у человека без подписки */
.pack-warn { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 2px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--border)); background: var(--warn-soft); color: var(--text);
  font-size: 15.5px; font-weight: 650; line-height: 1.45; }
.pack-warn::before { content: "!"; flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 50%; background: var(--warn); color: var(--surface); font-size: 14px; font-weight: 800; line-height: 1; }
.pack-left { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; line-height: 1.45; }

/* бегущая строка с названиями моделей под плитками «Создать» (aigen/ticker.py, templates/_model_ticker.html,
   patch_model_ticker.py, 31.10.2026). Дорожка из двух одинаковых списков сдвигается на половину своей ширины: круг
   без шва. Время круга по длине списка (класс model-ticker-<секунды>), поэтому скорость одна при любом числе моделей;
   на телефоне в 1,3 раза медленнее (--ticker-slow): экран узкий, и название на нём видно всего несколько секунд.
   Под курсором строка стоит. С клавиатуры (Tab) стоит в начале и сама прокручивается к выбранному названию, после
   выхода из строки прокрутка сбрасывается (overflow: clip). При «уменьшить движение» один список, его листают. */
.model-ticker {
  --ticker-time: 60s; --ticker-slow: 1; --ticker-fade: 32px;
  margin: -24px 0 0; padding: 2px 0; overflow: hidden; overflow: clip;
  font-size: 14px; line-height: 1.5; scrollbar-width: none; scroll-padding-inline: var(--ticker-fade);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--ticker-fade), #000 calc(100% - var(--ticker-fade)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--ticker-fade), #000 calc(100% - var(--ticker-fade)), transparent);
}
.model-ticker::-webkit-scrollbar { display: none; }
.model-ticker-track { display: flex; width: max-content; animation: model-ticker calc(var(--ticker-time) * var(--ticker-slow)) linear infinite; }
.model-ticker-list { display: flex; flex: none; margin: 0; padding: 0; list-style: none; }
.model-ticker-list li { flex: none; white-space: nowrap; }
/* бренды со значками вместо названий моделей (patch_model_brands.py, 01.11.2026): между брендами отступ, а не точка;
   значок цветом подписи (currentColor), под курсором оба цвета акцента */
.model-ticker-list li { padding-right: 1.9em; }
.model-ticker-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.model-ticker-icon { width: 1.2em; height: 1.2em; flex: none; fill: currentColor; }
.model-ticker a { display: inline-flex; align-items: center; gap: .45em; padding: 3px 2px; border-radius: 6px; color: var(--muted); text-decoration: none; transition: color .15s; }
.model-ticker a:hover { color: var(--accent); }
.model-ticker a:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; color: var(--text); }
.model-ticker:hover .model-ticker-track, .model-ticker:focus-within .model-ticker-track { animation-play-state: paused; }
.model-ticker:has(a:focus-visible) { overflow-x: auto; }
.model-ticker:has(a:focus-visible) .model-ticker-track { animation: none; }
@keyframes model-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.model-ticker-30 { --ticker-time: 30s; } .model-ticker-35 { --ticker-time: 35s; } .model-ticker-40 { --ticker-time: 40s; } .model-ticker-45 { --ticker-time: 45s; } .model-ticker-50 { --ticker-time: 50s; }
.model-ticker-55 { --ticker-time: 55s; } .model-ticker-60 { --ticker-time: 60s; } .model-ticker-65 { --ticker-time: 65s; } .model-ticker-70 { --ticker-time: 70s; } .model-ticker-75 { --ticker-time: 75s; }
.model-ticker-80 { --ticker-time: 80s; } .model-ticker-85 { --ticker-time: 85s; } .model-ticker-90 { --ticker-time: 90s; } .model-ticker-95 { --ticker-time: 95s; } .model-ticker-100 { --ticker-time: 100s; }
.model-ticker-105 { --ticker-time: 105s; } .model-ticker-110 { --ticker-time: 110s; } .model-ticker-115 { --ticker-time: 115s; } .model-ticker-120 { --ticker-time: 120s; } .model-ticker-125 { --ticker-time: 125s; }
.model-ticker-130 { --ticker-time: 130s; } .model-ticker-135 { --ticker-time: 135s; } .model-ticker-140 { --ticker-time: 140s; } .model-ticker-145 { --ticker-time: 145s; } .model-ticker-150 { --ticker-time: 150s; }
:root[data-theme="grey"] .model-ticker a, :root[data-theme="grey"] .model-ticker-list li::before { color: var(--on-bg-muted); }
:root[data-theme="grey"] .model-ticker a:is(:hover, :focus-visible) { color: var(--on-bg); }
@media (max-width: 520px) { .model-ticker { --ticker-slow: 1.3; --ticker-fade: 20px; font-size: 13px; } }
@media (prefers-reduced-motion: reduce) {
  .model-ticker {
    overflow-x: auto; scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--ticker-fade)), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - var(--ticker-fade)), transparent);
  }
  .model-ticker-track { animation: none; }
  .model-ticker-list { padding-right: var(--ticker-fade); }
  .model-ticker-list[aria-hidden="true"] { display: none; }
  .model-ticker-list li:first-child::before { content: none; }
}
/* новая карточка задания: место под шапкой при прокрутке и короткая подсветка (patch_mobile_scroll_job.py) */
@media (max-width: 900px) { .job { scroll-margin-top: 128px; } }
.job.job-new { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .4s; }
