/* Aibient UI — личный кабинет v2 (из dev-notes/ui_v2).
   Подключается после style.css только в layouts/app.php. style.css остаётся
   для админки и лендинга, поэтому блоки каркаса здесь названы иначе:
   .side (меню), .topnav (топбар), .dock (плеер), .bubble (сообщения Музы).
   ID фич из документа указаны в комментариях: SHELL-01, QUE-03 и т. д. */

:root {
  --bg-0: #0a0b12;
  --bg-1: #11131f;
  --bg-2: #181b2b;
  --bg-3: #20243a;
  --line: #2a2f48;
  --line-soft: #20243a;

  --text: #e8eaf6;
  --text-2: #c3c8e2;
  --text-dim: #9aa0c0;
  --text-mute: #8a90b2;

  --neon: #7c5cff;
  --neon-strong: #5a3df0;
  --neon-2: #00e5ff;
  --neon-3: #ff3df0;
  --ok: #2ee6a6;
  --warn: #ffc145;
  --err: #ff5577;

  /* SPK-01: три типа Искр */
  --spark-gold: #ffc53d;
  --spark-emerald: #34d399;
  --spark-fire: #ff7a3d;

  /* Цвет модальности (DEC-15: текст — светло-серый) */
  --m-music: #7c5cff;
  --m-text: #c7cce0;
  --m-image: #00e5ff;
  --m-video: #ff3df0;
  --m-fx: #2ee6a6;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --side-w: 232px;
  --side-w-compact: 72px;
  --muse-w: 340px;
  --topnav-h: 64px;
  --dock-h: 64px;
  --tabbar-h: 68px;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .5);
  --glow: 0 0 18px rgba(124, 92, 255, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--neon-2); text-decoration: none; }
a:hover { color: #7ff3ff; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--neon-2); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.num { font-variant-numeric: tabular-nums; }
.grow { flex-grow: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ico { width: 18px; height: 18px; flex: none; }
.ico--sm { width: 14px; height: 14px; }
.ico--lg { width: 22px; height: 22px; }
.kbd {
  font-size: 11px; color: var(--text-dim); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; line-height: 1.4;
}

/* ───────── SHELL-01…04: каркас ───────── */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}
.app__main { display: flex; flex-direction: column; min-width: 0; }
.content { flex-grow: 1; padding: 20px 24px 32px; min-width: 0; }

/* Rail */
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px; background: var(--bg-1); border-right: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 12px; color: var(--text); }
.side__logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: conic-gradient(from 180deg, var(--neon), var(--neon-2), var(--neon-3), var(--neon));
}
.side__name { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.side__create { height: 44px; }
.side__group { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.side__label { font-size: 11px; color: var(--text-mute); padding: 2px 10px 4px; letter-spacing: .3px; }
.side__item {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px;
  border-radius: 10px; color: #b4b9d6; font-size: 14px; white-space: nowrap;
}
.side__item:hover { color: var(--text); background: var(--bg-2); }
.side__item[aria-current="page"] { color: #fff; background: var(--bg-3); box-shadow: inset 3px 0 0 var(--neon); }
.side__text { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; }
.side__badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: rgba(124, 92, 255, .3); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.side__badge--beta { background: rgba(255, 61, 240, .16); color: #ff9cf8; }
.side__spacer { flex-grow: 1; }
.side__bonus {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
}
.side__bonus small { display: block; font-size: 12px; color: var(--text-dim); }

/* SHELL-02 Топбар */
.topnav {
  position: sticky; top: 0; z-index: 30; height: var(--topnav-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(17, 19, 31, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.topnav__title { font-size: 18px; font-weight: 600; min-width: 120px; }
.topnav__search {
  display: flex; align-items: center; gap: 8px; height: 36px; width: min(320px, 30vw);
  padding: 0 12px; border-radius: var(--r-sm); background: var(--bg-0);
  border: 1px solid var(--line); color: var(--text-mute); font-size: 13px; text-align: left;
}
.topnav__search:hover { border-color: var(--neon); }
.topnav__spacer { flex-grow: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; white-space: nowrap;
}
.pill:hover { border-color: var(--neon); }
.pill--queue[data-active="true"] { background: rgba(124, 92, 255, .14); border-color: var(--neon); }
.pill--queue[aria-expanded="true"] { box-shadow: var(--glow); }
.pill__spin { width: 16px; height: 16px; }
.pill__text-short { display: none; }
.pill--queue[data-active="true"] .pill__spin { animation: spin 1.1s linear infinite; }
.sparks { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; }
.sparks__item { display: inline-flex; align-items: center; gap: 5px; }
.spark { width: 14px; height: 14px; flex: none; }
.spark--gold { color: var(--spark-gold); }
.spark--emerald { color: var(--spark-emerald); }
.spark--fire { color: var(--spark-fire); }
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line); color: #b4b9d6;
}
.icon-btn:hover { color: var(--text); border-color: var(--neon); }
.icon-btn--sq { border-radius: var(--r-sm); width: 32px; height: 32px; background: transparent; }
.icon-btn__badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--neon-3); color: var(--bg-0);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--neon-2), var(--neon)); color: var(--bg-0);
  font-weight: 700; font-size: 14px;
}
/* SHELL-04 Сквозной плеер */
.dock {
  position: sticky; bottom: 0; z-index: 25; height: var(--dock-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--bg-1); border-top: 1px solid var(--line);
}
.dock__cover { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--bg-3); flex: none; }
.dock__meta { width: 220px; min-width: 0; }
.dock__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__sub { font-size: 12px; color: var(--text-dim); }
.dock__bar { flex-grow: 1; height: 4px; border-radius: 2px; background: var(--bg-3); cursor: pointer; position: relative; }
.dock__fill { height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--neon-2), var(--neon)); }
.dock[data-empty="true"] .dock__title { color: var(--text-mute); font-weight: 400; }
/* Плеер с очередью (задача 26) */
.dock__controls { display: flex; align-items: center; gap: 4px; flex: none; }
.dock__btn { width: 34px; height: 34px; color: var(--text-dim); }
.dock__btn:hover:not(:disabled) { color: var(--text); }
.dock__btn:disabled { opacity: .35; cursor: default; }
.dock__opt[aria-pressed="true"] { color: var(--neon-2); }
.dock__opt[data-mode="one"] { position: relative; }
.dock__opt[data-mode="one"]::after { content: "1"; position: absolute; right: 4px; bottom: 3px; font-size: 9px; font-weight: 700; color: var(--neon-2); }
.dock__queue { position: relative; }
.dock__queue[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--neon); color: #fff; font-size: 9px; font-weight: 700; line-height: 15px; text-align: center; }
.dock__vol { display: flex; align-items: center; gap: 6px; color: var(--text-dim); flex: none; }
.dock__vol input { width: 80px; accent-color: var(--neon-2); }
.dock[data-empty="true"] .dock__controls .dock__btn, .dock[data-empty="true"] .dock__more { opacity: .35; pointer-events: none; }
.qpanel { position: fixed; right: 16px; bottom: calc(var(--dock-h) + 10px); z-index: 60; width: min(420px, calc(100vw - 32px)); max-height: min(60vh, 520px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.qpanel__head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.qpanel__head [aria-pressed="true"] { color: var(--neon-2); }
.qpanel__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.qpanel__item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.qpanel__item:hover { background: var(--bg-3); }
.qpanel__item.is-current { background: rgba(124, 92, 255, .16); }
.qpanel__item.is-current .qpanel__title { color: var(--neon-2); }
.qpanel__item.is-drag { opacity: .4; }
.qpanel__grip { color: var(--text-mute); cursor: grab; font-size: 11px; letter-spacing: -2px; }
.qpanel__cover { width: 36px; height: 36px; border-radius: 6px; flex: none; background-size: cover !important; background-position: center !important; }
.qpanel__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qpanel__title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qpanel__sub { font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qpanel__dur { font-size: 11px; color: var(--text-mute); }
.qpanel__empty { padding: 18px 16px; margin: 0; color: var(--text-mute); font-size: 13px; }
.icon-btn--sm { width: 28px; height: 28px; }
/* Кнопки треков: текущий трек в списке подсвечен */
[data-play-src].is-current { color: var(--neon-2); border-color: var(--neon-2); }
[data-play-row].is-playing { background: rgba(124, 92, 255, .10); }
[data-play-row].is-playing .at-title a, [data-play-row].is-playing .tc-title a { color: var(--neon-2); }
/* Переход между страницами без перезагрузки — тонкая полоска сверху */
html[data-loading] body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; background: linear-gradient(90deg, var(--neon-2), var(--neon), var(--neon-3)); animation: aib-load 1s ease-in-out infinite; transform-origin: left; }
@keyframes aib-load { 0% { transform: scaleX(.1); opacity: 1; } 70% { transform: scaleX(.8); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; flex: none; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--neon), var(--neon-2));
}
.play-btn--sm { width: 32px; height: 32px; }

/* MUSE-01 Панель Музы: колонка от 1600 px, выезжающая панель уже */
.muse {
  position: fixed; top: 0; right: 0; z-index: 60; width: var(--muse-w); height: 100vh;
  display: flex; flex-direction: column; background: var(--bg-1); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop);
}
.app[data-muse="open"] .muse { transform: none; }
.muse__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.muse__avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 35%, #ff8ff7, var(--neon) 60%, var(--bg-3));
}
.muse__title { font-weight: 600; font-size: 15px; }
.muse__ctx { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muse__log { flex-grow: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 92%; padding: 12px 14px; font-size: 14px; line-height: 1.5; border: 1px solid var(--line); }
.bubble--muse { align-self: flex-start; background: var(--bg-2); border-radius: 14px 14px 14px 4px; }
.bubble--me { align-self: flex-end; background: rgba(124, 92, 255, .16); border-color: rgba(124, 92, 255, .35); border-radius: 14px 14px 4px 14px; }
.bubble__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bubble--typing { color: var(--text-dim); }
.muse__sugg { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.muse__form { padding: 12px 16px 16px; border-top: 1px solid var(--line-soft); }
.muse__input {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 10px 14px;
  border-radius: var(--r); background: var(--bg-0); border: 1px solid var(--line);
}
.muse__input:focus-within { border-color: var(--neon); }
.muse__input textarea { min-height: 0; padding: 0; border-radius: 0; box-shadow: none; flex-grow: 1; resize: none; background: transparent; border: none; outline: none; font-size: 14px; max-height: 140px; }
.muse__hint { margin-top: 8px; font-size: 12px; color: var(--text-mute); }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(5, 6, 10, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.app[data-muse="open"] .scrim--muse, .app[data-sheet="composer"] .scrim--sheet { opacity: 1; pointer-events: auto; }

@media (min-width: 1600px) {
  .app { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--muse-w); }
  .app[data-muse="closed"] { grid-template-columns: var(--side-w) minmax(0, 1fr) 0; }
  .muse { position: sticky; transform: none; box-shadow: none; z-index: 20; }
  .app[data-muse="closed"] .muse { visibility: hidden; }
  .app[data-muse="open"] .scrim--muse { opacity: 0; pointer-events: none; }
}

/* ───────── Общие компоненты ───────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text-2); font-size: 13px; font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { color: var(--text); border-color: var(--neon-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(135deg, var(--neon), var(--neon-strong)); border-color: var(--neon);
  color: #fff; font-weight: 600; box-shadow: var(--glow);
}
.btn--primary:hover { color: #fff; border-color: var(--neon); box-shadow: 0 0 24px rgba(124, 92, 255, .55); }
.btn--soft { background: rgba(124, 92, 255, .18); border-color: var(--neon); color: #fff; font-weight: 600; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn--lg { height: 52px; padding: 0 20px; font-size: 17px; font-weight: 700; border-radius: var(--r); }
.btn--block { width: 100%; }
.btn--dashed { border-style: dashed; }
.btn--danger { color: #ff8fa5; border-color: rgba(255, 85, 119, .45); }
.btn__price {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px;
  border-radius: 999px; background: rgba(10, 11, 18, .45); font-size: 14px;
}

.muse-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border-radius: 999px; background: rgba(255, 61, 240, .1); border: 1px solid rgba(255, 61, 240, .35);
  color: #ff9cf8; font-size: 12px; white-space: nowrap; flex: none;
}
.muse-btn:hover { background: rgba(255, 61, 240, .18); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text-2); font-size: 13px; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: #4a4f7a; }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.is-on {
  border-color: var(--neon); background: rgba(124, 92, 255, .18); color: #fff;
}
.chip--sm { height: 26px; padding: 0 10px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dot, var(--text-mute)); }
[data-mod="music"] { --mod: var(--m-music); }
[data-mod="text"] { --mod: var(--m-text); }
[data-mod="image"] { --mod: var(--m-image); }
[data-mod="video"] { --mod: var(--m-video); }
[data-mod="fx"] { --mod: var(--m-fx); }
.dot[data-mod] { background: var(--mod); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--line); }
.seg__btn { height: 30px; padding: 0 12px; border-radius: 7px; border: none; background: transparent; color: #b4b9d6; font-size: 13px; }
.seg__btn[aria-pressed="true"], .seg__btn[aria-selected="true"] { background: var(--neon); color: #fff; }

.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); }
.card--pad { padding: 18px; }
.section-title { font-size: 16px; font-weight: 600; }
.h2 { font-size: 20px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field__label { font-size: 12px; color: var(--text-dim); font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.app .input, .app .textarea, .app .select {
  width: 100%; font-family: var(--font); min-height: 0; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: 14px; line-height: 1.5; padding: 10px 12px;
}
.app .input:focus, .app .textarea:focus, .app .select:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
.app .textarea { resize: vertical; min-height: 88px; }
.app .textarea--mono { font-family: var(--mono); font-size: 13px; }
.textarea--big { font-size: 16px; }
.range { width: 100%; accent-color: var(--neon); }
.check { width: 16px; height: 16px; accent-color: var(--neon); flex: none; }

.switch { margin: 0; color: var(--text-2); font-weight: 400; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; min-height: 32px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform .15s var(--ease), background .15s; }
.switch input:checked { background: var(--neon); border-color: var(--neon); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }

.notice {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 13px; background: rgba(124, 92, 255, .08); border: 1px solid rgba(124, 92, 255, .3);
}
.notice--warn { background: rgba(255, 193, 69, .08); border-color: rgba(255, 193, 69, .35); color: #ffd27a; }
.notice--err { background: rgba(255, 85, 119, .08); border-color: rgba(255, 85, 119, .35); color: #ff8fa5; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--st, var(--text-dim)); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--ok { --st: var(--ok); }
.status--run { --st: var(--neon-2); }
.status--wait { --st: var(--warn); }
.status--err { --st: #ff8fa5; }
.status--off { --st: var(--text-mute); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-dim); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty__title { color: var(--text); font-size: 16px; font-weight: 600; }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }

/* Оценки CARD-02 / HIS-02 */
.rate { display: inline-flex; gap: 2px; }
.rate__btn { width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-mute); display: inline-flex; align-items: center; justify-content: center; }
.rate__btn:hover { color: var(--text); background: var(--bg-2); }
.rate__btn[data-kind="up"][aria-pressed="true"] { color: var(--neon-2); }
.rate__btn[data-kind="down"][aria-pressed="true"] { color: var(--err); }
.rate__btn[data-kind="fav"][aria-pressed="true"] { color: var(--spark-gold); }
.rate__btn[data-kind="fav"][aria-pressed="true"] svg { fill: currentColor; }
.rate__btn[data-kind="down"] svg { transform: rotate(180deg); }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text-dim); }

/* ───────── STU-03 / CARD-01: карточка задачи и ассета ───────── */

.task {
  display: grid; grid-template-columns: 3px minmax(0, 1fr); overflow: hidden;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r);
  animation: enter .25s var(--ease);
}
.task::before { content: ""; background: var(--mod, var(--neon)); }
.task__body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.task__head { display: flex; align-items: center; gap: 12px; }
.task__cover { width: 44px; height: 44px; border-radius: var(--r-sm); flex: none; background: var(--cover, var(--bg-3)); }
.task__title { font-weight: 600; font-size: 15px; }
.task__meta { font-size: 12px; color: var(--text-dim); }
.task__actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.task[data-state="running"] { border-color: var(--neon); box-shadow: 0 0 18px rgba(124, 92, 255, .2); }
.task[data-state="failed"] { border-color: rgba(255, 85, 119, .45); }
.task[data-state="queued"] .task__body, .task[data-state="failed"] .task__body { padding-top: 12px; padding-bottom: 12px; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; }
.steps__item { display: flex; align-items: center; gap: 6px; color: var(--text-mute); }
.steps__item::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.steps__item[data-st="done"] { color: var(--text); }
.steps__item[data-st="done"]::before { background: var(--ok); }
.steps__item[data-st="active"] { color: var(--text); }
.steps__item[data-st="active"]::before { background: var(--neon-2); box-shadow: 0 0 8px var(--neon-2); animation: pulse 1.4s infinite; }
.steps__item:not(:last-child)::after { content: "›"; color: #3a4060; margin-left: 2px; }

.wave { display: flex; align-items: center; gap: 2px; height: 30px; min-width: 0; overflow: hidden; flex-grow: 1; cursor: pointer; }
.wave__bar { width: 3px; flex: none; border-radius: 2px; background: #4a4f7a; }
.wave__bar.is-played { background: var(--neon-2); }
.variant { display: flex; align-items: center; gap: 10px; }
.variant__n { font-size: 12px; color: var(--text-dim); width: 18px; }
.preview { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-0); }
.thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 72px)); gap: 8px; }
.thumb { aspect-ratio: 3 / 4; border-radius: var(--r-sm); background: var(--bg-2); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--neon-2); overflow: hidden; }
.thumb--busy { border-style: solid; background: var(--bg-3); }
.thumb--busy .ico { animation: spin 1.1s linear infinite; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ───────── STU / GEN: Студия ───────── */

.studio { display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.composer { position: sticky; top: calc(var(--topnav-h) + 16px); max-height: calc(100vh - var(--topnav-h) - var(--dock-h) - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.composer__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer__tabs { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.composer__inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; }
.composer__inputs[data-drop="over"] { outline: 2px dashed var(--neon); outline-offset: 4px; border-radius: var(--r-sm); }
.input-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-0); font-size: 13px; }
.input-chip button { width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--bg-3); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; }
.composer__go { display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: -18px; padding: 12px 0 2px; background: linear-gradient(transparent, var(--bg-1) 30%); }
.composer__note { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.composer__pro { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-radius: 10px; background: var(--bg-0); border: 1px dashed var(--line); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); font-size: 14px; }
.tile[aria-pressed="true"] { border-color: var(--neon); background: rgba(124, 92, 255, .18); color: #fff; }
.model-pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--line); color: var(--text); text-align: left; width: 100%; }

/* GEN: видимость полей по уровню */
.composer[data-level="simple"] [data-level-min="detail"],
.composer[data-level="simple"] [data-level-min="pro"],
.composer[data-level="detail"] [data-level-min="pro"],
.composer:not([data-level="simple"]) [data-level-only="simple"] { display: none; }
/* …и по модальности: у текста свои поля, у фото и видео пока только уведомление */
.composer[data-mod="text"] [data-level-seg], .composer[data-mod="image"] [data-level-seg],
.composer:not([data-mod="music"]) [data-mod-only="music"],
.composer:not([data-mod="text"]) [data-mod-only="text"],
.composer:not([data-mod="image"]) [data-mod-only="image"],
.composer:not([data-mod="video"]) [data-mod-only="video"] { display: none; }
.clip { width: 100%; max-width: 520px; border-radius: var(--r-sm); background: #000; display: block; }

.feed { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.feed__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feed__day { font-size: 13px; font-weight: 600; color: var(--text-dim); margin-top: 4px; }

/* ───────── QUE-03 / QUE-04: очередь и тосты ───────── */

.popover {
  position: fixed; z-index: 70; width: 440px; max-width: calc(100vw - 24px);
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden;
}
.popover__head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.popover__foot { display: flex; justify-content: space-between; padding: 10px 14px; font-size: 13px; color: var(--text-dim); }
.qrow { display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line-soft); }
.qrow::before { content: ""; height: 36px; background: var(--mod, var(--neon)); }
.qrow__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toasts { position: fixed; right: 20px; bottom: calc(var(--dock-h) + 16px); z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--ok); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: enter .25s var(--ease);
}
.toast--err { border-color: var(--err); }
.toast__body { flex-grow: 1; min-width: 0; }
.toast__title { font-size: 14px; font-weight: 600; }
.toast__sub { font-size: 12px; color: var(--text-dim); }

/* SHELL-06 Командная палитра */
.cmdk { position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 10, .6); display: flex; justify-content: center; padding-top: 12vh; }
.cmdk__box { width: min(600px, calc(100vw - 32px)); max-height: 60vh; display: flex; flex-direction: column; background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; }
.cmdk .cmdk__input { width: 100%; border-radius: 0; box-shadow: none; border: none; border-bottom: 1px solid var(--line-soft); background: transparent; padding: 16px 18px; font-size: 16px; outline: none; }
.cmdk__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.cmdk__item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; cursor: pointer; }
.cmdk__item[aria-selected="true"] { background: var(--bg-3); }
.cmdk__item small { margin-left: auto; color: var(--text-mute); }

/* ───────── HIS: Хроника ───────── */

.history { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; align-items: start; }
.cal { position: sticky; top: calc(var(--topnav-h) + 16px); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow { font-size: 11px; color: var(--text-mute); text-align: center; }
.cal__day { position: relative; aspect-ratio: 1; border-radius: 6px; border: 1px solid transparent; font-size: 11px; color: var(--text-dim); background: var(--bg-2); }
.cal__day[data-lvl="1"] { background: rgba(124, 92, 255, .3); }
.cal__day[data-lvl="2"] { background: rgba(124, 92, 255, .55); color: #fff; }
.cal__day[data-lvl="3"] { background: rgba(124, 92, 255, .85); color: #fff; }
.cal__day[data-fav="true"]::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--spark-gold); }
.cal__day[aria-current="date"], .cal__day[aria-pressed="true"] { border: 2px solid var(--neon-2); }
.cal__day:disabled { visibility: hidden; }
/* Будущие дни месяца видны, но приглушены — иначе в начале месяца календарь выглядит пустым */
.cal__day[data-future] { visibility: visible; opacity: .3; cursor: default; }
.cal__legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-mute); }
.cal__legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cal__stats { padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cal__stats div { display: flex; justify-content: space-between; }
.day { display: flex; flex-direction: column; gap: 6px; scroll-margin-top: calc(var(--topnav-h) + 16px); }
.day__title { position: sticky; top: var(--topnav-h); z-index: 5; display: flex; justify-content: space-between; padding: 8px 0; background: var(--bg-0); font-size: 13px; font-weight: 600; color: var(--text-dim); }
/* Колонка оценок фиксированной ширины: в строках без оценок (ошибка, в работе) она
   не схлопывается, и модель со статусом стоят ровно под соседними строками */
.hrow { --rate-w: 104px; }
.hrow__model { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow { display: grid; grid-template-columns: 3px 44px minmax(0, 1fr) 150px 120px var(--rate-w) 48px; align-items: center; gap: 12px; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line-soft); }
.hrow::before { content: ""; height: 44px; background: var(--mod); }
.hrow__thumb { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--cover, var(--bg-3)); }
.hrow__title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow__prompt { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow__reasons { grid-column: 3 / -1; padding-bottom: 4px; }

/* ───────── INS: Вдохновение ───────── */

.shelf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.cover { position: relative; aspect-ratio: 1; border-radius: var(--r); background: var(--cover, var(--bg-3)); overflow: hidden; }
.cover__play { position: absolute; left: 10px; bottom: 10px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(10, 11, 18, .72); color: #fff; display: flex; align-items: center; justify-content: center; }
.cover__tag { position: absolute; top: 8px; left: 8px; height: 22px; padding: 0 8px; border-radius: 999px; background: rgba(10, 11, 18, .75); font-size: 11px; display: flex; align-items: center; }
.tile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.work { display: flex; flex-direction: column; overflow: hidden; }
.work::before { content: ""; height: 3px; background: var(--mod); }
.work .cover { border-radius: 0; }
.work__body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* ───────── RCP: Рецепты ───────── */

.ask { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 8px 0 18px; border-radius: 14px; background: var(--bg-1); border: 1px solid var(--neon); box-shadow: 0 0 22px rgba(124, 92, 255, .18); }
.ask input { width: auto; padding: 0; box-shadow: none; flex-grow: 1; background: transparent; border: none; outline: none; font-size: 16px; min-width: 0; }
.recipes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.recipe-card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); }
.recipe-card::before { content: ""; height: 3px; background: var(--mod); }
.recipe-card:hover { border-color: var(--neon); color: var(--text); }
.recipe-card[data-soon="true"] { opacity: .6; }
.ba { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: 132px; }
.ba > div { position: relative; background: var(--b); }
.ba > div + div { border-left: 2px solid var(--bg-0); }
.ba span { position: absolute; left: 8px; bottom: 8px; font-size: 11px; color: var(--bg-0); background: rgba(255, 255, 255, .82); padding: 1px 6px; border-radius: 4px; }
.recipe-card__body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.recipe-card__foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(46, 230, 166, .15); color: var(--ok); }
.tag--soon { background: rgba(255, 61, 240, .15); color: #ff9cf8; }

.recipe { display: grid; grid-template-columns: 460px minmax(0, 1fr); gap: 20px; align-items: start; }
.slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.slot { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); border: 1px dashed #3a4060; background: var(--bg-0); color: var(--text-mute); display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.slot--add:hover { border-color: var(--neon); color: var(--text); }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot[data-q="ok"] { border: 1px solid var(--line); }
.slot[data-q="warn"] { border: 1px solid var(--warn); }
.slot__mark { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; color: var(--bg-0); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.slot[data-q="ok"] .slot__mark { background: var(--ok); }
.slot[data-q="warn"] .slot__mark { background: var(--warn); }
.slot__del { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(10, 11, 18, .75); color: #fff; font-size: 12px; opacity: 0; }
.slot:hover .slot__del, .slot__del:focus-visible { opacity: 1; }
.outs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.out { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.out__img { aspect-ratio: 3 / 4; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--b, #f4f5fa); transition: opacity .15s; }
.out:has(input:not(:checked)) .out__img { opacity: .3; }
.out__label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); }
.price-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 150px 64px; gap: 10px; align-items: center; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.price-row__n { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.price-row__p { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-weight: 600; }
.price-row[data-off="true"] { opacity: .4; text-decoration: line-through; }

/* ───────── MST: Мастерская ───────── */

.ws { display: flex; flex-direction: column; min-width: 0; }
.ws__bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.ws__grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 260px; gap: 14px; padding: 14px 20px; }
.ws__assets { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ws__assets > .row { flex-wrap: wrap; }
.asset { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); background: var(--bg-0); border: 1px solid var(--line-soft); cursor: grab; }
.asset__thumb { width: 36px; height: 36px; border-radius: 6px; background: var(--cover, var(--bg-3)); flex: none; }
.ws__preview { aspect-ratio: 16 / 9; border-radius: var(--r); background: linear-gradient(200deg, #ff3df0 0%, #7c5cff 40%, #11131f 85%); border: 1px solid var(--line); position: relative; overflow: hidden; }
.ws__caption { position: absolute; left: 0; right: 0; bottom: 14%; text-align: center; font-size: 26px; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.ws__insp { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tl { margin: 0 20px 20px; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; user-select: none; }
.tl__row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; }
.tl__ruler { position: relative; height: 22px; border-bottom: 1px solid var(--line); }
.tl__tick { position: absolute; top: 2px; font-size: 11px; color: var(--text-mute); transform: translateX(-50%); }
.tl__name { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.tl__lane { position: relative; height: 38px; border-radius: 6px; background-image: repeating-linear-gradient(90deg, transparent 0 calc(var(--bar) - 1px), var(--line-soft) calc(var(--bar) - 1px) var(--bar)); }
.tl__clip {
  position: absolute; top: 3px; bottom: 3px; border-radius: 5px; padding: 0 8px; display: flex; align-items: center;
  font-size: 12px; white-space: nowrap; overflow: hidden; color: var(--text); cursor: grab;
  background: color-mix(in srgb, var(--mod) 22%, var(--bg-1)); border: 1px solid var(--mod);
}
.tl__clip[aria-selected="true"] { border: 2px solid #fff; }
.tl__clip.is-drag { cursor: grabbing; opacity: .85; }
.tl__lanes { position: relative; display: flex; flex-direction: column; gap: 6px; }
.tl__head { position: absolute; top: -8px; bottom: 0; width: 2px; background: var(--neon-2); box-shadow: 0 0 8px var(--neon-2); pointer-events: none; }

/* ───────── Мобильная версия MOB-01…05 ───────── */

.tabbar { display: none; }
[data-mobile-only] { display: none !important; }
.sheet-handle { display: none; }
.fab-muse { display: none; }

@media (max-width: 1279px) {
  .app { grid-template-columns: var(--side-w-compact) minmax(0, 1fr); }
  .side { padding: 16px 10px; align-items: center; }
  .side__name, .side__label, .side__text, .side__bonus-text, .side__create-text { display: none; }
  .side__item { width: 48px; justify-content: center; padding: 0; position: relative; }
  .side__badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .side__create { width: 48px; padding: 0; }
  .side__group { margin-top: 8px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
  .side__bonus { padding: 6px; border: none; background: transparent; }
  .ws__grid { grid-template-columns: 200px minmax(0, 1fr); }
  .ws__insp { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  .studio, .history, .recipe { grid-template-columns: 1fr; }
  .composer, .cal { position: static; max-height: none; }
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-grid, .recipes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hrow { grid-template-columns: 3px 44px minmax(0, 1fr) var(--rate-w) 48px; }
  .hrow__model, .hrow__status { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topnav { padding: 0 12px; gap: 8px; }
  .topnav__search { width: 36px; padding: 0; justify-content: center; border-radius: 50%; }
  .topnav__search > :not(svg) { display: none; }
  .topnav__title { min-width: 0; font-size: 18px; }
  .sparks > .sparks__item:not(:first-child) { display: none; }
  .pill { padding: 0 10px; }
  .pill__text-long { display: none; }
  .pill__text-short { display: inline; font-variant-numeric: tabular-nums; }
  .task__head { flex-wrap: wrap; }
  .task__head > .grow { flex-basis: calc(100% - 60px); }
  .avatar { display: none; }
  .content { padding: 12px 12px calc(var(--tabbar-h) + var(--dock-h) + 24px); }
  .dock { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + 8px); height: 60px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-2); }
  .dock__bar, .dock .num, .dock__sub, .dock__opt, .dock__vol { display: none; }
  .dock { gap: 6px; }
  .dock__btn { width: 36px; height: 36px; }
  .qpanel { left: 8px; right: 8px; width: auto; bottom: calc(var(--tabbar-h) + 76px); }
  .dock__meta { flex-grow: 1; width: auto; }
  [data-mobile-only] { display: inline-flex !important; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--tabbar-h);
    background: var(--bg-1); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar__item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-dim); font-size: 11px; min-height: 44px; justify-content: center; }
  .tabbar__item[aria-current="page"] { color: #fff; }
  .tabbar__create { justify-self: center; width: 52px; height: 52px; border-radius: 16px; border: none; color: #fff; background: linear-gradient(135deg, var(--neon), var(--neon-strong)); box-shadow: var(--glow); display: flex; align-items: center; justify-content: center; }
  .fab-muse {
    display: flex; position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--dock-h) + 24px); z-index: 41;
    width: 52px; height: 52px; border-radius: 50%; border: none; color: #fff; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 35%, #ff8ff7, var(--neon) 60%, var(--bg-3)); box-shadow: 0 8px 24px rgba(124, 92, 255, .5);
  }
  .topnav__muse { display: none; }
  /* Муза и композер — нижние листы */
  .muse { top: auto; bottom: 0; width: 100%; height: 88vh; border-left: none; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .app[data-muse="open"] .muse { transform: none; }
  .composer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 90vh; height: 90vh;
    border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .22s var(--ease);
  }
  .app[data-sheet="composer"] .composer { transform: none; }
  .sheet-handle { display: block; width: 40px; height: 4px; border-radius: 2px; background: #3a4060; align-self: center; flex: none; }
  .composer__go { bottom: -18px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-grid, .recipes { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history .cal { padding: 12px; }
  .hrow { grid-template-columns: 3px 40px minmax(0, 1fr) var(--rate-w); }
  .hrow__time { display: none; }
  .ws__grid { grid-template-columns: 1fr; padding: 12px 0; }
  .ws__assets { display: none; }
  .tl { margin: 0 0 20px; overflow-x: auto; }
  .tl__row { grid-template-columns: 80px 640px; }
  .feed__head .chip:not(:first-child) { display: none; }
  .btn, .chip, .icon-btn, .rate__btn { min-height: 40px; }
  .toasts { bottom: calc(var(--tabbar-h) + var(--dock-h) + 24px); right: 16px; }
  .popover { left: 12px !important; right: 12px; width: auto; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ───────── Совместимость со старыми страницами внутри нового каркаса ─────────
   Альбомы, плейлисты, голоса, настройки и редактор трека пока свёрстаны на
   классах style.css. Базовый .btn здесь перебивает старый, поэтому старые
   модификаторы переопределены в стиле v2 — иначе .btn-primary терял бы фон. */
.btn-primary {
  background: linear-gradient(135deg, var(--neon), var(--neon-strong)); border-color: var(--neon);
  color: #fff; font-weight: 600; box-shadow: var(--glow);
}
.btn-primary:hover { color: #fff; border-color: var(--neon); }
.btn-ghost { background: var(--bg-2); color: var(--text-2); border-color: var(--line); }
.btn-danger { background: rgba(255, 85, 119, .12); color: #ff8fa5; border-color: rgba(255, 85, 119, .45); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.content > h1:first-child, .content > h2:first-child { margin-bottom: 16px; }

/* ───────── Меню аккаунта (аватар в топбаре) ───────── */
.menu { position: fixed; z-index: 70; min-width: 240px; padding: 6px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); }
.menu__head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.menu__name { font-weight: 600; font-size: 14px; }
.menu__mail { font-size: 12px; color: var(--text-dim); }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font-size: 14px; text-align: left; }
.menu__item:hover { background: var(--bg-2); color: var(--text); }
.menu__item--danger:hover { color: #ff8fa5; }
.menu__sep { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* ───────── Текст песни в ленте Студии ───────── */
.lyric { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg-0); border: 1px solid var(--line-soft); }
.lyric__title { font-size: 13px; font-weight: 600; }
.lyric__text { font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; max-height: 9.3em; overflow: hidden; }
.lyric[data-open="true"] .lyric__text { max-height: none; }

/* Обложка-картинка вместо градиента: --cover = url(...) center/cover */
.task__cover, .hrow__thumb, .cover, .dock__cover { background-size: cover; background-position: center; }
.side__item--admin { color: #ffb3c1; }

/* ───────── Фото: результаты в ленте и входы композера ───────── */
/* Картинки результата: кадр слева, действия справа; на узкой карточке — друг под другом */
.pics { display: block; container-type: inline-size; }
.pic { margin: 0; display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 8px 14px; align-items: start; }
.pic[hidden] { display: none; }
.pic > .next { grid-column: 1 / -1; }
.pic__stage { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pic__img { display: block; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line-soft); }
.pic__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic__img:hover { border-color: var(--line); }
.pic__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pic__size { font-size: 11px; color: var(--text-mute); }
.pics__thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.pics__thumb { width: 44px; height: 44px; padding: 0; border-radius: 6px; overflow: hidden; border: 2px solid transparent; background: var(--bg-2); opacity: .65; cursor: pointer; }
.pics__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pics__thumb:hover { opacity: 1; }
.pics__thumb[aria-selected="true"] { border-color: var(--neon-2); opacity: 1; }
.pic__acts { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pact { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; text-align: left; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.pact:hover:not(:disabled) { border-color: var(--neon); background: var(--bg-3); }
.pact:focus-visible { outline: 2px solid var(--neon-2); outline-offset: 1px; }
.pact:disabled { opacity: .45; cursor: not-allowed; }
.pact__ico { flex: none; width: 18px; height: 18px; color: var(--neon-2); }
.pact__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.pact__label { font-size: 13px; font-weight: 600; }
.pact__hint { font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pact__price { flex: none; }
@container (max-width: 400px) {
  .pic { grid-template-columns: 1fr; }
  .pact { min-height: 44px; }
}
/* Галерея «Картинки» */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.gallery .rnext { flex-basis: 100%; padding: 6px 8px; gap: 8px; }
.gallery .rnext__gives { display: none; }
.gallery__item { margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gallery__actions { display: flex; flex-wrap: wrap; gap: 4px; }
.gallery__actions .btn { height: 26px; padding: 0 8px; font-size: 11px; }
.input-chip__thumb { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; flex: none; }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
/* inline-flex: глобальное svg {display:block} иначе уносит иконку искры на новую строку */
/* Сумма искр — только на телефоне (там видна одна позиция вместо трёх) */
.sparks__total { display: none !important; }
@media (max-width: 760px) {
  /* Только баланс в шапке: цена на кнопке и в карточках — те же .sparks__item, их не трогаем */
  .sparks > .sparks__item:not(.sparks__total) { display: none !important; }
  .sparks__total { display: inline-flex !important; }
}
/* Иконка внутри строки текста (глобальное svg {display:block} иначе ставит её отдельной строкой) */
.ico--inline { display: inline-block; vertical-align: -2px; }
/* Пары кнопок в узких карточках (Вдохновение): длинная подпись переносится, а не упирается в края */
.work .grid-2 .btn { white-space: normal; height: auto; min-height: 30px; padding-block: 4px; line-height: 1.2; }
.chip__price { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--text-dim); }

/* Виджет поддержки (style.css, z-index 1200) в кабинете — над плеером, а не поверх него;
   пока открыта панель рецепта, кнопка прячется, чтобы не перекрывать её подвал */
body[data-page] .support-launcher { bottom: calc(var(--dock-h) + 16px); }
body[data-page] .support-widget { bottom: calc(var(--dock-h) + 84px); }
body:has(.rsheet) .support-launcher, body:has(.rsheet) .support-widget, body:has(.qpanel) .support-launcher { display: none; }

/* ───────── Рецепты: панель запуска (справа; на телефоне — нижний лист) ───────── */
.rscrim { position: fixed; inset: 0; z-index: 84; background: rgba(5, 6, 10, .55); }
.rsheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 85; width: min(440px, 100vw);
  display: flex; flex-direction: column; background: var(--bg-1); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); animation: rslide .22s var(--ease);
}
.rsheet__head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 18px 10px; border-bottom: 1px solid var(--line-soft); }
.rsheet__eyebrow { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--neon-3); margin-bottom: 4px; }
.rsheet__body { flex-grow: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 16px; }
.rsheet__gives { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg-0); border: 1px solid var(--line-soft); font-size: 14px; }
.rsheet__steps .price-row { grid-template-columns: 24px minmax(0, 1fr) auto 56px; }
.rsheet__picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; padding: 6px; border-radius: var(--r-sm); background: var(--bg-0); }
.rsheet__thumb { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg-2); }
.rsheet__thumb:hover { border-color: var(--neon); }
.rsheet__thumb img { width: 100%; height: 100%; object-fit: cover; }
.rsheet__foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
@keyframes rslide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* «Дальше»: предложения рецептов под результатом */
.next { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.next .chip { height: 28px; font-size: 12px; border-color: rgba(255, 61, 240, .35); }
.next .chip:hover { border-color: var(--neon-3); color: var(--text); }
.next__label { flex-basis: 100%; font-size: 12px; color: var(--text-mute); }
/* Строка готового сценария: название, что получится, цена */
.rnext { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; padding: 8px 10px; text-align: left; color: var(--text); background: rgba(255, 61, 240, .06); border: 1px solid rgba(255, 61, 240, .3); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.rnext:hover { border-color: var(--neon-3); background: rgba(255, 61, 240, .12); }
.rnext:focus-visible { outline: 2px solid var(--neon-3); outline-offset: 1px; }
.rnext__ico { flex: none; width: 18px; height: 18px; color: var(--neon-3); }
.rnext__txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.rnext__title { font-size: 13px; font-weight: 600; }
.rnext__gives { font-size: 11px; color: var(--text-mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rnext__price { flex: none; }
.rnext__go { flex: none; color: var(--text-mute); }
/* Карточка запуска рецепта: подписи разделов результатов */
.task__section { font-size: 12px; color: var(--text-dim); font-weight: 600; }

@media (max-width: 760px) {
  /* На телефоне плавающая кнопка поддержки перекрывала контент — она в меню аккаунта («Поддержка»);
     сама кнопка остаётся в DOM (её клик открывает виджет), но не видна */
  body[data-page] .support-launcher { visibility: hidden; pointer-events: none; }
  body[data-page] .support-widget { left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + var(--dock-h) + 16px); }
  .rsheet { top: auto; left: 0; width: 100%; height: 90vh; border-left: none; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; animation: none; }
}
/* Видео, про-режим (задача 25): итоговый промпт для модели */
.vid-final { display: block; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-0); border: 1px solid var(--line-soft); font-size: 12px; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }
