/* AI Hub — мягкий «стеклянный» стиль с подсветкой, которая меняется по режиму */
:root {
  --bg: #060914;
  --text: #eef1ff;
  --muted: #8c95b6;
  --faint: #5b6383;
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .085);
  --glass-hi: rgba(255, 255, 255, .13);
  --stroke: rgba(255, 255, 255, .09);
  --stroke-hi: rgba(255, 255, 255, .18);
  --danger: #ff7a8a;

  /* подсветка режима «Текст» — холодная */
  --a1: #3d6bff;
  --a2: #8a5cff;
  --a3: #46c8ff;
  --glow: 61, 107, 255;

  --r-xl: 26px; --r-lg: 20px; --r-md: 14px;
  --blur: blur(22px) saturate(140%);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* режим «Картинки» — тёплая, огненная подсветка */
body[data-mode="image"] {
  --a1: #ff6a2b;
  --a2: #ff2f6d;
  --a3: #ffb547;
  --glow: 255, 106, 43;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* фоновый свет */
body::before, body::after {
  content: ''; position: fixed; z-index: 0; pointer-events: none; border-radius: 50%;
  filter: blur(90px); transition: background 1.2s ease;
}
body::before { width: 62vw; height: 62vw; left: 18vw; top: -38vw; background: radial-gradient(circle, rgba(var(--glow), .42), transparent 65%); }
body::after { width: 44vw; height: 44vw; right: -14vw; bottom: -22vw; background: radial-gradient(circle, color-mix(in srgb, var(--a2) 32%, transparent), transparent 65%); }

button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--a3) 80%, white); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); }

#app { position: relative; z-index: 1; display: flex; height: 100vh; gap: 12px; padding: 12px; }

/* ---------- стекло ---------- */
#sidebar, #panel .card, .input-row, .modal-box, .mode-tabs, .toast {
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 20px 50px -20px rgba(0,0,0,.6);
}

/* ---------- левая колонка ---------- */
#sidebar { width: 264px; border-radius: var(--r-xl); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; }
.side-top { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand-orb {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--a3) 22%, var(--a1) 55%, color-mix(in srgb, var(--a2) 70%, black) 100%);
  box-shadow: 0 0 18px rgba(var(--glow), .7);
}
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
.chat-group { font-size: 12px; color: var(--faint); padding: 14px 10px 6px; font-weight: 500; }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent; }
.chat-item:hover { background: var(--glass); }
.chat-item.active { background: var(--glass-2); border-color: var(--stroke); }
.chat-item .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-item .c { font-size: 11.5px; color: var(--muted); }
.chat-item .del { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.chat-item:hover .del, .chat-item .del:focus-visible { opacity: 1; }
.side-bottom { margin: 8px; padding: 14px; border-radius: var(--r-lg); background: rgba(0,0,0,.22); border: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.stat span { color: var(--muted); }
.stat b { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.big b { font-size: 20px; letter-spacing: -.02em; }

/* ---------- кнопки ---------- */
.btn {
  border: 1px solid var(--stroke); background: var(--glass); padding: 9px 16px; border-radius: 999px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .2s, border-color .2s, box-shadow .2s, transform .1s;
}
.btn:hover { background: var(--glass-2); border-color: var(--stroke-hi); }
.btn:active { transform: scale(.98); }
.btn.primary {
  border: 0; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--a3) -20%, var(--a1) 45%, var(--a2) 110%);
  box-shadow: 0 8px 26px -8px rgba(var(--glow), .85), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn.primary:hover { box-shadow: 0 10px 32px -6px rgba(var(--glow), 1), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255,122,138,.16); border: 1px solid rgba(255,122,138,.4); color: #ffd0d6; box-shadow: none; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 17px; padding: 8px 10px; border-radius: 999px; line-height: 1; color: var(--muted); }
.icon-btn:hover { background: var(--glass-2); color: var(--text); }

/* ---------- центр ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar { display: flex; align-items: center; gap: 12px; padding: 4px 6px 10px; }
#toggleSidebar { display: none; }
.mode-tabs { display: flex; border-radius: 999px; padding: 4px; }
.tab { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px 18px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; transition: color .2s, background .2s; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--a1) 55%, transparent), color-mix(in srgb, var(--a2) 45%, transparent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 18px -6px rgba(var(--glow), .9); }
.cur-model { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13.5px; }
.spacer { flex: 1; }

#messages { flex: 1; overflow-y: auto; padding: 18px 12px 10px; scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
.msg { max-width: 820px; margin: 0 auto 22px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg.user .bubble {
  background: linear-gradient(135deg, color-mix(in srgb, var(--a1) 30%, rgba(255,255,255,.06)), color-mix(in srgb, var(--a2) 22%, rgba(255,255,255,.04)));
  border: 1px solid var(--stroke); border-radius: 22px 22px 6px 22px; padding: 11px 16px; max-width: 82%;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.msg.assistant .bubble { width: 100%; word-wrap: break-word; padding: 2px 2px 0; }
.msg .meta { font-size: 12px; color: var(--faint); margin-top: 8px; display: flex; gap: 12px; align-items: center; }
.msg .meta button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0; font-size: 12px; }
.msg .meta button:hover { color: var(--text); }
.msg .err { color: var(--danger); margin-top: 6px; font-size: 14px; padding: 10px 14px; border-radius: var(--r-md); background: rgba(255,122,138,.08); border: 1px solid rgba(255,122,138,.25); }
.msg .notice { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* пустой экран: светящаяся сфера */
.empty { max-width: 520px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.orb-wrap { position: relative; width: 220px; height: 220px; margin-bottom: 28px; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.3) 0 1deg, transparent 1deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
          mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
  opacity: .55; }
.orb {
  position: absolute; inset: 38px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, rgba(255,255,255,.95) 0, var(--a3) 14%, var(--a1) 48%, color-mix(in srgb, var(--a2) 60%, #050816) 82%);
  box-shadow: 0 0 60px rgba(var(--glow), .75), 0 0 140px rgba(var(--glow), .35), inset -14px -18px 40px rgba(0,0,0,.35), inset 8px 10px 30px rgba(255,255,255,.25);
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.04); box-shadow: 0 0 80px rgba(var(--glow), .9), 0 0 170px rgba(var(--glow), .45), inset -14px -18px 40px rgba(0,0,0,.35), inset 8px 10px 30px rgba(255,255,255,.25); } }
.empty h1 { font-weight: 700; font-size: 34px; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 10px;
  background: linear-gradient(180deg, #fff 30%, color-mix(in srgb, var(--a3) 45%, #c9d2ff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.empty p { margin: 0; max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.chip { border: 1px solid var(--stroke); background: var(--glass); border-radius: 999px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; color: var(--text); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: background .2s, border-color .2s; }
.chip:hover { background: var(--glass-2); border-color: var(--stroke-hi); }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 8px; width: 100%; }
.msg.user .imgs { grid-template-columns: repeat(auto-fill, 96px); justify-content: end; }
.imgs img { width: 100%; border-radius: var(--r-lg); cursor: zoom-in; display: block; background: var(--glass); border: 1px solid var(--stroke); box-shadow: 0 18px 40px -18px rgba(0,0,0,.8); }
.gen-placeholder {
  aspect-ratio: 1; max-width: 340px; width: 100%; border-radius: var(--r-lg); border: 1px solid var(--stroke); position: relative; overflow: hidden;
  background: radial-gradient(circle at 50% 42%, rgba(var(--glow), .32), transparent 60%), var(--glass);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13.5px;
}
.gen-placeholder::before { content: ''; position: absolute; width: 34%; aspect-ratio: 1; border-radius: 50%; top: 26%;
  background: radial-gradient(circle at 38% 30%, #fff 0, var(--a3) 16%, var(--a1) 55%, color-mix(in srgb, var(--a2) 60%, #050816) 85%);
  box-shadow: 0 0 50px rgba(var(--glow), .8); animation: breathe 2.2s ease-in-out infinite; }
.gen-placeholder span { position: absolute; bottom: 16%; }

/* markdown */
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.3; letter-spacing: -.015em; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { background: var(--glass-2); padding: 1px 6px; border-radius: 6px; font: 13.5px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.md pre { background: rgba(3,5,14,.65); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 14px; overflow-x: auto; position: relative; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; }
.md pre .copy { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 4px 10px; }
.md a { color: color-mix(in srgb, var(--a3) 70%, white); }
.md blockquote { border-left: 2px solid rgba(var(--glow), .7); margin: 0 0 10px; padding-left: 14px; color: var(--muted); }
.md table { border-collapse: collapse; margin: 0 0 12px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--stroke); padding: 6px 12px; }
.md th { background: var(--glass); }
.md hr { border: 0; border-top: 1px solid var(--stroke); margin: 16px 0; }
.cursor::after { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 4px; background: var(--a3); box-shadow: 0 0 10px rgba(var(--glow), 1); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- поле ввода ---------- */
#composer { padding: 8px 6px 4px; }
#composer > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.input-row { display: flex; gap: 8px; align-items: flex-end; border-radius: 24px; padding: 7px 7px 7px 8px; transition: border-color .2s, box-shadow .2s; }
.input-row:focus-within { border-color: rgba(var(--glow), .55); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 4px rgba(var(--glow), .12), 0 20px 50px -20px rgba(0,0,0,.6); }
#input { flex: 1; resize: none; border: 0; background: transparent; outline: none; padding: 9px 4px; max-height: 240px; }
#input::placeholder { color: var(--faint); }
.hint { margin-top: 8px; text-align: center; color: var(--faint); }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments:not(:empty) { margin-bottom: 10px; }
.att { position: relative; }
.att img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--stroke); display: block; }
.att button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #2a2f48; color: #fff; cursor: pointer; font-size: 11px; line-height: 20px; padding: 0; box-shadow: 0 0 0 1px var(--stroke-hi); }

/* ---------- правая панель ---------- */
#panel { width: 316px; flex-shrink: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
#app.panel-hidden #panel { display: none; }
.card { border-radius: var(--r-xl); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 16px; cursor: pointer; user-select: none; font-weight: 600; }
.card-head .ico {
  width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff;
  background: linear-gradient(145deg, var(--a3), var(--a1) 55%, var(--a2));
  box-shadow: 0 4px 14px -4px rgba(var(--glow), .9), inset 0 1px 0 rgba(255,255,255,.45);
}
.card-head .chev { margin-left: auto; color: var(--muted); display: flex; transition: transform .2s; }
.card.collapsed .chev { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 7px; }
.fld > span { font-size: 13px; color: var(--muted); }
.sel { position: relative; }
.sel select, .fld textarea {
  width: 100%; appearance: none; -webkit-appearance: none; background: rgba(0,0,0,.25); border: 1px solid var(--stroke);
  border-radius: var(--r-md); padding: 11px 36px 11px 14px; color: var(--text); outline: none; cursor: pointer; transition: border-color .2s, background .2s;
}
.sel select option { background: #121831; color: var(--text); }
.fld textarea { padding: 11px 14px; cursor: text; resize: vertical; min-height: 80px; line-height: 1.45; }
.sel select:hover { border-color: var(--stroke-hi); background: rgba(0,0,0,.32); }
.sel select:focus, .fld textarea:focus { border-color: rgba(var(--glow), .6); }
.fld .sel:not(.dd-opt)::after { content: ''; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.sel .fam-dot {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 3px 10px -2px rgba(0,0,0,.5);
}
.sel.with-dot select { padding-left: 44px; font-weight: 600; }
.model-info { font-size: 12.5px; color: var(--muted); line-height: 1.5; padding: 10px 12px; border-radius: var(--r-md); background: rgba(0,0,0,.18); border: 1px solid var(--stroke); }
.model-info b { color: var(--text); font-weight: 600; }
.card-foot { display: flex; justify-content: flex-end; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 0; display: inline-flex; gap: 6px; align-items: center; align-self: flex-start; }
.link-btn:hover { color: var(--text); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid var(--stroke-hi); position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; margin: 0; }
.check input::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 2px; left: 2px; background: #cfd5ee; transition: transform .2s, background .2s; }
.check input:checked { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; box-shadow: 0 0 14px -2px rgba(var(--glow), .9); }
.check input:checked::after { transform: translateX(16px); background: #fff; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel-actions .btn { font-size: 13px; padding: 10px 8px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.px-note { font-size: 12px; color: var(--muted); margin-top: -4px; }
#panel > .link-btn { padding: 2px 8px 10px; }

/* ---------- модалки ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,5,14,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; }
.modal-box { border-radius: var(--r-xl); padding: 18px; width: 520px; max-width: 100%; max-height: 84vh; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(180deg, rgba(30,38,72,.85), rgba(14,19,40,.9)); }
.modal-box.wide-box { width: 760px; }
.modal-box.narrow { width: 360px; }
.modal-box h3 { margin: 0; letter-spacing: -.02em; }
.modal-head { display: flex; gap: 8px; align-items: center; }
.modal-head input[type=search] { flex: 1; }
.modal input, .modal select { background: rgba(0,0,0,.3); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 10px 13px; outline: none; width: 100%; }
.modal-head select { width: auto; }
.modal select option { background: #121831; }
.modal input:focus { border-color: rgba(var(--glow), .6); }
.model-list { overflow-y: auto; margin: 0 -6px; }
.model-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 10px; padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; align-items: center; border: 1px solid transparent; }
.model-item:hover, .model-item.sel { background: var(--glass); border-color: var(--stroke); }
.model-item .star { border: 0; background: none; cursor: pointer; color: var(--faint); font-size: 16px; padding: 0; }
.model-item .star.on { color: #ffc65c; text-shadow: 0 0 10px rgba(255,198,92,.7); }
.model-item .id { font-weight: 600; font-size: 14px; word-break: break-all; }
.model-item .pr { font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.model-item .desc { grid-column: 2 / 4; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--glass); border: 1px solid var(--stroke); color: var(--muted); margin-left: 6px; font-weight: 500; vertical-align: 1px; }
#loginModal .modal-box { margin-top: 10vh; }
#loginModal .orb-wrap { width: 110px; height: 110px; margin: 4px auto 6px; }
#loginModal .orb { inset: 18px; }
#loginModal h3 { text-align: center; font-size: 22px; }

.lightbox { position: fixed; inset: 0; background: rgba(3,5,14,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 84vh; border-radius: var(--r-lg); box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); }
.lb-actions { display: flex; gap: 8px; }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); padding: 11px 18px; border-radius: 999px; z-index: 70; max-width: 90vw; }
.toast.err { border-color: rgba(255,122,138,.5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 1100px) {
  #panel { position: fixed; right: 12px; top: 12px; bottom: 12px; z-index: 40; }
}
@media (max-width: 800px) {
  #app { padding: 0; gap: 0; }
  #sidebar { position: fixed; left: 8px; top: 8px; bottom: 8px; z-index: 40; transform: translateX(-110%); transition: transform .25s; }
  #sidebar.open { transform: none; }
  #toggleSidebar { display: block; }
  #topbar { gap: 8px; padding: 10px; flex-wrap: wrap; }
  #chatCost { display: none; }
  #composer { padding: 6px 10px 10px; }
  .orb-wrap { width: 170px; height: 170px; }
  .orb { inset: 30px; }
  .empty h1 { font-size: 28px; }
  .hint { display: none; }
  #input { min-width: 0; }
}

/* ---------- иконки ---------- */
.ic { display: block; flex-shrink: 0; }
.ic.flip { transform: rotate(180deg); }
.btn .ic, .link-btn .ic, .chip .ic { margin: 0 -1px; }
.tab .ic { opacity: .85; }
.tab.active .ic { opacity: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.stat span { display: inline-flex; align-items: center; gap: 7px; }
.stat .ic { opacity: .8; }
.card-head .ico .ic { stroke-width: 1.9; }

/* поле ввода: всё на одной линии, высота 42px */
.input-row { align-items: flex-end; padding: 6px; gap: 6px; }
.input-row .attach { width: 42px; height: 42px; padding: 0; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
#input { padding: 10px 4px; line-height: 22px; min-height: 42px; }

/* кнопки в сообщениях */
.msg .meta button { display: inline-flex; align-items: center; gap: 5px; }
.md pre .copy { gap: 5px; }
.chat-item .del { display: flex; align-items: center; padding: 4px; border-radius: 8px; }
.chat-item .del:hover { color: var(--danger); background: rgba(255,122,138,.1); }
.att button { display: flex; align-items: center; justify-content: center; }

/* избранное */
.model-item .star { display: flex; align-items: center; justify-content: center; }
.model-item .star.on { color: #ffc65c; }
.model-item .star.on .ic { fill: currentColor; filter: drop-shadow(0 0 6px rgba(255,198,92,.6)); }
.modal-head { position: relative; }
.search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.modal-head input[type=search] { padding-left: 40px; }

/* семейства моделей: глянцевые плашки */
.sel .fam-dot { background-image: linear-gradient(160deg, rgba(255,255,255,.35), rgba(255,255,255,0) 55%, rgba(0,0,0,.25)); }

@media (max-width: 800px) {
  .tab { padding: 7px 14px; }
}

/* ---------- проекты в левой колонке ---------- */
.side-nav { padding: 0 8px; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 4px 10px; font-size: 12.5px; color: var(--faint); font-weight: 500; }
.icon-btn.sm { padding: 5px; border-radius: 9px; }
.project-list { display: flex; flex-direction: column; gap: 2px; max-height: 34vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 1px solid transparent; border-radius: var(--r-md); background: none; cursor: pointer; text-align: left; color: var(--text); }
.nav-item:hover { background: var(--glass); }
.nav-item.active { background: var(--glass-2); border-color: var(--stroke); }
.nav-item .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.nav-item .c { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-ic { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--glass); border: 1px solid var(--stroke); color: var(--muted); }
.nav-ic.proj { color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); border-color: color-mix(in srgb, var(--pc) 35%, transparent); }
.nav-item.active .nav-ic.proj { box-shadow: 0 0 14px -3px var(--pc); }
.chats-head { display: flex; align-items: center; gap: 8px; margin: 10px 8px 0; padding: 10px 6px 4px 10px; border-top: 1px solid var(--stroke); font-size: 13px; font-weight: 600; min-height: 38px; }
.chats-head .ph-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chats-head .ph-name.muted { font-weight: 500; font-size: 12.5px; color: var(--faint); }
.ph-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 10px var(--pc); flex-shrink: 0; }
.side-empty { padding: 14px 12px; font-size: 13px; color: var(--faint); line-height: 1.5; }
.chat-item .more { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 8px; display: flex; }
.chat-item:hover .more, .chat-item .more:focus-visible, .chat-item.active .more { opacity: 1; }
.chat-item .more:hover { background: var(--glass-2); color: var(--text); }
.chat-item:hover .c { display: none; }
.cp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pc); flex-shrink: 0; }
.proj-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: color-mix(in srgb, var(--pc) 60%, white); background: color-mix(in srgb, var(--pc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 35%, transparent); }

/* всплывающее меню */
.popover { position: fixed; z-index: 80; min-width: 220px; max-width: 280px; max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(34,42,78,.92), rgba(16,21,44,.95)); border: 1px solid var(--stroke-hi);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 24px 60px -16px rgba(0,0,0,.8); }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text); }
.pop-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-item .ic { color: var(--muted); }
.pop-item:hover, .pop-item:focus-visible { background: var(--glass-2); }
.pop-item.proj .ic { color: var(--pc); }
.pop-item.current { color: var(--muted); }
.pop-item.current::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pc); }
.pop-item.danger, .pop-item.danger .ic { color: var(--danger); }
.pop-label { padding: 8px 10px 4px; font-size: 12px; color: var(--faint); }
.pop-sep { height: 1px; background: var(--stroke); margin: 5px 4px; }

/* окно проекта */
.mfield { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.mfield input, .mfield textarea { color: var(--text); font-size: 15px; }
.mfield textarea { background: rgba(0,0,0,.3); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 10px 13px; outline: none; resize: vertical; line-height: 1.45; width: 100%; }
.mfield textarea:focus { border-color: rgba(var(--glow), .6); }
.mnote { font-size: 12px; color: var(--faint); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 50%, white), var(--pc) 60%); box-shadow: 0 0 0 1px var(--stroke); transition: transform .15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 45%, transparent), 0 0 16px -2px var(--pc); }
.modal-box .row { align-items: center; }
.modal-box .row .spacer { flex: 1; }

/* ---------- логотипы ---------- */
.logo { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 30%;
  background: linear-gradient(160deg, rgba(255,255,255,.14), rgba(255,255,255,.04)); border: 1px solid var(--stroke); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); overflow: hidden; }
.logo img { width: 66%; height: 66%; object-fit: contain; display: block; }
.logo img.mono { filter: brightness(0) invert(1); opacity: .92; }
.logo b { display: none; font-size: 11px; font-weight: 700; color: #fff; }
.logo b.show { display: block; }
.logo:has(b.show) { background: linear-gradient(160deg, color-mix(in srgb, var(--lc) 90%, white), var(--lc) 55%, color-mix(in srgb, var(--lc) 70%, black)); border-color: transparent; }
.logo.auto { color: #fff; background: linear-gradient(145deg, var(--a3), var(--a1) 55%, var(--a2)); border-color: transparent; }
.cur-model { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.cur-model span { overflow: hidden; text-overflow: ellipsis; }
.model-item .id { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; word-break: normal; }

/* ---------- выпадающий список с иконками ---------- */
.dd { position: relative; }
.dd-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px 9px 10px; border-radius: var(--r-md); border: 1px solid var(--stroke); background: rgba(0,0,0,.25); cursor: pointer; text-align: left; transition: border-color .2s, background .2s; }
.dd.big .dd-btn { padding: 10px 12px 10px 10px; font-weight: 600; }
.dd-btn:hover { border-color: var(--stroke-hi); background: rgba(0,0,0,.32); }
.dd.open .dd-btn { border-color: rgba(var(--glow), .6); box-shadow: 0 0 0 3px rgba(var(--glow), .12); }
.dd-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-hint { font-size: 12px; color: var(--faint); font-weight: 500; white-space: nowrap; }
.dd-chev { display: flex; color: var(--muted); transition: transform .2s; }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 330px; overflow-y: auto; padding: 6px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(34,42,78,.96), rgba(16,21,44,.97)); border: 1px solid var(--stroke-hi);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 24px 60px -16px rgba(0,0,0,.85); scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
.dd-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 11px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text); }
.dd-opt:hover, .dd-opt:focus-visible { background: var(--glass-2); outline: none; }
.dd-opt.sel { background: linear-gradient(135deg, color-mix(in srgb, var(--a1) 28%, transparent), color-mix(in srgb, var(--a2) 18%, transparent)); color: #fff; box-shadow: inset 0 0 0 1px rgba(var(--glow), .35); }

/* правки */
.modal-head h3 { flex: 1; }
.row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.dd-menu { background: #161d3c; backdrop-filter: none; -webkit-backdrop-filter: none; }
.popover { background: #161d3c; }
#panel .card:has(.dd.open) { position: relative; z-index: 6; }

/* ---------- новое поле ввода ---------- */
#composer { padding: 8px 6px 4px; }
.composer {
  max-width: 820px; margin: 0 auto; border-radius: 24px; overflow: visible;
  background: linear-gradient(180deg, var(--glass-2), var(--glass)); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 20px 50px -20px rgba(0,0,0,.6);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: rgba(var(--glow), .5); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 4px rgba(var(--glow), .1), 0 20px 50px -20px rgba(0,0,0,.6); }
.composer .attachments { padding: 12px 14px 0; margin: 0; }
.composer .attachments:empty { display: none; }
.comp-top { display: flex; align-items: flex-start; gap: 6px; padding: 8px 8px 0 8px; }
.comp-top #input { flex: 1; min-height: 52px; max-height: 260px; padding: 9px 4px 6px; line-height: 22px; resize: none; border: 0; background: transparent; outline: none; }
.comp-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; }
.comp-bar .spacer { flex: 1; }
.cbtn {
  width: 36px; height: 36px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.cbtn:hover { background: var(--glass-2); color: var(--text); }
.comp-bar .cbtn { background: var(--glass); border-color: var(--stroke); }
.comp-bar .cbtn:hover { background: var(--glass-2); border-color: var(--stroke-hi); }
#lockBtn.on { color: color-mix(in srgb, var(--a3) 75%, white); background: rgba(var(--glow), .14); border-color: rgba(var(--glow), .35); }
#clearBtn { width: 32px; height: 32px; }
#micBtn.rec { width: auto; padding: 0 10px; color: #fff; background: rgba(255, 70, 90, .2); border-color: rgba(255, 90, 110, .55); }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4d61; box-shadow: 0 0 10px #ff4d61; animation: blink 1s infinite; }
.rec-t { font-size: 13px; font-variant-numeric: tabular-nums; }
.ic.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.qchip { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--glass); color: var(--text); cursor: pointer; font-size: 13.5px; font-weight: 500; }
.qchip .ic { color: var(--muted); }
.qchip:hover { background: var(--glass-2); border-color: var(--stroke-hi); }

.estimate { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: help;
  color: color-mix(in srgb, var(--a3) 55%, white); background: rgba(var(--glow), .12); border: 1px solid rgba(var(--glow), .28); white-space: nowrap; }
.estimate .ic { opacity: .9; }

.send {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--a3) -20%, var(--a1) 45%, var(--a2) 110%);
  box-shadow: 0 8px 24px -8px rgba(var(--glow), .9), inset 0 1px 0 rgba(255,255,255,.4); transition: transform .1s, box-shadow .2s;
}
.send:hover { box-shadow: 0 10px 30px -6px rgba(var(--glow), 1), inset 0 1px 0 rgba(255,255,255,.45); }
.send:active { transform: scale(.94); }
.send .ic { stroke-width: 2.1; }
.send.busy { background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px var(--stroke-hi); }
.pop-item.current-opt { color: #fff; }
.pop-item.current-opt .ic { color: color-mix(in srgb, var(--a3) 70%, white); }

@media (max-width: 800px) {
  .estimate span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .comp-bar { flex-wrap: wrap; }
  .quick { order: 5; width: 100%; }
}

/* =========================================================
   ТЕМА 2: контрастная тёмная (лента, навигация, «таблетки»)
   ========================================================= */
:root, body[data-mode="image"] {
  --bg: #0b0b0d;
  --text: #f5f5f7; --muted: #a0a0ab; --faint: #6e6e7a;
  --glass: #141417; --glass-2: #1c1c21; --glass-hi: #2c2c33;
  --stroke: #24242a; --stroke-hi: #3a3a43;
  --acc: #ff6b3d; --acc-rgb: 255, 107, 61;
  --a1: #ff6b3d; --a2: #ff4d2e; --a3: #ff9a6b; --glow: 255, 107, 61;
  --blur: none;
}
body { background: var(--bg); }
body::before, body::after { display: none; }
#sidebar, #panel .card, .modal-box, .toast, .composer, .dd-menu, .popover {
  background: var(--glass); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: none; border: 1px solid var(--stroke);
}
.modal-box { background: #141417; }
.dd-menu, .popover { background: #18181c; box-shadow: 0 24px 60px -16px rgba(0,0,0,.9); }
#sidebar { width: 236px; background: #0f0f12; }

/* бренд */
.brand { gap: 10px; font-size: 18px; padding: 2px 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #0b0b0d; background: #fff; }

/* главное меню */
.main-nav { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px 10px; }
.nav-link { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid transparent; background: none; color: var(--text); font-weight: 600; font-size: 15.5px; cursor: pointer; text-align: left; }
.nav-link .ic { color: var(--text); }
.nav-link:hover { background: var(--glass-2); }
.nav-link.active { color: var(--acc); background: rgba(var(--acc-rgb), .12); border-color: rgba(var(--acc-rgb), .45); }
.nav-link.active .ic { color: var(--acc); }
.workspace { display: flex; flex-direction: column; min-height: 0; flex: 1; border-top: 1px solid var(--stroke); padding-top: 12px; }
.workspace #newChat { margin: 0 12px 8px; width: auto; }
.nav-head { text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.nav-item.active { background: var(--glass-2); border-color: var(--stroke-hi); }
.side-bottom { background: transparent; }

/* кнопки: контраст вместо свечения */
.btn.primary { background: #fff; color: #0b0b0d; box-shadow: none; }
.btn.primary:hover { background: #e9e9ee; box-shadow: none; }
.send { background: #fff; color: #0b0b0d; box-shadow: none; }
.send:hover { background: #e9e9ee; box-shadow: none; }
.send .ic { stroke: #0b0b0d; }
.send.busy { background: var(--glass-2); }
.send.busy .ic { stroke: none; color: #fff; }
.card-head .ico { background: var(--glass-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--stroke-hi); }
.estimate { color: var(--acc); background: rgba(var(--acc-rgb), .1); border-color: rgba(var(--acc-rgb), .35); }
.msg.user .bubble { background: var(--glass-2); box-shadow: none; }
.dd-opt.sel { background: rgba(var(--acc-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .45); color: var(--text); }
.check input:checked { background: var(--acc); box-shadow: none; }
.tab.active { background: var(--glass-2); box-shadow: none; }
.composer:focus-within { border-color: var(--stroke-hi); box-shadow: none; }
#lockBtn.on { color: var(--acc); background: rgba(var(--acc-rgb), .12); border-color: rgba(var(--acc-rgb), .45); }
.qchip.vis.pub { color: var(--acc); border-color: rgba(var(--acc-rgb), .45); background: rgba(var(--acc-rgb), .12); }
.qchip.vis.pub .ic { color: var(--acc); }
.empty h1 { background: none; color: var(--text); -webkit-text-fill-color: currentColor; }
.orb { background: radial-gradient(circle at 38% 30%, #fff 0, #ffd2bf 14%, var(--acc) 50%, #6b1d0b 88%); box-shadow: 0 0 50px rgba(var(--acc-rgb), .45); }
.orb-ring { opacity: .35; }

/* сегменты-«таблетки» сверху */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--glass); color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.seg-btn:hover { color: var(--text); border-color: var(--stroke-hi); }
.seg-btn.active { color: var(--acc); background: rgba(var(--acc-rgb), .12); border-color: rgba(var(--acc-rgb), .45); }

/* страницы */
body[data-page="feed"] #messages, body[data-page="feed"] #composer, body[data-page="feed"] #panel,
body[data-page="feed"] .cur-model, body[data-page="feed"] #chatCost, body[data-page="feed"] #togglePanel { display: none !important; }
body[data-page="feed"] #feed { display: block !important; }

/* лента */
.feed { flex: 1; overflow-y: auto; padding: 6px 6px 24px; scrollbar-width: thin; scrollbar-color: var(--glass-hi) transparent; }
.masonry { columns: 4 240px; column-gap: 12px; }
.work-card { position: relative; break-inside: avoid; margin: 0 0 12px; border-radius: 18px; overflow: hidden; background: var(--glass); }
.work-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.work-open img { display: block; width: 100%; height: auto; }
.work-over { position: absolute; inset: auto 0 0 0; padding: 40px 12px 10px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.82)); opacity: 0; transition: opacity .18s; pointer-events: none; }
.work-card:hover .work-over, .work-card:focus-within .work-over { opacity: 1; }
.work-over p { margin: 0 0 8px; font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-foot { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.work-by { flex: 1; min-width: 0; font-size: 12.5px; color: #d6d6dd; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.like { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.like:hover { background: rgba(255,255,255,.24); }
.like.on, #workLike.on { color: var(--acc); }
.like.on .ic, #workLike.on .ic { fill: currentColor; }
.work-card .like.on { opacity: 1; }
.demo-tag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.14); color: #fff; }
.feed-empty { max-width: 420px; margin: 18vh auto; text-align: center; color: var(--muted); line-height: 1.5; }

/* окно работы */
.work-modal { align-items: center; padding: 3vh 3vw; }
.work-box { display: flex; width: min(1200px, 100%); max-height: 92vh; border-radius: 22px; overflow: hidden; background: #111114; border: 1px solid var(--stroke); }
.work-img { flex: 1 1 auto; min-width: 0; background: #070708; display: flex; align-items: center; justify-content: center; }
.work-img img { max-width: 100%; max-height: 92vh; display: block; }
.work-info { flex: 0 0 340px; display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow-y: auto; }
.work-head { display: flex; align-items: center; gap: 10px; }
.work-author { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--glass-2); border: 1px solid var(--stroke-hi); font-size: 13px; }
.work-label { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.work-prompt { margin: -6px 0 0; font-size: 15px; line-height: 1.55; }
.work-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--stroke); font-size: 13px; }
.meta-date { font-size: 12.5px; color: var(--faint); margin-left: 4px; }
.work-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.work-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; }
.danger-link { color: var(--danger); align-self: center; }
@media (max-width: 900px) {
  .work-box { flex-direction: column; overflow-y: auto; }
  .work-info { flex: none; }
  .work-img img { max-height: 55vh; }
}
a.btn { color: var(--text); }
.stat.big b { font-size: 18px; }

/* =========================================================
   МИКРОАНИМАЦИИ И ПОДСВЕТКА ЗА КУРСОРОМ
   ========================================================= */
/* пятно света под курсором + подсветка рамки с той стороны, где мышь */
.work-card, .nav-link, .seg-btn, .composer, #panel .card, .qchip, .chip, .chat-item, .dd-btn, .btn:not(.primary), .nav-item { position: relative; isolation: isolate; }
.work-card::after, .nav-link::before, .seg-btn::before, .composer::before, #panel .card::before, .qchip::before, .chip::before, .dd-btn::before, .btn:not(.primary)::before, .nav-item::before, .chat-item::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: 2;
  padding: 1px; opacity: 0; transition: opacity .25s;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--acc-rgb), .9), rgba(255,255,255,.25) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.nav-link::after, .seg-btn::after, #panel .card::after, .qchip::after, .chip::after, .dd-btn::after, .btn:not(.primary)::after, .nav-item::after, .chat-item::after, .composer::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .25s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--acc-rgb), .1), transparent 65%);
}
.work-card:hover::after, .nav-link:hover::before, .seg-btn:hover::before, .composer:hover::before, #panel .card:hover::before, .qchip:hover::before, .chip:hover::before, .dd-btn:hover::before, .btn:not(.primary):hover::before, .nav-item:hover::before, .chat-item:hover::before,
.nav-link:hover::after, .seg-btn:hover::after, #panel .card:hover::after, .qchip:hover::after, .chip:hover::after, .dd-btn:hover::after, .btn:not(.primary):hover::after, .nav-item:hover::after, .chat-item:hover::after, .composer:hover::after { opacity: 1; }
#panel .card::after { background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.035), transparent 65%); }
.composer::after { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.03), transparent 65%); }
.work-card::after { inset: 0; padding: 2px; border-radius: 18px; }

/* карточки ленты: подъём и лёгкий зум */
.work-card { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s; }
.work-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -18px rgba(0,0,0,.9); }
.work-open img { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.work-card:hover .work-open img { transform: scale(1.035); }
/* появление ленты волной — один раз при открытии */
.masonry.enter .work-card { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* лайк: пульс и частицы */
.like.pop .ic, #workLike.on .ic { animation: heartpop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes heartpop { 0% { transform: scale(.6); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.burst { position: fixed; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--acc); pointer-events: none; z-index: 90; animation: burst .6s ease-out forwards; }
.burst:nth-child(even) { background: #ffd2bf; width: 4px; height: 4px; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* анимированные иконки при наведении */
.ic, .ic * { transform-box: fill-box; transform-origin: center; }
:is(button, a, label, .nav-link):hover > .ic,
:is(button, a, label):hover > span > .ic { animation-duration: .7s; animation-timing-function: cubic-bezier(.3,1.4,.5,1); animation-fill-mode: both; }
:is(button, a, label):hover .i-compass { animation-name: ic-spin-back; }
:is(button, a, label):hover .i-brush { animation-name: ic-wiggle; }
:is(button, a, label):hover .i-chat { animation-name: ic-hop; }
:is(button, a, label):hover .i-heart { animation-name: heartpop; }
:is(button, a, label):hover .i-send { animation-name: ic-lift; }
:is(button, a, label):hover .i-sparkle, :is(button, a, label):hover .i-spark4, :is(button, a, label):hover .i-wand { animation-name: ic-twinkle; }
:is(button, a, label):hover .i-clip { animation-name: ic-swing; }
:is(button, a, label):hover .i-mic { animation-name: ic-pulse; }
:is(button, a, label):hover .i-plus { animation-name: ic-quarter; }
:is(button, a, label):hover .i-refresh { animation-name: ic-spin; animation-duration: .8s; }
:is(button, a, label):hover .i-reset { animation-name: ic-spin-ccw; animation-duration: .8s; }
:is(button, a, label):hover .i-search { animation-name: ic-pulse; }
:is(button, a, label):hover .i-download { animation-name: ic-drop; }
:is(button, a, label):hover .i-copy, :is(button, a, label):hover .i-folder, :is(button, a, label):hover .i-folderPlus, :is(button, a, label):hover .i-folderMove { animation-name: ic-tilt; }
:is(button, a, label):hover .i-trash { animation-name: ic-shake; }
:is(button, a, label):hover .i-flame { animation-name: ic-flicker; }
:is(button, a, label):hover .i-clock, :is(button, a, label):hover .i-globe { animation-name: ic-spin; }
:is(button, a, label):hover .i-user { animation-name: ic-hop; }
:is(button, a, label):hover .i-close { animation-name: ic-quarter; }
:is(button, a, label):hover .i-sliders circle:first-of-type { animation: ic-slide-l .6s cubic-bezier(.3,1.4,.5,1); }
:is(button, a, label):hover .i-sliders circle:last-of-type { animation: ic-slide-r .6s cubic-bezier(.3,1.4,.5,1); }
:is(button, a, label):hover .i-image circle { animation: ic-sun .7s cubic-bezier(.3,1.4,.5,1); }
:is(button, a, label):hover .i-unlock path { animation: ic-shackle .5s cubic-bezier(.3,1.4,.5,1); }
:is(button, a, label):hover .i-unlock, :is(button, a, label):hover .i-lock { animation-name: ic-shake; }
.brand:hover .brand-mark .ic { animation: ic-twinkle .8s cubic-bezier(.3,1.4,.5,1); }

@keyframes ic-spin-back { 0% { transform: rotate(0); } 60% { transform: rotate(200deg); } 100% { transform: rotate(180deg); } }
@keyframes ic-spin { to { transform: rotate(360deg); } }
@keyframes ic-spin-ccw { to { transform: rotate(-360deg); } }
@keyframes ic-wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 50% { transform: rotate(10deg); } 75% { transform: rotate(-5deg); } }
@keyframes ic-hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-4px); } 70% { transform: translateY(1px); } }
@keyframes ic-lift { 0% { transform: translateY(0); } 45% { transform: translateY(-5px); } 46% { transform: translateY(6px); opacity: 0; } 47% { opacity: 1; } 100% { transform: translateY(0); } }
@keyframes ic-twinkle { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(25deg) scale(1.2); } 100% { transform: rotate(0) scale(1); } }
@keyframes ic-swing { 0%,100% { transform: rotate(0); } 35% { transform: rotate(-22deg); } 70% { transform: rotate(8deg); } }
@keyframes ic-pulse { 0%,100% { transform: scale(1); } 45% { transform: scale(1.2); } }
@keyframes ic-quarter { to { transform: rotate(90deg); } }
@keyframes ic-drop { 0%,100% { transform: translateY(0); } 45% { transform: translateY(3px); } }
@keyframes ic-tilt { 0%,100% { transform: rotate(0); } 45% { transform: rotate(-10deg) translateY(-1px); } }
@keyframes ic-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-2px) rotate(-6deg); } 40% { transform: translateX(2px) rotate(6deg); } 60% { transform: translateX(-1px) rotate(-3deg); } }
@keyframes ic-flicker { 0%,100% { transform: scale(1); } 30% { transform: scale(1.08, 1.18); } 60% { transform: scale(.96, 1.05); } }
@keyframes ic-slide-l { 50% { transform: translateX(-5px); } }
@keyframes ic-slide-r { 50% { transform: translateX(5px); } }
@keyframes ic-sun { 50% { transform: translateY(-3px) scale(1.2); } }
@keyframes ic-shackle { 50% { transform: translateY(-2px) rotate(-8deg); } }

/* одноцветные логотипы */
.logo { color: var(--text); background: var(--glass-2); border: 1px solid var(--stroke-hi); box-shadow: none; border-radius: 30%; }
.logo svg { width: 58%; height: 58%; display: block; }
.logo b { display: block; font-size: 11px; font-weight: 700; color: currentColor; }
.logo.auto { color: var(--text); background: var(--glass-2); }
.dd-opt .logo { background: transparent; border-color: transparent; }
.dd-opt:hover .logo { color: #fff; }
.dd-opt.sel .logo, .dd.open .dd-btn .logo { color: var(--acc); }
.dd-opt { color: var(--muted); }
.dd-opt:hover, .dd-opt.sel { color: var(--text); }
.cur-model .logo, .meta-chip .logo, .model-item .logo { background: transparent; border-color: transparent; }

/* =========================================================
   ТЕМА COFFI: изумруд и морская волна
   #061F18, #145C43, #29A87A, #91DDB5, #E7F7D4, #006C54
   ========================================================= */
:root, body[data-mode="image"] {
  --bg: #050d0a;
  --text: #eefaf3; --muted: #94b3a6; --faint: #5f7f72;
  --glass: #0b1713; --glass-2: #10211b; --glass-hi: #1c3a30;
  --stroke: #16291f; --stroke-hi: #24443a;
  --acc: #4fd69c; --acc-rgb: 41, 168, 122;
  --a1: #29A87A; --a2: #145C43; --a3: #91DDB5; --glow: 41, 168, 122;
  --mint: #91DDB5; --cream: #E7F7D4; --deep: #061F18;
  --grad: linear-gradient(135deg, #E7F7D4 -10%, #91DDB5 22%, #29A87A 58%, #145C43 92%);
  --grad-soft: linear-gradient(160deg, #91DDB5 0%, #29A87A 55%, #006C54 100%);
}
/* сочное свечение на фоне, как на референсе */
body::before { display: block; width: 70vw; height: 70vw; left: -28vw; top: 10vh; background: radial-gradient(circle, rgba(41,168,122,.28), rgba(0,108,84,.12) 40%, transparent 68%); filter: blur(40px); }
body::after { display: block; width: 40vw; height: 40vw; right: -16vw; top: -18vw; background: radial-gradient(circle, rgba(145,221,181,.10), transparent 65%); filter: blur(40px); }
#sidebar { background: rgba(8,18,14,.88); }

/* бренд */
.brand-mark { background: var(--grad); color: var(--deep); box-shadow: 0 6px 20px -6px rgba(41,168,122,.7); }
.brand { font-weight: 700; letter-spacing: -0.03em; font-size: 21px; }

/* главные кнопки — сочный градиент */
.btn.primary, .send { background: var(--grad); color: var(--deep); box-shadow: 0 8px 24px -10px rgba(41,168,122,.9), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.primary:hover, .send:hover { background: var(--grad); filter: brightness(1.06); box-shadow: 0 10px 30px -8px rgba(41,168,122,1), inset 0 1px 0 rgba(255,255,255,.55); }
.send .ic { stroke: var(--deep); }
.send.busy { background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--stroke-hi); filter: none; }

/* выделение — мятная «таблетка» */
.nav-link.active, .seg-btn.active, .qchip.vis.pub, #lockBtn.on { color: var(--mint); background: rgba(41,168,122,.14); border-color: rgba(145,221,181,.45); }
.nav-link.active .ic, .qchip.vis.pub .ic { color: var(--mint); }
.dd-opt.sel { background: rgba(41,168,122,.14); box-shadow: inset 0 0 0 1px rgba(145,221,181,.45); }
.dd-opt.sel .logo, .dd.open .dd-btn .logo { color: var(--mint); }
.estimate { color: var(--mint); background: rgba(41,168,122,.12); border-color: rgba(145,221,181,.35); }
.like.on, #workLike.on { color: var(--mint); }
.burst { background: var(--mint); }
.burst:nth-child(even) { background: var(--cream); }
.check input:checked { background: var(--grad); }
.cursor::after { background: var(--mint); box-shadow: 0 0 10px rgba(145,221,181,.9); }
.msg.user .bubble { background: linear-gradient(135deg, rgba(41,168,122,.22), rgba(20,92,67,.18)); border-color: rgba(145,221,181,.18); }
.md a { color: var(--mint); }
.md blockquote { border-left-color: var(--a1); }
.gen-placeholder { background: radial-gradient(circle at 50% 42%, rgba(41,168,122,.3), transparent 60%), var(--glass); }
.gen-placeholder::before { background: radial-gradient(circle at 38% 30%, #fff 0, var(--mint) 18%, var(--a1) 55%, var(--a2) 90%); box-shadow: 0 0 50px rgba(41,168,122,.8); }
.work-card::after, .nav-link::before, .seg-btn::before, .composer::before, #panel .card::before, .qchip::before, .chip::before, .dd-btn::before, .btn:not(.primary)::before, .nav-item::before, .chat-item::before {
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(145,221,181,.95), rgba(41,168,122,.35) 40%, transparent 70%);
}
.nav-link::after, .seg-btn::after, .qchip::after, .chip::after, .dd-btn::after, .btn:not(.primary)::after, .nav-item::after, .chat-item::after { background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(41,168,122,.14), transparent 65%); }

/* ---------- пустой экран: контрастная иллюстрация ---------- */
.empty { margin: 4vh auto 0; max-width: 640px; width: 100%; }
.hero-card {
  position: relative; overflow: hidden; width: 100%; box-sizing: border-box; border-radius: 32px; padding: 34px 34px 0; text-align: left; color: var(--deep);
  background: var(--grad-soft); min-height: 400px; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px -30px rgba(41,168,122,.6), inset 0 1px 0 rgba(255,255,255,.5);
}
.hero-card.img { background: linear-gradient(160deg, #E7F7D4 0%, #91DDB5 45%, #29A87A 100%); }
.hero-card .proj-pill { align-self: flex-start; color: var(--deep); background: rgba(6,31,24,.1); border-color: rgba(6,31,24,.2); }
.hero-kicker { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.empty h1.hero-title { margin: 6px 0 10px; font-family: Oswald, Onest, sans-serif; font-weight: 700; font-size: 76px; line-height: .92; letter-spacing: -0.01em; text-transform: uppercase; color: var(--deep); background: none; -webkit-text-fill-color: currentColor; }
.hero-sub { margin: 0; max-width: 340px; font-size: 15px; line-height: 1.45; font-weight: 500; color: rgba(6,31,24,.78); }
.hero-cat { position: absolute; right: -10px; bottom: -6px; width: 300px; height: auto; }
.hero-cat .pupil { transform-box: fill-box; transform-origin: center; animation: look 6s ease-in-out infinite; }
@keyframes look { 0%, 40%, 100% { transform: translateX(0); } 50%, 85% { transform: translateX(-5px); } }
.hero-card:hover .hero-cat { animation: peek .6s cubic-bezier(.3,1.5,.5,1); }
@keyframes peek { 50% { transform: translateY(-10px); } }
.empty .chips { justify-content: flex-start; margin-top: 16px; }
.feed-empty::before { content: ''; display: block; width: 90px; height: 56px; margin: 0 auto 14px; background: url("/favicon.svg") center/contain no-repeat; opacity: .9; }
@media (max-width: 800px) {
  .hero-card { min-height: 340px; padding: 24px 22px 0; }
  .empty h1.hero-title { font-size: 54px; }
  .hero-cat { width: 210px; }
}
.hero-sub { max-width: 300px; position: relative; z-index: 1; }
.empty h1.hero-title, .hero-kicker { position: relative; z-index: 1; }

/* логотип Coffi Cat AI */
.brand { display: flex; padding: 4px 8px 2px; text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand:hover .brand-logo { filter: drop-shadow(0 0 12px rgba(145,221,181,.35)); }
.login-logo { display: block; width: 200px; height: auto; margin: 10px auto 8px; }

/* =========================================================
   СТРОГАЯ ПРЕМИАЛЬНАЯ ТЕМА (как dashboard-кейс):
   малые радиусы, плоские поверхности, тонкие рамки, сплошной зелёный
   ========================================================= */
:root, body[data-mode="image"] {
  --bg: #0a0c0b;
  --text: #e8edea; --muted: #8b9690; --faint: #5d6862;
  --glass: #111413; --glass-2: #161a18; --glass-hi: #222826;
  --stroke: #1f2422; --stroke-hi: #2c3330;
  --green: #1e8f62; --green-hi: #23a372; --green-text: #5ccf9c;
  --r-xl: 12px; --r-lg: 10px; --r-md: 8px;
}
body { font-size: 14px; letter-spacing: 0; }
body::before, body::after { display: none; }
#app { gap: 0; padding: 0; }

/* каркас: боковые колонки во всю высоту, разделены линиями */
#sidebar { border-radius: 0; border: 0; border-right: 1px solid var(--stroke); background: #0d100f; width: 240px; }
#panel { padding: 12px; border-left: 1px solid var(--stroke); background: #0d100f; width: 320px; gap: 10px; }
#main { padding: 0 12px; }
#topbar { padding: 12px 6px; border-bottom: 1px solid var(--stroke); margin: 0 -12px; padding-left: 18px; padding-right: 18px; }

/* общие радиусы */
#panel .card, .modal-box, .dd-menu, .popover, .work-box, .composer { border-radius: 12px; }
.btn, .dd-btn, .sel select, .fld textarea, .modal input, .modal select, .mfield textarea, .qchip, .cbtn, .chip, .seg-btn, .nav-link, .nav-item, .chat-item, .card-head .ico, .side-bottom, .toast, .work-card, .imgs img, .gen-placeholder, .att img, .md pre { border-radius: 8px; }
.dd-opt, .pop-item, .like, .meta-chip, .estimate, .logo, .nav-ic, .model-item, .avatar { border-radius: 6px; }
.badge, .demo-tag { border-radius: 4px; }
.msg.user .bubble { border-radius: 10px; background: var(--glass-2); border-color: var(--stroke-hi); }
.work-card::after { border-radius: 8px; }

/* кнопки: сплошной зелёный, без свечения */
.btn.primary, .send { background: var(--green); color: #fff; box-shadow: none; filter: none; }
.btn.primary:hover, .send:hover { background: var(--green-hi); box-shadow: none; filter: none; }
.send { width: 38px; height: 38px; border-radius: 8px; }
.send .ic { stroke: #fff; }
.send.busy { background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--stroke-hi); }
.btn { padding: 8px 14px; font-weight: 500; }
.workspace #newChat { height: 36px; }

/* навигация */
.main-nav { padding: 8px 10px; gap: 2px; }
.nav-link { height: 38px; gap: 12px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--muted); border: 0; }
.nav-link .ic { color: var(--muted); }
.nav-link:hover { background: var(--glass-2); color: var(--text); }
.nav-link:hover .ic { color: var(--text); }
.nav-link.active { background: rgba(30,143,98,.12); color: var(--green-text); border: 0; }
.nav-link.active .ic { color: var(--green-text); }
.nav-head { font-size: 11px; letter-spacing: .08em; }
.nav-item { padding: 6px 10px; }
.nav-item.active { background: var(--glass-2); border-color: transparent; }
.nav-ic { width: 24px; height: 24px; background: transparent; border: 0; }
.chat-item { padding: 7px 10px; }
.chat-item.active { background: var(--glass-2); border-color: transparent; }
.side-bottom { background: var(--glass); border-color: var(--stroke); margin: 10px; }
.stat.big b { font-size: 16px; }

/* сегменты и чипы */
.seg-btn { height: 32px; padding: 0 12px; font-weight: 500; font-size: 13px; background: transparent; }
.seg-btn.active { background: var(--glass-2); color: var(--text); border-color: var(--stroke-hi); }
.qchip { height: 32px; font-size: 13px; font-weight: 500; background: transparent; }
.cbtn { width: 32px; height: 32px; }
.comp-bar .cbtn { background: transparent; }
.qchip.vis.pub, #lockBtn.on { color: var(--green-text); background: rgba(30,143,98,.12); border-color: rgba(30,143,98,.5); }
.qchip.vis.pub .ic { color: var(--green-text); }
.estimate { height: 26px; font-size: 12px; color: var(--green-text); background: rgba(30,143,98,.1); border-color: rgba(30,143,98,.35); }

/* поле ввода */
.composer { background: var(--glass); border-color: var(--stroke-hi); box-shadow: none; }
.composer:focus-within { border-color: #3a443f; box-shadow: none; }
.comp-top #input { min-height: 46px; font-size: 14.5px; }

/* панель настроек */
#panel .card { background: var(--glass); border-color: var(--stroke); }
.card-head { padding: 12px 14px; font-size: 13.5px; }
.card-body { padding: 0 14px 14px; gap: 12px; }
.card-head .ico { width: 26px; height: 26px; background: transparent; box-shadow: inset 0 0 0 1px var(--stroke-hi); }
.dd-btn, .sel select { background: #0d100f; padding-top: 9px; padding-bottom: 9px; }
.dd.big .dd-btn { padding: 9px 10px; }
.model-info { background: transparent; border-color: var(--stroke); }
.dd-opt.sel { background: rgba(30,143,98,.12); box-shadow: inset 0 0 0 1px rgba(30,143,98,.45); }
.dd-opt.sel .logo, .dd.open .dd-btn .logo { color: var(--green-text); }
.dd.open .dd-btn { border-color: rgba(30,143,98,.6); box-shadow: 0 0 0 3px rgba(30,143,98,.12); }
.check input:checked { background: var(--green); }

/* подсветка за курсором — тоньше */
.work-card::after, .nav-link::before, .seg-btn::before, .composer::before, #panel .card::before, .qchip::before, .chip::before, .dd-btn::before, .btn:not(.primary)::before, .nav-item::before, .chat-item::before {
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), rgba(92,207,156,.55), rgba(92,207,156,.12) 45%, transparent 70%);
}
.nav-link::after, .seg-btn::after, .qchip::after, .chip::after, .dd-btn::after, .btn:not(.primary)::after, .nav-item::after, .chat-item::after, #panel .card::after, .composer::after { background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.025), transparent 65%); }

/* пустой экран: заголовок страницы и сетка сценариев */
.empty.strict { max-width: 760px; margin: 8vh auto 0; text-align: left; display: block; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.suggest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.suggest { position: relative; isolation: isolate; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: center; text-align: left; padding: 14px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--glass); color: var(--text); cursor: pointer; }
.suggest:hover { border-color: var(--stroke-hi); background: var(--glass-2); }
.sg-ic { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--green-text); background: rgba(30,143,98,.1); border: 1px solid rgba(30,143,98,.25); }
.sg-t { font-weight: 600; font-size: 14px; }
.sg-s { font-size: 13px; color: var(--muted); }

/* лента */
.masonry { column-gap: 10px; }
.work-card { margin-bottom: 10px; }
.work-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -16px rgba(0,0,0,.9); }
.like.on, #workLike.on, .burst { color: var(--green-text); }
.burst { background: var(--green-text); }
.work-box { background: #0f1211; }

/* модалки */
.modal { background: rgba(5,7,6,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-box { background: #111413; }

@media (max-width: 800px) {
  .suggest-grid { grid-template-columns: 1fr; }
  #sidebar { border-right: 1px solid var(--stroke); }
}
.side-bottom { margin-top: auto; }

/* =========================================================
   LOTTIE-СТИЛЬ: иконки оживают по частям (прорисовка линий,
   отдельные детали, пружинящие кривые)
   ========================================================= */
/* отключаем старые «прыжки» целиком у этих иконок */
:is(button, a, label, .suggest):hover :is(.i-compass, .i-brush, .i-chat, .i-clip, .i-mic, .i-send, .i-sparkle) { animation: none !important; }
.ic [pathLength] { stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.d-trail, .d-dot, .d-wave { opacity: 0; }
.i-chat .d-dot { opacity: 0; }

@keyframes lt-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes lt-pop { 0% { transform: scale(0) rotate(-90deg); } 65% { transform: scale(1.18) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes lt-tilt { 0% { transform: rotate(0); } 35% { transform: rotate(-16deg) translate(-1px, 1px); } 70% { transform: rotate(6deg); } 100% { transform: rotate(0); } }
@keyframes lt-trail { 0% { opacity: 0; stroke-dashoffset: 1; } 10% { opacity: 1; stroke-dashoffset: .9; } 55% { opacity: 1; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
@keyframes lt-dot { 0% { opacity: 0; transform: translateY(2.5px) scale(.4); } 30% { opacity: 1; transform: translateY(0) scale(1.15); } 45% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lt-wave { 0% { opacity: 0; transform: scaleY(.3); } 35% { opacity: 1; transform: scaleY(1.1); } 100% { opacity: 0; transform: scaleY(.6) translateX(0); } }
@keyframes lt-bob { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-1.6px); } }
@keyframes lt-launch { 0% { transform: translateY(0); } 30% { transform: translateY(3px); } 60% { transform: translateY(-3px); } 100% { transform: translateY(0); } }
@keyframes lt-spinpop { 0% { transform: scale(.4) rotate(-120deg); opacity: .2; } 70% { transform: scale(1.15) rotate(12deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }

/* Лента — компас: круг прорисовывается сверху, стрелка вылетает с поворотом */
:is(button, a, label):hover .i-compass .d-ring { animation: lt-draw .6s cubic-bezier(.65, 0, .35, 1); }
:is(button, a, label):hover .i-compass .d-needle { animation: lt-pop .65s .18s cubic-bezier(.3, 1.5, .5, 1) both; }

/* Создать — кисть: кисть наклоняется «мазком», ручка дорисовывается, внизу остаётся след */
:is(button, a, label):hover .i-brush .d-head { animation: lt-tilt .7s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 30% 80%; }
:is(button, a, label):hover .i-brush .d-tip { animation: lt-draw .5s cubic-bezier(.65, 0, .35, 1); }
:is(button, a, label):hover .i-brush .d-trail { animation: lt-trail 1s .25s ease-out both; }

/* Чаты — облачко прорисовывается, внутри «печатают» три точки */
:is(button, a, label):hover .i-chat .d-bubble { animation: lt-draw .55s cubic-bezier(.65, 0, .35, 1); }
:is(button, a, label):hover .i-chat .dt1 { animation: lt-dot 1.2s .3s ease-out both; }
:is(button, a, label):hover .i-chat .dt2 { animation: lt-dot 1.2s .42s ease-out both; }
:is(button, a, label):hover .i-chat .dt3 { animation: lt-dot 1.2s .54s ease-out both; }

/* Скрепка — вся линия прорисовывается от начала до конца */
:is(button, a, label):hover .i-clip .d-line { animation: lt-draw .85s cubic-bezier(.65, 0, .35, 1); }

/* Микрофон — капсула «вздыхает», держатель дорисовывается, по бокам звуковые волны */
:is(button, a, label):hover .i-mic .d-cap { animation: lt-bob .5s ease-in-out; }
:is(button, a, label):hover .i-mic .d-hold { animation: lt-draw .5s cubic-bezier(.65, 0, .35, 1); }
:is(button, a, label):hover .i-mic .d-wave { animation: lt-wave .9s .15s ease-out both; transform-origin: center; }

/* Отправить — стрелка приседает и «выстреливает», древко и наконечник рисуются по очереди */
:is(button, a, label, .suggest):hover svg.ic.i-send { animation: lt-launch .6s cubic-bezier(.3, 1.4, .5, 1) !important; }
:is(button, a, label):hover .i-send .d-shaft { animation: lt-draw .35s ease-out; }
:is(button, a, label):hover .i-send .d-arrow { animation: lt-draw .35s .18s ease-out both; }

/* Сгенерировать — искра раскручивается и вспыхивает, маленький плюс дорисовывается */
:is(button, a, label):hover .i-sparkle .d-star { animation: lt-spinpop .65s cubic-bezier(.3, 1.5, .5, 1); }
:is(button, a, label):hover .i-sparkle .d-plus { animation: lt-draw .4s .3s ease-out both; }

/* ---------- Lottie-стиль для всех остальных иконок ---------- */
/* старые «прыжки» целиком выключаем, оставляем только продуманные движения ниже */
:is(button, a, label, .suggest):hover svg.ic { animation: none !important; }

:is(button, a, label, .suggest):hover .ic .d { animation: lt-draw var(--t, .55s) var(--d, 0s) cubic-bezier(.65, 0, .35, 1) both; }
:is(button, a, label, .suggest):hover .ic .p { animation: lt-pop2 .5s var(--d, 0s) cubic-bezier(.3, 1.6, .5, 1) both; }
:is(button, a, label, .suggest):hover .ic .dn { animation: lt-drop .5s var(--d, 0s) cubic-bezier(.3, 1.4, .5, 1) both; }
:is(button, a, label, .suggest):hover .ic .sl { animation: lt-slide .55s var(--d, 0s) cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes lt-pop2 { 0% { transform: scale(0); } 70% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes lt-drop { 0% { transform: translateY(-5px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes lt-slide { 0% { transform: translate(var(--x, 0), var(--y, 0)); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* детали отдельных иконок */
:is(button, a, label, .suggest):hover .ic .lid { animation: lt-lid .7s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 20% 100%; }
@keyframes lt-lid { 0%, 100% { transform: none; } 40% { transform: translateY(-2.5px) rotate(-14deg); } 70% { transform: translateY(-1px) rotate(-6deg); } }
:is(button, a, label, .suggest):hover .ic .k1 { animation: lt-knob-l .7s cubic-bezier(.3, 1.4, .5, 1); }
:is(button, a, label, .suggest):hover .ic .k2 { animation: lt-knob-r .7s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes lt-knob-l { 0%, 100% { transform: none; } 45% { transform: translateX(-6px); } }
@keyframes lt-knob-r { 0%, 100% { transform: none; } 45% { transform: translateX(6px); } }
:is(button, a, label, .suggest):hover .ic .b1 { animation: lt-bounce .6s 0s ease-in-out; }
:is(button, a, label, .suggest):hover .ic .b2 { animation: lt-bounce .6s .1s ease-in-out; }
:is(button, a, label, .suggest):hover .ic .b3 { animation: lt-bounce .6s .2s ease-in-out; }
@keyframes lt-bounce { 0%, 100% { transform: none; } 40% { transform: translateY(-3px); } }
:is(button, a, label, .suggest):hover .ic .shk { animation: lt-shackle .6s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes lt-shackle { 0%, 100% { transform: none; } 40% { transform: translateY(-2.5px); } }
:is(button, a, label, .suggest):hover .ic .shk2 { animation: lt-shackle2 .7s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 10% 100%; }
@keyframes lt-shackle2 { 0%, 100% { transform: none; } 45% { transform: rotate(-18deg) translateY(-1px); } }
:is(button, a, label, .suggest):hover .ic .hand { animation: lt-hand .9s cubic-bezier(.5, 0, .3, 1); transform-box: view-box; transform-origin: 12px 12px; }
@keyframes lt-hand { from { transform: rotate(-360deg); } to { transform: rotate(0); } }
:is(button, a, label, .suggest):hover .ic .mer { animation: lt-meridian 1s ease-in-out; }
@keyframes lt-meridian { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(-1); } }

/* движения иконки целиком — там, где это часть смысла */
:is(button, a, label, .suggest):hover svg.ic.i-heart { animation: lt-beat .8s .3s ease-in-out both !important; }
@keyframes lt-beat { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.18); } 45% { transform: scale(.96); } 65% { transform: scale(1.1); } }
:is(button, a, label, .suggest):hover svg.ic.i-refresh { animation: lt-turn .8s cubic-bezier(.3, 1.3, .5, 1) !important; }
@keyframes lt-turn { from { transform: rotate(-180deg); } to { transform: rotate(0); } }
:is(button, a, label, .suggest):hover svg.ic.i-reset { animation: lt-unwind .8s cubic-bezier(.3, 1.3, .5, 1) !important; }
@keyframes lt-unwind { from { transform: rotate(120deg); } to { transform: rotate(0); } }
:is(button, a, label, .suggest):hover svg.ic.i-plus, :is(button, a, label, .suggest):hover svg.ic.i-close { animation: lt-quarter .6s cubic-bezier(.3, 1.5, .5, 1) !important; }
@keyframes lt-quarter { from { transform: rotate(-90deg); } to { transform: rotate(0); } }
:is(button, a, label, .suggest):hover svg.ic.i-star { animation: lt-spinpop .7s cubic-bezier(.3, 1.5, .5, 1) !important; }
:is(button, a, label, .suggest):hover svg.ic.i-flame { animation: lt-flicker .9s .3s ease-in-out both !important; transform-origin: 50% 90%; }
@keyframes lt-flicker { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.06, 1.14) rotate(-3deg); } 50% { transform: scale(.97, 1.05) rotate(2deg); } 75% { transform: scale(1.03, 1.1); } }
:is(button, a, label, .suggest):hover svg.ic.i-coin { animation: lt-flip .8s cubic-bezier(.4, 0, .3, 1) !important; }
@keyframes lt-flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
:is(button, a, label, .suggest):hover svg.ic.i-pen { animation: lt-scribble .7s .2s ease-in-out both !important; }
@keyframes lt-scribble { 0%, 100% { transform: none; } 30% { transform: translate(-1px, 1px) rotate(-6deg); } 60% { transform: translate(1px, -1px) rotate(4deg); } }
:is(button, a, label, .suggest):hover svg.ic.i-send { animation: lt-launch .6s cubic-bezier(.3, 1.4, .5, 1) !important; }
.brand { padding: 10px 10px 6px; }
.brand-logo { height: 50px; width: auto; }
.brand:hover .brand-logo { filter: none; }
.login-logo { width: 240px; margin: 8px auto 14px; }

/* нижняя строка поля ввода: все элементы одной высоты (34px) */
.comp-bar { gap: 6px; align-items: center; }
.comp-bar .cbtn, .comp-bar .qchip, .send, .estimate { height: 34px; box-sizing: border-box; }
.comp-bar .cbtn, .send { width: 34px; padding: 0; border-radius: 8px; }
.comp-bar .qchip { padding: 0 11px; }
.estimate { padding: 0 11px; border-radius: 8px; font-size: 12.5px; }
#micBtn.rec { width: auto; padding: 0 10px; }
.send .ic { stroke-width: 2.2; }

/* отправка — бумажный самолётик */
.send .ic { stroke-width: 1.6; }
.send .plane { stroke: currentColor; stroke-linejoin: round; }
.send .ic .plane { fill: #fff; stroke: #fff; }
.send .ic .plane-cut { stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; }
.send:hover .ic .plane-cut { stroke: var(--green-hi); }
:is(button, a, label, .suggest):hover svg.ic.i-send { animation: lt-fly .7s cubic-bezier(.5, 0, .3, 1) !important; }
@keyframes lt-fly { 0% { transform: none; opacity: 1; } 40% { transform: translate(9px, -3px) scale(.85); opacity: 0; } 41% { transform: translate(-9px, 3px) scale(.85); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- тултипы ---------- */
.tip {
  position: fixed; z-index: 100; max-width: 280px; padding: 7px 10px; border-radius: 7px; pointer-events: none;
  background: #1b201e; color: #eef2f0; border: 1px solid #2f3734; box-shadow: 0 10px 30px -10px rgba(0,0,0,.8);
  font-size: 12.5px; line-height: 1.45; white-space: pre-line; opacity: 0; transform: translateY(3px); transition: opacity .14s, transform .14s;
}
.tip.show { opacity: 1; transform: none; }
.tip::after { content: ''; position: absolute; left: var(--ax, 50%); bottom: -5px; width: 8px; height: 8px; margin-left: -4px; background: #1b201e; border-right: 1px solid #2f3734; border-bottom: 1px solid #2f3734; transform: rotate(45deg); }
.tip.below::after { bottom: auto; top: -5px; transform: rotate(225deg); }

/* ---------- прогресс генерации ---------- */
.gen { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; max-width: 560px; }
.gen-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gen-card { position: relative; overflow: hidden; border-radius: 10px; border: 1px solid var(--stroke-hi); background: #0e1211; display: flex; align-items: center; justify-content: center; max-height: 440px; }
.gen-noise { position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at calc(30% + var(--p, 0) * 40%) 20%, rgba(30,143,98,.35), transparent 60%),
    radial-gradient(90% 70% at 80% calc(90% - var(--p, 0) * 50%), rgba(145,221,181,.16), transparent 60%),
    linear-gradient(110deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%) 0 0 / 220% 100%, #0e1211;
  filter: blur(calc(18px - var(--p, 0) * 10px)); animation: gen-sheen 2.2s linear infinite; transition: filter .4s; }
@keyframes gen-sheen { to { background-position: 0 0, 0 0, -220% 0, 0 0; } }
.gen-ring { position: relative; width: 74px; height: 74px; display: flex; align-items: center; justify-content: center; }
.gen-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.gen-ring .tr { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 4; }
.gen-ring .pr { fill: none; stroke: var(--green-text); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .3s ease-out; filter: drop-shadow(0 0 6px rgba(92,207,156,.6)); }
.gen-ring b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gen-card.ready { background: transparent; border-color: transparent; }
.gen-card img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 10px; filter: blur(14px) saturate(.6); opacity: .3; transform: scale(1.04); transition: filter .8s ease, opacity .6s ease, transform .8s ease; cursor: zoom-in; }
.gen-card img.in { filter: none; opacity: 1; transform: none; }
.gen-status { display: flex; flex-direction: column; gap: 6px; }
.gen-bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.gen-bar i { display: block; height: 100%; width: 0; background: var(--green-text); border-radius: 3px; transition: width .3s ease-out; box-shadow: 0 0 10px rgba(92,207,156,.7); }
.gen-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gen-stage { color: var(--text); }

/* уведомление «Готово» */
.toast.ok { display: flex; align-items: center; gap: 8px; border-color: rgba(30,143,98,.55); background: #12201a; }
.toast.ok .ic { color: var(--green-text); }

/* тултипы: структура и акценты */
.tip { max-width: 300px; padding: 9px 12px; font-size: 12.5px; line-height: 1.5; white-space: normal; text-wrap: pretty; }
.tip .tt { font-weight: 600; color: #fff; font-size: 13px; }
.tip .tl { margin-top: 3px; color: #a3ada8; }
.tip em { font-style: normal; font-weight: 600; white-space: nowrap; }
.tip em.acc { color: var(--green-text); }
.tip em.warn { color: #f2b45c; }
.tip kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 1px; border-radius: 4px; border: 1px solid #3a433f; border-bottom-width: 2px; background: #242a27; color: #e8edea; font: 600 11px/17px var(--font); text-align: center; white-space: nowrap; }

/* раздвижная правая панель */
#panel { width: var(--panel-w, 320px); }
.resizer { position: relative; flex: 0 0 0; width: 0; z-index: 5; cursor: col-resize; outline: none; }
.resizer::before { content: ''; position: absolute; top: 0; bottom: 0; left: -5px; width: 10px; }
.resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: transparent; transition: background .15s; }
.resizer:hover::after, .resizer:focus-visible::after, body.resizing .resizer::after { background: var(--green); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing * { cursor: col-resize !important; }
#app.panel-hidden .resizer, body[data-page="feed"] .resizer { display: none; }
@media (max-width: 1100px) { .resizer { display: none; } #panel { width: min(var(--panel-w, 320px), calc(100vw - 24px)); } }
.model-info .mi-desc { display: inline-block; margin-top: 4px; }

/* поиск моделей сверху + описание в аккордеоне */
.model-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(0,0,0,.22); color: var(--muted); cursor: text; transition: border-color .15s, color .15s; }
.model-search:hover { border-color: rgba(255,255,255,.16); color: var(--text); }
.model-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: 13px; cursor: text; padding: 0; }
.model-search input::placeholder { color: var(--muted); }
.model-search .ms-hint { font-size: 11.5px; color: var(--muted); opacity: .7; white-space: nowrap; }
.model-info .mi-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mi-toggle { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px 0 8px; border: 1px solid var(--stroke); border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; transition: color .15s, border-color .15s; }
.mi-toggle:hover { color: var(--text); border-color: rgba(255,255,255,.16); }
.mi-toggle .ic { transition: transform .2s ease; }
.mi-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.mi-acc { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.mi-acc.open { grid-template-rows: 1fr; }
.mi-clip { overflow: hidden; min-height: 0; }
.mi-clip > .mi-desc { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--stroke); }
@media (prefers-reduced-motion: reduce) { .mi-acc, .mi-toggle .ic { transition: none; } }

/* заголовок у выпадающих списков значений */
.pop-head { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px 6px; color: var(--text); }
.pop-head .ic { color: var(--green-text); margin-top: 1px; flex: none; }
.pop-head b { display: block; font-size: 13.5px; font-weight: 600; }
.pop-head small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.pop-head + .pop-sep { margin-top: 2px; }

/* ---------- мои работы ---------- */
body[data-page="works"] #messages, body[data-page="works"] #composer, body[data-page="works"] #panel,
body[data-page="works"] .cur-model, body[data-page="works"] #chatCost, body[data-page="works"] #togglePanel,
body[data-page="works"] .resizer { display: none !important; }
body[data-page="works"] #feed { display: block !important; }
.works-head { padding: 10px 6px 18px; }
.works-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.works-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.feed-empty .btn { margin-top: 16px; }
.work-card.own { border-radius: 10px; }
.vis-badge { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: rgba(10,12,11,.72); border: 1px solid rgba(255,255,255,.1); color: #cfd6d2; backdrop-filter: blur(6px); z-index: 2; }
.vis-badge.pub { color: var(--green-text); border-color: rgba(92,207,156,.35); }

/* окно своей работы */
.own-only { display: none; }
.work-box.own .own-only { display: grid; }
.work-box.own #workLike { display: none; }
.work-box.own .work-row { grid-template-columns: 1fr auto; }
.work-box.own .work-row.own-only { grid-template-columns: 1fr 1fr; }
.work-own { gap: 8px; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--stroke); }
.work-links { display: flex; justify-content: space-between; align-items: center; }
.own-chat { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.img-tile { position: relative; }

/* кнопка улучшения промпта */
#enhanceBtn.off { opacity: .45; cursor: default; }
#enhanceBtn.off:hover { background: transparent; border-color: var(--stroke); }
#enhanceBtn:not(.off):not(.undo):hover { color: var(--green-text); }
#enhanceBtn.undo { color: var(--green-text); border-color: rgba(92,207,156,.4); background: rgba(30,143,98,.12); }
#enhanceBtn.busy { color: var(--green-text); }

/* ---------- результат генерации: крупно, с панелью под картинкой ---------- */
.gen { max-width: none; }
.gen-status { max-width: 680px; }
.out-imgs { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; width: 100%; }
.img-tile { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.img-tile > img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--stroke); background: var(--glass); cursor: zoom-in; }
.img-tile .gen-card { width: 100%; max-height: none; }
.img-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.ib-left, .ib-right { display: flex; align-items: center; gap: 4px; }
.ib-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ib-model, .ib-btn { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 7px; border: 1px solid var(--stroke); background: var(--glass); color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.ib-model { color: var(--text); cursor: default; margin-right: 4px; border-color: var(--stroke-hi); }
.ib-btn:hover { color: var(--text); border-color: var(--stroke-hi); background: var(--glass-2); }
.ib-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--stroke-hi); color: var(--muted); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ib-chip.cost { color: var(--green-text); border-color: rgba(92,207,156,.3); }
.ib-time { margin-top: 6px; font-size: 11.5px; color: var(--faint); }
/* логотип модели под картинкой: одна рамка, логотип крупнее */
.ib-model .logo { border: 0; background: none; width: 100% !important; height: 100% !important; border-radius: 0; }
.ib-model .logo svg { width: 18px; height: 18px; }
.ib-model .logo b { font-size: 13px; }

/* цена в заголовке подсказки, справа */
.tip .tt.has-price { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.tip .tt .tp { font-style: normal; font-weight: 600; color: var(--green-text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* шапка на страницах «Создать» и «Чаты» не нужна: модель видна справа.
   Остаётся только плавающая кнопка панели настроек (и меню на телефоне). */
#main { position: relative; }
body[data-page="create"] #topbar, body[data-page="chat"] #topbar , body[data-page="video"] #topbar {
  position: absolute; top: 10px; left: 12px; right: 12px; z-index: 6;
  padding: 0; margin: 0; border: 0; background: none; pointer-events: none;
}
body[data-page="create"] #topbar > *, body[data-page="chat"] #topbar > * , body[data-page="video"] #topbar > * { pointer-events: auto; }
body[data-page="create"] #topbar .cur-model, body[data-page="chat"] #topbar .cur-model, body[data-page="video"] #topbar .cur-model,
body[data-page="create"] #chatCost, body[data-page="chat"] #chatCost , body[data-page="video"] #chatCost { display: none !important; }
body[data-page="create"] #togglePanel, body[data-page="chat"] #togglePanel , body[data-page="video"] #togglePanel { background: var(--glass); border: 1px solid var(--stroke); }
body[data-page="create"] #messages, body[data-page="chat"] #messages , body[data-page="video"] #messages { padding-top: 58px; }
/* сам список значений в панели в нашем стиле: тот же, что у выбора модели */
.fld .dd { width: 100%; }
#panel .card:has(.dd.open) { z-index: 30; }

/* ---------- окно «Добавить картинки» ---------- */
.attach-box { width: 760px; max-height: 86vh; }
.am-top { display: flex; align-items: center; gap: 16px; }
.am-top p { flex: 1; margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.am-top .btn { flex: none; }
.am-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.am-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.am-count b { color: var(--green-text); font-weight: 600; }
.am-note { font-size: 12.5px; line-height: 1.45; color: #f0c674; padding: 8px 10px; border: 1px solid rgba(240,198,116,.3); border-radius: 8px; background: rgba(240,198,116,.06); }
.am-grid { flex: 1; min-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; align-content: start; padding: 2px; scrollbar-width: thin; }
.am-tile { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--stroke); border-radius: 8px; overflow: hidden; background: var(--glass); cursor: pointer; transition: border-color .15s, transform .15s; }
.am-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.am-tile:hover { border-color: var(--stroke-hi); }
.am-tile:hover img { opacity: .9; }
.am-tile.on { border-color: var(--green-hi); box-shadow: 0 0 0 1px var(--green-hi); }
.am-check { position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid rgba(255,255,255,.7); background: rgba(10,12,11,.45); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; backdrop-filter: blur(4px); }
.am-tile.on .am-check { background: var(--green); border-color: var(--green-hi); }
.am-empty { grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.am-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.am-foot .btn.primary:disabled { opacity: .45; cursor: default; }
@media (max-width: 640px) { .am-top { flex-direction: column; align-items: stretch; } .am-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- блоки кода ---------- */
.md .code { margin: 0 0 12px; border: 1px solid var(--stroke); border-radius: 8px; overflow: hidden; background: #0b0e0d; }
.md .code-head { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--stroke); background: rgba(255,255,255,.02); font-size: 12px; color: var(--muted); }
.code-copy { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.code-copy:hover { color: var(--text); background: var(--glass-2); }
.md .code pre { margin: 0; border: 0; border-radius: 0; background: none; padding: 12px 14px; }
.md .code pre code { font: 13px/1.6 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; color: #d7dcd9; }
.tk-k { color: #c792ea; } .tk-s { color: #a5d6a7; } .tk-n { color: #f7c272; } .tk-c { color: #6b7570; font-style: italic; } .tk-f { color: #7fd1c7; } .tk-a { color: #f7c272; }

/* ---------- файлы в сообщениях и в поле ввода ---------- */
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.msg .files { margin-bottom: 6px; justify-content: flex-end; }
.attachments .files { width: 100%; }
.file-chip { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; max-width: 280px; padding: 0 10px 0 6px; border: 1px solid var(--stroke-hi); border-radius: 8px; background: var(--glass); font-size: 13px; }
.fc-ext { flex: none; display: grid; place-items: center; width: 34px; height: 28px; border-radius: 6px; background: rgba(30,143,98,.16); color: var(--green-text); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.fc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-size { flex: none; font-size: 11.5px; color: var(--faint); }
.file-chip.loading .fc-ext { animation: fc-pulse 1s ease-in-out infinite alternate; }
@keyframes fc-pulse { to { opacity: .35; } }
.fc-x { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--stroke-hi); background: #1a1f1d; color: var(--text); cursor: pointer; }

/* ---------- правка сообщения и действия под ответом ---------- */
.msg-edit { align-self: flex-end; display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--faint); font: inherit; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s, color .15s, background .15s; }
.msg.user:hover .msg-edit, .msg-edit:focus-visible { opacity: 1; }
.msg-edit:hover { color: var(--text); background: var(--glass-2); }
@media (hover: none) { .msg-edit { opacity: 1; } }
.msg-editor { width: min(100%, 640px); display: flex; flex-direction: column; gap: 8px; }
.msg-editor textarea { width: 100%; resize: none; padding: 12px 14px; border: 1px solid var(--green-hi); border-radius: 10px; background: var(--glass); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.5; outline: none; }
.me-foot { display: flex; align-items: center; gap: 8px; }
.me-hint { flex: 1; font-size: 12px; color: var(--muted); }
.me-foot .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.msg .meta button { display: inline-flex; align-items: center; gap: 5px; }

/* тарифы за токены в раскрывающемся блоке модели */
.mi-desc .mi-text { margin: 0; }
.mi-rates { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.mi-desc .mi-text + .mi-rates { padding-top: 10px; border-top: 1px dashed var(--stroke); }
.mi-desc > .mi-rates:first-child { margin-top: 0; }
.mi-rates-t { font-size: 12px; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.mi-rate { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.mi-rate b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mi-rates p { margin: 4px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.4; }

/* ---------- стартовые страницы: поле ввода в центре ---------- */
.start-below { display: none; }
body.start #messages { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding-bottom: 22px; }
body.start .start-below { display: block; flex: 1 1 0; overflow-y: auto; padding: 22px 12px 28px; scrollbar-width: thin; }
body.start #composer .hint { display: none; }
.start-head { width: 100%; max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sh-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: rgba(30,143,98,.12); border: 1px solid rgba(92,207,156,.28); color: var(--green-text); margin-bottom: 16px; }
.start-head h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text); }
.start-head p { margin: 10px 0 0; max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.start-model { margin-top: 18px; display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px 0 8px; border: 1px solid var(--stroke-hi); border-radius: 8px; background: var(--glass); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.start-model:hover { border-color: rgba(92,207,156,.45); background: var(--glass-2); }
.start-model em { font-style: normal; color: var(--green-text); font-size: 12.5px; }
.start-model .ic:last-child { color: var(--muted); }
.start-ideas { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.idea { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--stroke); border-radius: 10px; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.idea:hover { border-color: var(--stroke-hi); background: var(--glass); }
.idea-ic { color: var(--green-text); margin-bottom: 4px; }
.idea-t { font-size: 13.5px; font-weight: 600; }
.idea-s { font-size: 12px; color: var(--muted); line-height: 1.4; }
.start-recent { max-width: 820px; margin: 26px auto 0; }
.start-recent:empty { display: none; }
.sr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.sr-works { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.sr-work { aspect-ratio: 1; padding: 0; border: 1px solid var(--stroke); border-radius: 8px; overflow: hidden; background: var(--glass); cursor: pointer; }
.sr-work img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.sr-work:hover img { transform: scale(1.05); }
.sr-chats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sr-chat { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 1px solid var(--stroke); border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.sr-chat:hover { background: var(--glass); border-color: var(--stroke-hi); }
.sr-chat .ic { color: var(--muted); flex: none; }
.sr-chat span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-chat em { font-style: normal; font-size: 12px; color: var(--faint); }
#projectChip .cp-dot { width: 8px; height: 8px; }
.chat-item .ck { flex: none; display: inline-flex; color: var(--faint); margin-right: 2px; }
.chat-item.active .ck { color: var(--green-text); }
@media (max-width: 820px) { .start-ideas { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sr-works { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sr-chats { grid-template-columns: 1fr; } .start-head h1 { font-size: 27px; } }

/* ===================== ПЛАВНЫЕ ПЕРЕХОДЫ ===================== */
/* Крупные элементы переходят каждый своей группой: меню и панель стоят на месте,
   основная часть мягко сменяется, поле ввода перелетает между центром и низом. */
#sidebar { view-transition-name: sidebar; }
#panel { view-transition-name: panel; }
#main { view-transition-name: main; }
#composer { view-transition-name: composer; }
#togglePanel { view-transition-name: panel-btn; }

::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }

/* смена страницы: старая часть уходит, новая поднимается */
html[data-vt="page"]::view-transition-old(main) { animation: vt-out .16s ease-in both; }
html[data-vt="page"]::view-transition-new(main) { animation: vt-in .38s .06s cubic-bezier(.22, 1, .36, 1) both; }
html[data-vt="page"]::view-transition-old(composer) { animation: vt-fade-out .14s ease-in both; }
html[data-vt="page"]::view-transition-new(composer) { animation: vt-in .38s .08s cubic-bezier(.22, 1, .36, 1) both; }

/* первое сообщение с главной: заголовок и идеи растворяются, поле ввода едет вниз */
html[data-vt="launch"]::view-transition-group(composer) { animation-duration: .55s; animation-timing-function: cubic-bezier(.65, 0, .15, 1); }
html[data-vt="launch"]::view-transition-old(main) { animation: vt-launch-out .24s ease-in both; }
html[data-vt="launch"]::view-transition-new(main) { animation: vt-fade-in .3s .22s ease-out both; }

/* панель настроек: основная часть плавно меняет ширину, панель выезжает */
html[data-vt="panel-open"]::view-transition-new(panel) { animation: vt-panel-in .36s cubic-bezier(.22, 1, .36, 1) both; }
html[data-vt="panel-close"]::view-transition-old(panel) { animation: vt-panel-out .22s ease-in both; }
/* основная часть при этом сразу встаёт в новую ширину, без двоения */
html[data-vt^="panel"]::view-transition-group(main), html[data-vt^="panel"]::view-transition-group(composer) { animation: none; }
html[data-vt^="panel"]::view-transition-old(main), html[data-vt^="panel"]::view-transition-old(composer) { animation: none; opacity: 0; }
html[data-vt^="panel"]::view-transition-new(main), html[data-vt^="panel"]::view-transition-new(composer) { animation: none; }
html[data-vt="none"]::view-transition-group(*) { animation-duration: 0s; }

@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes vt-fade-in { from { opacity: 0; } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-launch-out { to { opacity: 0; transform: translateY(-18px) scale(.985); } }
@keyframes vt-panel-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes vt-panel-out { to { opacity: 0; transform: translateX(24px); } }

/* новые сообщения в чате */
.msg-new { animation: msg-in .42s cubic-bezier(.22, 1, .36, 1) both; }
.msg.assistant.msg-new { animation-delay: .12s; }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px); } }

/* стартовая страница: заголовок и идеи появляются по очереди */
body.start .start-head > * { animation: msg-in .5s cubic-bezier(.22, 1, .36, 1) both; }
body.start .start-head > :nth-child(2) { animation-delay: .04s; }
body.start .start-head > :nth-child(3) { animation-delay: .08s; }
body.start .start-head > :nth-child(4) { animation-delay: .12s; }
body.start .idea { animation: msg-in .5s cubic-bezier(.22, 1, .36, 1) both; }
body.start .idea:nth-child(1) { animation-delay: .16s; } body.start .idea:nth-child(2) { animation-delay: .2s; }
body.start .idea:nth-child(3) { animation-delay: .24s; } body.start .idea:nth-child(4) { animation-delay: .28s; }
body.start .start-recent { animation: vt-fade-in .5s .32s ease-out both; }
.sr-work { animation: msg-in .45s cubic-bezier(.22, 1, .36, 1) both; }
.sr-work:nth-child(2) { animation-delay: .04s; } .sr-work:nth-child(3) { animation-delay: .08s; } .sr-work:nth-child(4) { animation-delay: .12s; } .sr-work:nth-child(5) { animation-delay: .16s; } .sr-work:nth-child(6) { animation-delay: .2s; }

/* окна, меню, уведомления */
.modal:not(.hidden), .lightbox:not(.hidden) { animation: vt-fade-in .2s ease-out both; }
.modal:not(.hidden) > .modal-box, .modal:not(.hidden) > .work-box, .lightbox:not(.hidden) > img { animation: modal-in .32s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.975); } }
.popover { animation: pop-in .18s cubic-bezier(.22, 1, .36, 1) both; transform-origin: top left; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.toast:not(.hidden) { animation: toast-in .34s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } }
.dd.open .dd-menu { animation: pop-in .18s cubic-bezier(.22, 1, .36, 1) both; transform-origin: top center; }
.mi-acc .mi-desc { transition: opacity .25s ease; opacity: 0; }
.mi-acc.open .mi-desc { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .msg-new, body.start .start-head > *, body.start .idea, body.start .start-recent, .sr-work,
  .modal:not(.hidden), .modal:not(.hidden) > *, .lightbox:not(.hidden), .lightbox:not(.hidden) > img, .popover, .toast:not(.hidden), .dd.open .dd-menu { animation: none !important; }
}

/* выделение текста в фирменном зелёном */
::selection { background: rgba(35, 163, 114, .45); color: #fff; }
input::selection, textarea::selection { background: rgba(35, 163, 114, .5); color: #fff; }
:root { accent-color: var(--green); caret-color: var(--green-text); }

/* ---------- меню над выделенным текстом ---------- */
.sel-bar { position: fixed; z-index: 90; display: flex; padding: 3px; gap: 2px; border: 1px solid var(--stroke-hi); border-radius: 9px; background: #151a18; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: pop-in .16s cubic-bezier(.22, 1, .36, 1) both; }
.sel-bar button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.sel-bar button + button { box-shadow: -1px 0 0 var(--stroke); border-radius: 0 6px 6px 0; }
.sel-bar button:hover { background: rgba(30,143,98,.16); color: #fff; }
.sel-bar button .ic { color: var(--green-text); }

/* цитата в поле ввода и в своём сообщении */
.quote-chip { position: relative; width: 100%; display: flex; align-items: flex-start; gap: 8px; padding: 8px 30px 8px 10px; border-left: 2px solid var(--green-hi); border-radius: 0 8px 8px 0; background: rgba(30,143,98,.08); font-size: 13px; color: var(--muted); }
.quote-chip .ic { flex: none; color: var(--green-text); margin-top: 1px; }
.quote-chip span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.quote-chip .fc-x { top: 6px; right: 6px; }
.u-quote { margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 2px solid var(--green-hi); color: var(--muted); font-size: 13px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sel-bar { animation: none; } }

/* рамка светится и у соседних элементов, яркость зависит от расстояния до курсора (--near из icons.js) */
.idea, .start-model, .sr-chat { position: relative; isolation: isolate; }
.idea::before, .start-model::before, .sr-chat::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: 2; padding: 1px;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), rgba(92,207,156,.55), rgba(92,207,156,.12) 45%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.work-card::after, .nav-link::before, .seg-btn::before, .composer::before, #panel .card::before, .qchip::before, .chip::before, .dd-btn::before, .btn:not(.primary)::before, .nav-item::before, .chat-item::before, .idea::before, .start-model::before, .sr-chat::before,
.work-card:hover::after, .nav-link:hover::before, .seg-btn:hover::before, .composer:hover::before, #panel .card:hover::before, .qchip:hover::before, .chip:hover::before, .dd-btn:hover::before, .btn:not(.primary):hover::before, .nav-item:hover::before, .chat-item:hover::before {
  opacity: var(--near, 0); transition: opacity .3s ease;
}
/* рамка с подсветкой рисуется по большему кругу, чтобы свет «дотягивался» от курсора снаружи */
.nav-link::before, .seg-btn::before, .composer::before, #panel .card::before, .qchip::before, .chip::before, .dd-btn::before, .btn:not(.primary)::before, .nav-item::before, .chat-item::before, .idea::before, .start-model::before, .sr-chat::before {
  background: radial-gradient(170px circle at var(--mx, 50%) var(--my, 50%), rgba(92,207,156,.7), rgba(92,207,156,.16) 45%, transparent 72%);
}
@media (hover: none) { .idea::before, .start-model::before, .sr-chat::before { display: none; } }
/* близость курсора у каждого элемента своя: вложенные кнопки не перенимают её у родителя */
.work-card, .nav-link, .seg-btn, .composer, #panel .card, .qchip, .chip, .nav-item, .chat-item, .dd-btn, .btn:not(.primary), .idea, .start-model, .sr-chat { --near: 0; }

/* отступы между пунктами меню, проектами и чатами, чтобы рамки не слипались */
.main-nav { gap: 5px; }
#projectList, #chatList { display: flex; flex-direction: column; gap: 4px; }
#chatList .chat-group { margin-top: 6px; }

/* ---------- окно проекта ---------- */
.project-box { width: 480px; gap: 18px; padding: 20px; }
.project-box .modal-head { align-items: flex-start; gap: 12px; }
.proj-badge { --pc: var(--green); flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 40%, transparent); transition: color .2s, background .2s, border-color .2s; }
.ph-text { flex: 1; min-width: 0; }
.ph-text h3 { margin: 0; font-size: 17px; font-weight: 600; }
.ph-text p { margin: 3px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.pf { display: flex; flex-direction: column; gap: 7px; }
.pf-label { font-size: 13px; color: var(--text); font-weight: 500; }
.pf-label em { font-style: normal; font-weight: 400; color: var(--faint); margin-left: 4px; }
.project-box input[type=text], .project-box textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--stroke); border-radius: 8px; background: #0c0f0e; color: var(--text); font: inherit; font-size: 14px; line-height: 1.45; outline: none; box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.project-box input[type=text] { height: 40px; }
.project-box textarea { resize: vertical; min-height: 110px; }
.project-box input[type=text]:focus, .project-box textarea:focus { border-color: var(--green-hi); box-shadow: 0 0 0 3px rgba(30,143,98,.15); }
.project-box input::placeholder, .project-box textarea::placeholder { color: var(--faint); }
.pf-note { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--faint); }
.pf-note span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-box .swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.project-box .swatch { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 0; background: var(--pc); color: #0a0c0b; cursor: pointer; box-shadow: none; transform: none; transition: box-shadow .15s; }
.project-box .swatch .ic { opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s cubic-bezier(.3, 1.5, .5, 1); stroke-width: 2.6; }
.project-box .swatch:hover { box-shadow: 0 0 0 2px #111413, 0 0 0 3px color-mix(in srgb, var(--pc) 55%, transparent); }
.project-box .swatch.on { box-shadow: 0 0 0 2px #111413, 0 0 0 4px var(--pc); }
.project-box .swatch.on .ic { opacity: 1; transform: none; }
.pf-foot { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--stroke); }
.pf-foot .spacer { flex: 1; }

/* ховер: вместо ровной серой заливки мягкое пятно света, которое идёт от курсора */
.nav-link:not(.active):hover, .chat-item:not(.active):hover, .nav-item:not(.active):hover, .qchip:hover, .idea:hover, .sr-chat:hover { background: transparent; }
.btn:not(.primary):hover, .start-model:hover { background: #111413; }
.dd-btn:hover { background: #0d100f; }
.idea::after, .start-model::after, .sr-chat::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .25s; }
.nav-link::after, .seg-btn::after, .qchip::after, .chip::after, .dd-btn::after, .btn:not(.primary)::after, .nav-item::after, .chat-item::after, .idea::after, .start-model::after, .sr-chat::after {
  background: radial-gradient(170px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.09), rgba(255,255,255,.035) 40%, transparent 72%);
}
.idea:hover::after, .start-model:hover::after, .sr-chat:hover::after { opacity: 1; }
.nav-link.active::after, .chat-item.active::after { background: radial-gradient(170px circle at var(--mx, 50%) var(--my, 50%), rgba(92,207,156,.1), transparent 72%); }

/* смена страницы: без растягивания и перелёта, только мягкая смена кадра на месте */
html[data-vt="page"]::view-transition-group(main),
html[data-vt="page"]::view-transition-group(composer),
html[data-vt="page"]::view-transition-group(panel),
html[data-vt="page"]::view-transition-group(panel-btn) { animation: none; }
html[data-vt="page"]::view-transition-old(main) { height: 100%; object-fit: none; object-position: left top; animation: vt-page-out .16s ease-in both; }
html[data-vt="page"]::view-transition-new(main) { height: 100%; object-fit: none; object-position: left top; animation: vt-page-in .42s .08s cubic-bezier(.22, 1, .36, 1) both; }
html[data-vt="page"]::view-transition-old(composer), html[data-vt="page"]::view-transition-old(panel), html[data-vt="page"]::view-transition-old(panel-btn) { animation: vt-fade-out .14s ease-in both; }
html[data-vt="page"]::view-transition-new(composer) { animation: vt-page-in .42s .12s cubic-bezier(.22, 1, .36, 1) both; }
html[data-vt="page"]::view-transition-new(panel), html[data-vt="page"]::view-transition-new(panel-btn) { animation: vt-fade-in .3s .1s ease-out both; }
@keyframes vt-page-out { to { opacity: 0; transform: scale(.992); } }
@keyframes vt-page-in { from { opacity: 0; transform: translateY(6px) scale(.996); } }

/* во время анимации клики проходят сквозь неё: можно сразу жать дальше */
::view-transition { pointer-events: none; }
/* смена страницы чуть быстрее */
html[data-vt="page"]::view-transition-old(main) { animation-duration: .12s; }
html[data-vt="page"]::view-transition-new(main) { animation-duration: .32s; animation-delay: .04s; }
html[data-vt="page"]::view-transition-new(composer) { animation-duration: .32s; animation-delay: .06s; }

/* рисование в чате */
.qchip.draw.on .ic { color: var(--green-text); }
.qchip.draw span { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item > span { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.pop-hint { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.popover:has(.pop-hint) { min-width: 300px; max-width: 360px; }
/* свечение кольца прогресса не обрезается квадратом */
.gen-ring svg { overflow: visible; }
.gen-ring .pr { filter: drop-shadow(0 0 4px rgba(92,207,156,.55)); }

/* ---------- «Создать»: поле ввода выше, ниже тренды и шаблоны ---------- */
body.start.create-start #messages { flex: 0 0 auto; padding-top: 7vh; padding-bottom: 18px; }
body.start.create-start .start-below { flex: 1 1 0; padding-top: 26px; }
body.start.create-start .start-head p { display: none; }
body.start.create-start .start-head h1 { font-size: 30px; }
.cg-sec { max-width: 1100px; margin: 0 auto 34px; }
.cg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.cg-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.cg-head h2 .ic { color: var(--green-text); }
.cg-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.cg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cg-tabs button { height: 30px; padding: 0 12px; border: 1px solid var(--stroke); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.cg-tabs button:hover { color: var(--text); border-color: var(--stroke-hi); }
.cg-tabs button.on { color: #fff; background: var(--green); border-color: var(--green-hi); }

/* карточки трендов: крупные, по горизонтали */
.trend-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.trend-card, .tpl-card { position: relative; display: block; padding: 0; border: 1px solid var(--stroke); border-radius: 12px; overflow: hidden; background: var(--glass); color: var(--text); text-align: left; font: inherit; cursor: pointer; isolation: isolate; animation: msg-in .5s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i, 0) * 45ms); transition: border-color .2s, transform .25s cubic-bezier(.22, 1, .36, 1); }
.trend-card:hover, .tpl-card:hover { border-color: rgba(92,207,156,.5); transform: translateY(-3px); }
.tc-img { display: block; overflow: hidden; }
.tc-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.22, 1, .36, 1); }
.trend-card:hover .tc-img img, .tpl-card:hover .tc-img img { transform: scale(1.06); }
.trend-card .tc-img { aspect-ratio: 4 / 5; }
.trend-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(6,8,7,.92)); pointer-events: none; z-index: 1; }
.trend-card .tc-body { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; gap: 3px; }
.tc-t { font-size: 14px; font-weight: 600; line-height: 1.25; }
.tc-d { font-size: 12px; color: rgba(232,236,233,.72); line-height: 1.35; }
.tc-ratio { position: absolute; top: 9px; left: 9px; z-index: 2; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; border-radius: 6px; background: rgba(10,12,11,.65); border: 1px solid rgba(255,255,255,.14); font-size: 11px; color: #dfe5e1; backdrop-filter: blur(6px); }
.tc-use { position: absolute; top: 9px; right: 9px; z-index: 2; height: 26px; padding: 0 9px 0 7px; display: inline-flex; align-items: center; gap: 4px; border-radius: 7px; background: var(--green); color: #fff; font-size: 12px; font-weight: 600; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .25s cubic-bezier(.22, 1, .36, 1); }
.trend-card:hover .tc-use, .tpl-card:hover .tc-use, .trend-card:focus-visible .tc-use, .tpl-card:focus-visible .tc-use { opacity: 1; transform: none; }

/* сетка шаблонов */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tpl-card .tc-img { aspect-ratio: 4 / 3; }
.tpl-card .tc-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.tpl-card .tc-d { color: var(--muted); }
.cg-sec .sr-works { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .trend-row { grid-template-columns: repeat(5, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; } .trend-card { scroll-snap-align: start; } }
@media (hover: none) { .tc-use { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .trend-card, .tpl-card { animation: none; transition: none; } .tc-img img { transition: none; } }
body.start.create-start .start-below { -webkit-mask-image: linear-gradient(transparent, #000 26px); mask-image: linear-gradient(transparent, #000 26px); }
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.trend-card::after { background: linear-gradient(180deg, transparent 38%, rgba(6,8,7,.55) 62%, rgba(6,8,7,.95)); }

/* стартовая страница: поле ввода появляется вместе с остальными, после модели и до идей */
body.start #composer .composer.enter { animation: msg-in .5s .1s cubic-bezier(.22, 1, .36, 1) both; }
html[data-vt="page"]::view-transition-new(composer) { animation: none; }
@media (prefers-reduced-motion: reduce) { body.start #composer .composer.enter { animation: none; } }
/* при смене страницы поле ввода не летит отдельно: гаснет вместе со старой страницей и заново проявляется на новой */
html[data-vt="page"] #composer { view-transition-name: none; }
.qchip, .qchip span { white-space: nowrap; }

/* индикатор хранилища внизу боковой панели */
.store-stat span { display: inline-flex; align-items: center; gap: 8px; }
.store-stat em { font-style: normal; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; background: #f0c674; box-shadow: 0 0 0 3px rgba(240,198,116,.15); }
.store-stat.ok .st-dot { background: var(--green-text); box-shadow: 0 0 0 3px rgba(92,207,156,.15); }
.store-stat.bad .st-dot { background: #ff7a8a; box-shadow: 0 0 0 3px rgba(255,122,138,.15); }
.store-stat b { font-weight: 500; font-size: 12.5px; color: var(--muted); }

/* ---------- вход и регистрация ---------- */
body.auth-on #app { display: none; }
.auth { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: var(--bg); }
/* слева: живая стена из работ и короткий рассказ о студии */
.auth-show { position: relative; overflow: hidden; border-right: 1px solid var(--stroke); }
.auth-wall { position: absolute; inset: -40px -20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; transform: rotate(-6deg) scale(1.12); }
.aw-col { display: flex; flex-direction: column; gap: 14px; animation: aw-up 70s linear infinite; }
.aw-col:nth-child(2) { animation-name: aw-down; animation-duration: 85s; }
.aw-col:nth-child(3) { animation-duration: 60s; }
.aw-col img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; display: block; }
@keyframes aw-up { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes aw-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
.auth-show::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,12,11,.55) 0%, rgba(10,12,11,.2) 35%, rgba(10,12,11,.75) 70%, rgba(10,12,11,.97) 100%), radial-gradient(120% 80% at 0% 100%, rgba(30,143,98,.25), transparent 60%); }
.auth-pitch { position: absolute; left: 48px; right: 48px; bottom: 44px; z-index: 2; max-width: 460px; }
.auth-pitch .auth-logo { width: 190px; height: auto; margin-bottom: 22px; display: block; }
.auth-pitch h2 { margin: 0 0 16px; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-pitch li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(232,236,233,.82); }
.auth-pitch li .ic { flex: none; color: var(--green-text); }
/* справа: форма */
.auth-main { display: grid; place-items: center; padding: 32px 24px; overflow-y: auto; background: radial-gradient(700px 500px at 100% 0%, rgba(30,143,98,.08), transparent 60%); }
.auth-card { width: 100%; max-width: 380px; animation: msg-in .5s cubic-bezier(.22, 1, .36, 1) both; }
.auth-card.shake { animation: auth-shake .38s cubic-bezier(.36, .07, .19, .97); }
@keyframes auth-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-logo.mob { display: none; width: 170px; height: auto; margin-bottom: 26px; }
.auth h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { margin: 8px 0 26px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.auth-sub b { color: var(--green-text); }
#authForm { display: flex; flex-direction: column; gap: 16px; }
#authForm .pf-label { font-size: 13px; }
.af-input { position: relative; display: flex; align-items: center; height: 46px; border: 1px solid var(--stroke); border-radius: 10px; background: #0c0f0e; transition: border-color .15s, box-shadow .15s; }
.af-input > .ic { position: absolute; left: 13px; color: var(--faint); pointer-events: none; transition: color .15s; }
.af-input input { flex: 1; min-width: 0; height: 100%; padding: 0 12px 0 40px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; outline: none; }
.af-input input::placeholder { color: var(--faint); }
.af-input:focus-within { border-color: var(--green-hi); box-shadow: 0 0 0 3px rgba(30,143,98,.15); }
.af-input:focus-within > .ic { color: var(--green-text); }
.af-input.bad { border-color: #ff7a8a; box-shadow: 0 0 0 3px rgba(255,122,138,.12); }
.af-eye { flex: none; width: 38px; height: 38px; margin-right: 4px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; }
.af-eye:hover { color: var(--text); background: var(--glass-2); }
.af-input input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 40px #0c0f0e inset; caret-color: var(--text); }
/* надёжность пароля */
.af-meter { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.af-meter > span { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 120px; }
.af-meter i { height: 4px; border-radius: 4px; background: var(--stroke-hi); transition: background .25s; }
.af-meter em { font-style: normal; font-size: 12px; color: var(--muted); }
.af-meter[data-s="1"] i:nth-child(-n+1) { background: #f0c674; }
.af-meter[data-s="2"] i:nth-child(-n+2) { background: var(--green-hi); }
.af-meter[data-s="3"] i { background: var(--green-text); }
.af-caps { font-size: 12px; color: #f0c674; }
.auth-err { font-size: 13px; color: #ff9aa6; line-height: 1.4; }
.auth-err:empty { display: none; }
#authSubmit { position: relative; height: 46px; margin-top: 6px; font-size: 14.5px; border-radius: 10px; }
#authSubmit.loading span { opacity: 0; }
#authSubmit.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
#authSubmit.ok { background: var(--green-hi); }
#authSubmit:disabled:not(.loading):not(.ok) { opacity: .5; cursor: default; }
.auth-foot { margin: 22px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--faint); }
.auth-foot .link-btn { padding: 0; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-show { display: none; }
  .auth-logo.mob { display: block; }
}
@media (prefers-reduced-motion: reduce) { .aw-col { animation: none; } .auth-card, .auth-card.shake { animation: none; } }

/* ---------- аккаунт внизу боковой панели ---------- */
.account { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 6px 10px; margin-bottom: 8px; border: 0; border-bottom: 1px solid var(--stroke); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.account > .ic { margin-left: auto; color: var(--muted); }
.acc-ava { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(30,143,98,.16); border: 1px solid rgba(92,207,156,.3); color: var(--green-text); font-weight: 700; font-size: 13px; }
.acc-txt { min-width: 0; display: flex; flex-direction: column; }
.acc-txt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-item.danger { color: #ff9aa6; }

/* ---------- админка ---------- */
body[data-page="admin"] #messages, body[data-page="admin"] #composer, body[data-page="admin"] #panel,
body[data-page="admin"] #togglePanel, body[data-page="admin"] .resizer, body[data-page="admin"] #startBelow { display: none !important; }
body[data-page="admin"] #feed { display: block !important; }
body[data-page="admin"] #topbar .seg { display: none; }
.adm-sec { max-width: 960px; margin: 0 0 30px; }
.adm-head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.adm-head h2 .ic { color: var(--green-text); }
.adm-table { border: 1px solid var(--stroke); border-radius: 12px; overflow: hidden; }
.adm-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 130px 170px 210px; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--stroke); font-size: 13.5px; }
.adm-row:first-child { border-top: 0; }
.adm-th { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.02); padding-top: 9px; padding-bottom: 9px; }
.adm-row.off { opacity: .55; }
.adm-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-user > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.adm-user b { font-weight: 600; }
.adm-user small, .adm-num small, .adm-inv small { font-size: 12px; color: var(--muted); }
.adm-num { font-variant-numeric: tabular-nums; }
.adm-acts { display: flex; justify-content: flex-end; gap: 6px; }
.adm-invite { display: grid; grid-template-columns: minmax(0, 1fr) 170px auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--stroke); border-radius: 12px; margin-bottom: 10px; }
.adm-invite input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--stroke); border-radius: 8px; background: #0c0f0e; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.adm-invite input:focus { border-color: var(--green-hi); }
.adm-invite .btn { height: 38px; }
.adm-invites { display: flex; flex-direction: column; gap: 6px; }
.adm-inv { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--stroke); border-radius: 10px; }
.adm-inv > span { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; }
.adm-inv.used { opacity: .6; }
.adm-empty { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .adm-row { grid-template-columns: 1fr auto; } .adm-th { display: none; } .adm-row > span:nth-child(3) { display: none; } .adm-acts { grid-column: 1 / -1; justify-content: flex-start; } .adm-invite { grid-template-columns: 1fr; } }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
body[data-page="admin"] .cur-model, body[data-page="admin"] #chatCost { display: none !important; }
/* поле ввода не перекрывает скруглённые углы рамки (особенно при автозаполнении браузером) */
.af-input { overflow: hidden; }
.af-input input { border-radius: 9px; background-clip: padding-box; }

/* ---------- панель администратора: своё меню вместо рабочего ---------- */
.admin-side { display: none; flex-direction: column; gap: 5px; padding: 8px 10px 10px; }
body[data-page="admin"] .main-nav, body[data-page="admin"] #workspace { display: none !important; }
body[data-page="admin"] .admin-side { display: flex; }
body[data-page="admin"] #topbar { display: none !important; }
.adm-back { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-bottom: 10px; border: 1px solid var(--stroke); border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; transition: color .15s, border-color .15s; }
.adm-back:hover { color: var(--text); border-color: var(--stroke-hi); }
.adm-side-title { padding: 4px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--faint); }
.admin-side .nav-link.active { color: var(--green-text); background: rgba(30,143,98,.12); }

.adm-wrap { max-width: 1040px; margin: 0 auto; padding: 28px 8px 40px; }
.adm-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.adm-top h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.adm-top p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.adm-skel { height: 120px; margin-bottom: 14px; border-radius: 12px; background: linear-gradient(90deg, var(--glass) 0%, var(--glass-2) 50%, var(--glass) 100%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
/* обзор */
.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--stroke); border-radius: 12px; background: var(--glass); animation: msg-in .45s cubic-bezier(.22, 1, .36, 1) both; }
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; } .kpi:nth-child(4) { animation-delay: .12s; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi b { font-size: 24px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi:first-child b { color: var(--green-text); }
.kpi small { font-size: 12px; color: var(--faint); line-height: 1.35; }
.adm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adm-card { padding: 16px; border: 1px solid var(--stroke); border-radius: 12px; }
.adm-card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.bar-row { display: grid; grid-template-columns: minmax(0, 150px) 1fr auto; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; border-radius: 6px; background: var(--stroke); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--green), var(--green-text)); animation: bar-in .8s cubic-bezier(.22, 1, .36, 1) both; transform-origin: left; }
@keyframes bar-in { from { transform: scaleX(0); } }
.bar-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
/* пользователи */
.adm-tools { margin-bottom: 12px; }
.af-input.sm { height: 38px; max-width: 320px; }
.af-input.sm input { padding-left: 36px; font-size: 13.5px; }
.af-input.sm > .ic { left: 12px; }
.adm-tag { margin-left: 8px; padding: 1px 6px; border-radius: 5px; font-style: normal; font-size: 11px; font-weight: 500; color: var(--green-text); background: rgba(30,143,98,.14); vertical-align: 1px; }
.adm-tag.bad { color: #ff9aa6; background: rgba(255,122,138,.12); }
.adm-num b.zero { color: #f0c674; }
/* приглашения */
.adm-sub { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.adm-sub span { padding: 0 7px; border-radius: 6px; background: var(--glass-2); font-size: 12px; color: var(--text); }
.adm-inv > .acc-ava { width: 32px; height: 32px; }
@media (max-width: 900px) { .adm-kpis { grid-template-columns: 1fr 1fr; } .adm-cols { grid-template-columns: 1fr; } .adm-top { flex-direction: column; align-items: flex-start; } }
.adm-inv > span.acc-ava { flex: 0 0 32px; display: grid; }

/* числовые поля без системных стрелок; вместо них свои кнопки − и + */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-step { display: flex; align-items: center; gap: 6px; }
.num-step > button { flex: none; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--stroke); border-radius: 8px; background: var(--glass); color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.num-step > button:hover { color: var(--text); border-color: var(--stroke-hi); background: var(--glass-2); }
.num-step > button:active { transform: scale(.96); }
.ns-field { position: relative; flex: 1; min-width: 0; }
.adm-invite .ns-field input { padding-right: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.ns-field em { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); pointer-events: none; }
.adm-invite { grid-template-columns: minmax(0, 1fr) 200px auto; }

/* ======================================================================
   Поиск, горячие клавиши, тосты с отменой, скелетоны, сравнение, расходы, видео
   ====================================================================== */
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid #333b37; border-bottom-width: 2px; background: #1b201e; color: #cfd8d3; font: 600 11px/1 var(--font); white-space: nowrap; }

/* кнопка поиска в боковой панели */
.side-search { display: flex; align-items: center; gap: 9px; margin: 2px 8px 6px; height: 38px; padding: 0 8px 0 12px; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(255,255,255,.02); color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.side-search span { flex: 1; text-align: left; }
.side-search kbd { height: 18px; min-width: 18px; font-size: 10.5px; opacity: .8; }
.side-search:hover { color: var(--text); border-color: var(--stroke-hi); background: rgba(255,255,255,.04); }

/* окно поиска */
.search-modal { padding-top: 12vh; }
.search-box { width: 640px; padding: 0; gap: 0; overflow: hidden; }
.sm-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-bottom: 1px solid var(--stroke); color: var(--muted); }
.modal .sm-field input { flex: 1; background: none; border: 0; padding: 0; height: 100%; font-size: 16px; color: var(--text); border-radius: 0; }
.sm-results { overflow-y: auto; max-height: min(58vh, 520px); padding: 6px 8px 10px; scroll-padding: 8px; }
.sm-group { padding: 12px 10px 6px; font-size: 12px; font-weight: 600; color: var(--faint); }
.sm-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.sm-item.sel { background: var(--glass-2); border-color: var(--stroke-hi); }
.sm-ic { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 7px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); color: var(--muted); }
.sm-item.sel .sm-ic { color: var(--green-text); border-color: rgba(92,207,156,.35); }
.sm-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sm-txt b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sm-when { flex: none; color: var(--faint); font-size: 12px; }
.sm-results mark { background: rgba(92,207,156,.2); color: #bff0d8; border-radius: 3px; padding: 0 1px; }
.sm-works { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 2px 2px 4px; }
.sm-work { aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: var(--glass); cursor: pointer; transition: border-color .15s, transform .2s; }
.sm-work img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-work.sel { border-color: var(--green-text); transform: scale(.97); }
.sm-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 42px 20px; color: var(--muted); text-align: center; font-size: 13.5px; }
.sm-empty .ic { color: var(--faint); margin-bottom: 4px; }
.sm-empty b { color: var(--text); font-weight: 600; font-size: 14.5px; }
.sm-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--stroke); color: var(--faint); font-size: 12px; }
.sm-foot span { display: inline-flex; align-items: center; gap: 4px; }
.sm-foot kbd { height: 18px; min-width: 18px; font-size: 10.5px; }

/* шпаргалка */
.keys-box { width: 560px; }
.keys-list { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.keys-group h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.keys-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--stroke); font-size: 14px; }
.keys-group .keys-row:last-child { border-bottom: 0; }
.keys-combo { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.keys-combo em { font-style: normal; color: var(--faint); font-size: 11px; }
.pop-kbd { height: 18px; min-width: 18px; font-size: 10.5px; margin-left: auto; }
.pop-price { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 8px; }
.pop-item span:has(.pop-price) { display: flex; justify-content: space-between; align-items: baseline; }
.pop-item:disabled { opacity: .45; cursor: default; }

/* тост с действием */
.toast.act { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; overflow: hidden; }
.toast-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid rgba(92,207,156,.4); border-radius: 7px; background: rgba(30,143,98,.16); color: var(--green-text); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; }
.toast-btn:hover { background: rgba(30,143,98,.3); }
.toast-time { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--green-text); opacity: .55; transform-origin: left; animation: toast-time linear forwards; }
@keyframes toast-time { to { transform: scaleX(0); } }
.toast.act.err .toast-btn { color: #ffd2d8; border-color: rgba(255,122,138,.4); background: rgba(255,122,138,.12); }

/* удаление и переименование в списке чатов */
.chat-rename { flex: 1; min-width: 0; height: 26px; padding: 0 8px; border: 1px solid var(--green); border-radius: 6px; background: #0d1210; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.chat-item.editing .more { display: none; }
.chat-item.flash { animation: chat-flash 1.2s ease; }
@keyframes chat-flash { 0%, 30% { background: rgba(30,143,98,.22); } 100% { background: transparent; } }
.img-tile.removed { opacity: .25; filter: grayscale(1); pointer-events: none; transition: opacity .3s, filter .3s; }

/* скелетоны */
.skel { position: relative; overflow: hidden; background: #141816; border-radius: 8px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent); animation: skel 1.3s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes skel { to { transform: translateX(100%); } }
.skel-wrap { animation: fade-in .25s ease both; }
@keyframes fade-in { from { opacity: 0; } }
.skel-grid { padding: 24px 0; }
.skel-card { break-inside: avoid; margin-bottom: 10px; border-radius: 10px; }
.skel-chat { max-width: 780px; margin: 24px auto; display: flex; flex-direction: column; gap: 22px; padding: 0 16px; }
.skel-msg { display: flex; flex-direction: column; gap: 9px; }
.skel-msg.u { align-items: flex-end; }
.skel-msg.u .skel-line { height: 38px; border-radius: 10px; max-width: 360px; }
.skel-line { height: 13px; }
.skel-rows { display: flex; flex-direction: column; gap: 6px; padding: 6px 4px; }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; }
.skel-dot { width: 30px; height: 30px; border-radius: 7px; flex: none; }

/* сравнение «до и после» */
.compare-modal { align-items: center; padding: 16px; }
.compare-box { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.cmp-head { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--text); }
.cmp-head b { font-weight: 600; }
.cmp-stage { --pos: 50%; position: relative; max-width: calc(100vw - 32px); border-radius: 12px; overflow: hidden; cursor: ew-resize; user-select: none; touch-action: none; background: #0d100f; border: 1px solid var(--stroke-hi); }
.cmp-stage.alpha { background: repeating-conic-gradient(#1c211f 0 25%, #121614 0 50%) 0 0 / 22px 22px; }
.cmp-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.cmp-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); background: inherit; }
.cmp-stage.intro .cmp-before { transition: clip-path .6s cubic-bezier(.22, 1, .36, 1); }
.cmp-stage.intro .cmp-handle { transition: left .6s cubic-bezier(.22, 1, .36, 1); }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 0 18px rgba(0,0,0,.5); }
.cmp-handle span { position: absolute; top: 50%; left: 50%; display: flex; align-items: center; justify-content: center; gap: 0; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; color: #0a0c0b; box-shadow: 0 4px 18px rgba(0,0,0,.45); transition: transform .15s; }
.cmp-stage.drag .cmp-handle span, .cmp-stage:focus-visible .cmp-handle span { transform: scale(1.1); }
.cmp-stage:focus-visible { outline: 2px solid var(--green-text); outline-offset: 3px; }
.cmp-handle .flip-l { transform: rotate(90deg); margin-right: -3px; }
.cmp-handle .flip-r { transform: rotate(-90deg); margin-left: -3px; }
.cmp-tag { position: absolute; top: 12px; padding: 3px 9px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none; backdrop-filter: blur(6px); }
.cmp-tag.l { left: 12px; } .cmp-tag.r { right: 12px; }

/* инструменты под картинкой */
.ib-chip.tool { color: var(--green-text); border-color: rgba(92,207,156,.3); }
.tool-tag { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.tool-tag .ic { color: var(--green-text); }

/* расходы и лимиты */
.usage-box { width: 620px; }
.usage-body { display: flex; flex-direction: column; gap: 20px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.us-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.us-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,.02); }
.us-stat span { color: var(--muted); font-size: 12.5px; }
.us-stat b { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.us-stat small { color: var(--faint); font-size: 12px; }
.us-stat .warn { font-style: normal; color: #ffb27a; }
.us-h { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.us-bars { position: relative; display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 120px; align-items: end; }
.us-bar { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; cursor: default; }
.us-bar i { width: 100%; height: var(--h); min-height: 2px; border-radius: 4px 4px 2px 2px; background: #24302b; transform-origin: bottom; animation: bar-up .6s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i) * 25ms); transition: background .15s; }
.us-bar.today i { background: var(--green); }
.us-bar:hover i { background: var(--green-hi); }
.us-bar span { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
@keyframes bar-up { from { transform: scaleY(0); } }
.us-limit { position: absolute; left: 0; right: 0; margin-bottom: 19px; border-top: 1px dashed rgba(255,178,122,.6); }
.us-model { display: grid; grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); }
.us-model:last-child { border-bottom: 0; }
.um-name { display: flex; flex-direction: column; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-name small { color: var(--faint); font-size: 12px; }
.um-bar { height: 6px; border-radius: 3px; background: #18201c; overflow: hidden; }
.um-bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.us-model b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.us-set { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; border-top: 1px solid var(--stroke); }
.us-set .us-h { margin: 12px 0 0; }
.us-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.us-field > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.us-field b { font-weight: 500; font-size: 14px; }
.us-field small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.us-field .num-step { flex: none; width: 170px; }
.us-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 12.5px; }
.stat.clickable { cursor: pointer; border-radius: 6px; margin: -3px -6px; padding: 3px 6px; transition: background .15s; }
.stat.clickable:hover { background: rgba(255,255,255,.04); }

/* предупреждение о балансе и лимите */
.low-bal { display: flex; gap: 10px; margin: 0 8px 6px; padding: 10px 12px; border-radius: 9px; border: 1px solid rgba(255,178,122,.35); background: rgba(255,140,60,.08); color: #ffd6b8; font-size: 12.5px; line-height: 1.4; cursor: pointer; animation: fade-in .3s ease both; }
.low-bal .ic { flex: none; color: #ffb27a; margin-top: 1px; }
.low-bal b { display: block; color: #ffe6d4; font-weight: 600; font-size: 13px; }

/* очередь видео в боковой панели */
.video-queue { display: flex; align-items: center; gap: 10px; margin: 0 8px 6px; padding: 9px 12px; border: 1px solid rgba(92,207,156,.3); border-radius: 9px; background: rgba(30,143,98,.08); color: var(--text); text-align: left; cursor: pointer; animation: fade-in .3s ease both; }
.video-queue > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.video-queue b { font-size: 13px; font-weight: 600; }
.video-queue small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vq-ring { position: relative; display: grid; place-items: center; width: 30px; height: 30px; flex: none; color: var(--green-text); }
.vq-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(92,207,156,.18); border-top-color: var(--green-text); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* видео в чате */
.vid-tile { position: relative; display: flex; flex-direction: column; max-width: 100%; margin-top: 6px; }
.vid-tile video { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--stroke); background: #000; }
.vid-progress, .vid-sending, .vid-failed { border: 1px solid var(--stroke); border-radius: 10px; overflow: hidden; background: #0d110f; }
.vid-progress { min-height: 220px; }
.vid-sending { padding: 28px; }
.vp-bg { position: absolute; inset: 0; background: radial-gradient(120% 80% at 30% 20%, rgba(30,143,98,.16), transparent 60%), radial-gradient(90% 70% at 80% 90%, rgba(92,207,156,.08), transparent 60%); animation: vp-drift 8s ease-in-out infinite alternate; }
@keyframes vp-drift { to { transform: scale(1.12) translate(3%, -2%); } }
.vp-in { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; min-height: inherit; padding: 24px; text-align: center; }
.vid-sending .vp-in { flex-direction: row; padding: 0; }
.vp-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: rgba(30,143,98,.15); color: var(--green-text); margin-bottom: 4px; }
.vp-status { font-size: 15px; font-weight: 600; }
.vp-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.vp-track { width: min(320px, 80%); height: 4px; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; margin: 6px 0 4px; }
.vp-fill { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--green-text); transition: width 1s linear; }
.vp-in small { color: var(--faint); font-size: 12px; max-width: 340px; line-height: 1.45; }
.vid-failed .vf-in { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 24px; text-align: center; color: var(--muted); font-size: 13.5px; }
.vid-failed .vf-in .ic { color: var(--danger); }
.vid-failed b { color: var(--text); font-size: 15px; }
.vid-failed .btn { margin-top: 6px; }
.vid-tile .img-bar { margin-top: 8px; }

@media (max-width: 720px) {
  .sm-works { grid-template-columns: repeat(3, 1fr); }
  .us-stats { grid-template-columns: 1fr 1fr; }
  .us-field { flex-direction: column; align-items: stretch; }
  .sm-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .skel::after, .vp-bg, .vq-ring::before, .us-bar i { animation: none !important; }
}
.us-field .ns-field input { width: 100%; height: 38px; padding: 0 28px 0 10px; text-align: center; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.3); border: 1px solid var(--stroke); border-radius: 8px; color: var(--text); outline: none; }
.us-field .ns-field input:focus { border-color: var(--green); }
.video-queue, .low-bal { margin-top: 6px; }
.msg.user .imgs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.msg.user .imgs img { width: 96px; height: 96px; object-fit: cover; }
.us-model b { min-width: 72px; text-align: right; }

/* ======================================================================
   Страница проекта, команда: руководитель и исполнители
   ====================================================================== */
body[data-page="project"] #messages, body[data-page="project"] #composer, body[data-page="project"] #panel,
body[data-page="project"] #togglePanel, body[data-page="project"] .resizer, body[data-page="project"] #startBelow,
body[data-page="project"] .cur-model, body[data-page="project"] #chatCost, body[data-page="project"] #topbar .seg { display: none !important; }
body[data-page="project"] #feed { display: block !important; }
.nav-item.current { background: var(--glass-2); }
.sg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green-text); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(92,207,156,.15); }

.proj-page { max-width: 1180px; margin: 0 auto; padding: 44px 32px 60px; }
.pp-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.pp-badge { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 12px; color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 35%, transparent); }
.pp-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pp-title h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
.pp-desc { align-self: flex-start; padding: 2px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 14.5px; text-align: left; cursor: text; }
.pp-desc:hover { background: var(--glass-2); }
.pp-desc.empty { color: var(--faint); }
.pp-inline { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--green); border-radius: 7px; background: #0d1210; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 40px; align-items: start; }

.pp-composer { border: 1px solid var(--stroke-hi); border-radius: 12px; background: #121614; padding: 14px 14px 10px; transition: border-color .2s; }
.pp-composer:focus-within { border-color: rgba(92,207,156,.45); }
.pp-composer textarea { width: 100%; resize: none; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; outline: none; min-height: 48px; }
.pp-composer textarea::placeholder { color: var(--faint); }
.pp-cbar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.pp-mode { height: 34px; }
.pp-mode .seg-btn { display: inline-flex; align-items: center; gap: 6px; }
.pp-hint { color: var(--faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pp-send { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 0; border-radius: 9px; background: var(--green); color: #fff; cursor: pointer; transition: background .15s, transform .15s; }
.pp-send:hover { background: var(--green-hi); }
.pp-send:active { transform: scale(.95); }

.pp-tabs { display: flex; gap: 4px; margin: 30px 0 8px; border-bottom: 1px solid var(--stroke); }
.pp-tabs button { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.pp-tabs button em { font-style: normal; font-size: 12px; color: var(--faint); }
.pp-tabs button.active { color: var(--text); }
.pp-tabs button.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--green-text); }
.pp-tabs button:hover { color: var(--text); }
.pp-list { display: flex; flex-direction: column; }
.pp-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; margin: 0 -10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.pp-row:hover { background: var(--glass-2); }
.pp-ric { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--stroke); color: var(--muted); }
.pp-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-rt small { color: var(--faint); font-size: 12px; }
.pp-when { color: var(--faint); font-size: 12.5px; flex: none; }
.pp-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.pp-empty .ic { color: var(--faint); margin-bottom: 4px; }
.pp-empty b { color: var(--text); font-size: 14.5px; }
.pp-empty span { max-width: 380px; }

.pp-rail { display: flex; flex-direction: column; position: sticky; top: 20px; }
.pp-sec { border-bottom: 1px solid var(--stroke); }
.pp-sh { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 2px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; cursor: pointer; text-align: left; }
.pp-sh .ic { color: var(--muted); }
.pp-sh .pp-stt { flex: 1; }
.pp-sh em { font-style: normal; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.pp-sh:hover em { color: var(--text); }
.pp-new { font-weight: 600; color: var(--green-text); }
.pp-sb { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s cubic-bezier(.22, 1, .36, 1); }
.pp-sb > * { overflow: hidden; }
.pp-sec .pp-sb { display: none; }
.pp-sec.open .pp-sb { display: flex; flex-direction: column; gap: 8px; padding: 0 2px 16px; animation: fade-in .25s ease both; }
.pp-text { margin: 0; color: var(--text); font-size: 13.5px; line-height: 1.55; max-height: 180px; overflow-y: auto; }
.pp-text.muted { color: var(--muted); }
.pp-sb > .btn { align-self: flex-start; }
.pp-meter { height: 4px; border-radius: 2px; background: #1a211e; overflow: hidden; }
.pp-meter i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.pp-file { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.pp-file > .ic { color: var(--muted); flex: none; }
.pp-file span { flex: 1; min-width: 0; display: flex; flex-direction: column; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-file small { color: var(--faint); font-size: 12px; }
.pp-mem { display: flex; align-items: flex-start; gap: 4px; padding: 7px 0; font-size: 13.5px; line-height: 1.45; border-top: 1px solid var(--stroke); }
.pp-mem:first-child { border-top: 0; }
.pp-mem > span { flex: 1; min-width: 0; padding-top: 3px; }
.pp-mem .icon-btn { opacity: .55; }
.pp-mem:hover .icon-btn { opacity: 1; }
.pp-sugg { padding: 8px 10px; border-radius: 9px; border: 1px solid rgba(92,207,156,.3); background: rgba(30,143,98,.07); margin-bottom: 4px; }
.pp-sugg-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--green-text); margin-bottom: 2px; }
.pp-mem.sugg { border-top-color: rgba(92,207,156,.15); }
.pp-mem.sugg .icon-btn { opacity: 1; }
.pp-mem .icon-btn.ok { color: var(--green-text); }
.pp-add { display: flex; gap: 6px; margin-top: 4px; }
.pp-add input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
.pp-add input:focus { border-color: var(--green); }

/* карточка задачи команды */
.run-card { width: 100%; max-width: 720px; border: 1px solid var(--stroke-hi); border-radius: 12px; background: #111513; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.run-card.failed { border-color: rgba(255,122,138,.35); }
.rc-head { display: flex; align-items: center; gap: 12px; }
.rc-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; background: rgba(30,143,98,.15); color: var(--green-text); }
.run-card.working .rc-ic, .run-card.planning .rc-ic, .run-card.review .rc-ic, .run-card.final .rc-ic { animation: rc-pulse 1.6s ease-in-out infinite; }
@keyframes rc-pulse { 50% { box-shadow: 0 0 0 6px rgba(92,207,156,.1); } }
.rc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-t b { font-size: 14.5px; font-weight: 600; }
.rc-t small { color: var(--muted); font-size: 12.5px; }
.rc-time { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rc-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-step { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--stroke); color: var(--faint); font-size: 12.5px; }
.rc-step i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.rc-step.done { color: var(--muted); }
.rc-step.done .ic { color: var(--green-text); }
.rc-step.cur { color: var(--text); border-color: rgba(92,207,156,.45); background: rgba(30,143,98,.1); }
.rc-plan { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.rc-threads { display: flex; flex-direction: column; border: 1px solid var(--stroke); border-radius: 10px; overflow: hidden; }
.rc-th { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-top: 1px solid var(--stroke); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.rc-th:first-child { border-top: 0; }
.rc-th:hover { background: var(--glass-2); }
.rc-st { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none; border: 1px solid var(--stroke); color: var(--muted); }
.rc-th.done .rc-st { color: var(--green-text); border-color: rgba(92,207,156,.4); background: rgba(30,143,98,.12); }
.rc-th.working .rc-st, .rc-th.redo .rc-st, .rc-th.review .rc-st { color: var(--green-text); border-color: rgba(92,207,156,.35); }
.rc-th.failed .rc-st { color: var(--danger); border-color: rgba(255,122,138,.4); }
.rc-th.redo .rc-st { color: #ffb27a; border-color: rgba(255,178,122,.4); }
.rc-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rc-tt b { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-tt small { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-lb { color: var(--faint); font-size: 12px; flex: none; }
.rc-cost { color: var(--muted); font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }
.rc-go { transform: rotate(-90deg); color: var(--faint); flex: none; }
.rc-err { color: #ffc2ca; font-size: 13px; }
.spin, .spin-soft { animation: spin 1s linear infinite; }
.spin-soft { animation-duration: 1.8s; }
.msg.assistant .run-card + .bubble { margin-top: 12px; }

/* тред: инструкция руководителя и шапка */
.msg.lead-brief { align-items: stretch; }
.lead-brief { max-width: 760px; width: 100%; margin: 0 auto; border: 1px solid rgba(92,207,156,.28); border-left-width: 3px; border-radius: 10px; background: rgba(30,143,98,.06); padding: 12px 16px; }
.lb-head { display: flex; align-items: center; gap: 8px; color: var(--green-text); font-size: 13px; margin-bottom: 6px; }
.lb-head b { font-weight: 600; }
.lb-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.thread-banner { display: flex; align-items: center; gap: 12px; max-width: 760px; width: 100%; margin: 0 auto 18px; padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 10px; background: #111513; }
.thread-banner > .ic { color: var(--green-text); flex: none; }
.thread-banner span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thread-banner b { font-size: 14px; font-weight: 600; }
.thread-banner small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

@media (max-width: 980px) {
  .pp-grid { grid-template-columns: 1fr; gap: 24px; }
  .pp-rail { position: static; order: -1; }
  .proj-page { padding: 28px 16px 48px; }
  .pp-hint { display: none; }
}
.pp-head { align-items: flex-start; } .pp-title { padding-top: 6px; }
.pp-title .pp-desc { display: block; width: auto; max-width: 100%; height: auto; min-height: 0; justify-content: flex-start; }
.pp-head > .icon-btn { align-self: flex-start; }

/* команда: выбор моделей */
.pp-hint { display: flex; gap: 6px; align-items: center; overflow: visible; }
.team-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 7px; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(255,255,255,.02); color: var(--text); font: inherit; cursor: pointer; text-align: left; min-width: 0; transition: border-color .15s, background .15s; }
.team-chip:hover { border-color: var(--stroke-hi); background: var(--glass-2); }
.team-chip > span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.team-chip small { font-size: 10.5px; color: var(--faint); }
.team-chip > span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.team-chip > .i-chevron { color: var(--faint); flex: none; }
.pp-team { display: flex; flex-direction: column; gap: 6px; }
.team-chip.wide { height: 46px; padding: 0 10px; width: 100%; }
.team-chip.wide > span { flex: 1; max-width: none; font-size: 13.5px; gap: 2px; }
.team-chip.wide small { font-size: 11.5px; }
#quickParams .team-chip { height: 34px; }
.model-pop { width: 320px; max-width: 320px; overflow: hidden; display: flex; flex-direction: column; }
.mp-search { margin: 2px 2px 6px; height: 34px; padding: 0 10px; border: 1px solid var(--stroke); border-radius: 7px; background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
.mp-search:focus { border-color: var(--green); }
.mp-list { overflow-y: auto; max-height: 300px; }
.mp-item em { font-style: normal; color: var(--faint); font-size: 12px; margin-left: auto; white-space: nowrap; }
.mp-item > .mp-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-item .i-check { color: var(--green-text); }
.mp-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.rc-st img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.rc-th.done .rc-st:has(img) { padding: 0; overflow: hidden; }

.pp-cbar { flex-wrap: wrap; row-gap: 10px; }
.pp-hint { order: 5; flex-basis: 100%; flex-wrap: wrap; }
.pp-hint:empty { display: none; }
.mp-item > .logo { flex: none; }

/* выбор модели: компании слева, модели справа */
.popover.model-pop { width: 560px; max-width: calc(100vw - 16px); max-height: min(520px, 80vh); overflow: hidden; display: flex; flex-direction: column; padding: 8px; }
.mp-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 6px; min-height: 0; flex: 1; height: 360px; }
.mp-body.searching { grid-template-columns: minmax(0, 1fr); }
.mp-body.searching .mp-fams { display: none; }
.mp-fams { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-right: 6px; border-right: 1px solid var(--stroke); }
.mp-fam { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; transition: background .12s, color .12s; }
.mp-fam > span:not(.logo) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-fam em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.mp-fam:hover { background: var(--glass-2); color: var(--text); }
.mp-fam.on { background: rgba(30,143,98,.14); color: var(--text); }
.mp-cur { width: 6px; height: 6px; border-radius: 50%; background: var(--green-text); flex: none; }
.mp-list { overflow-y: auto; max-height: none; min-height: 0; padding-right: 2px; }
.mp-group { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px; background: #18181c; color: var(--muted); font-size: 12px; font-weight: 600; }
.mp-group small { font-weight: 400; color: var(--faint); margin-left: auto; }
.mp-item { min-height: 38px; }
.mp-item em { margin-left: 10px; }
@media (max-width: 620px) { .mp-body { grid-template-columns: 1fr; } .mp-fams { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--stroke); padding: 0 0 6px; } .mp-fam { flex: none; } .mp-body { height: 400px; grid-template-rows: auto 1fr; } }

/* скроллбары в стиле интерфейса: тонкие, без стрелок */
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto !important; scrollbar-color: auto !important; }
  ::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
  ::-webkit-scrollbar-thumb:hover { background-color: rgba(92,207,156,.35); }
  ::-webkit-scrollbar-button, ::-webkit-scrollbar-corner { display: none; background: transparent; }
}
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; } }
.mp-fam > .logo, .mp-group > .logo { flex: none !important; }
.mp-fam > span:not(.logo) { flex: 1; }

/* кнопки выбора моделей команды */
.team-chip { gap: 8px; }
.team-chip > span { max-width: none; }
.team-chip .tc-ic { display: grid; place-items: center; flex: none; width: 24px; height: 24px; }
.team-chip .tc-ic .logo { flex: none; }
.team-chip .tc-t { display: flex; flex-direction: column; min-width: 0; max-width: 150px; line-height: 1.15; }
.team-chip .tc-t small { font-size: 10.5px; color: var(--faint); }
.team-chip .tc-t b { font-weight: 500; font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-chip > .i-chevron { color: var(--faint); flex: none; margin-left: 2px; }
.team-chip.wide { height: 54px; padding: 0 12px 0 10px; gap: 12px; }
.team-chip.wide .tc-ic { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--stroke); background: rgba(255,255,255,.03); }
.team-chip.wide .tc-t { flex: 1; max-width: none; gap: 3px; }
.team-chip.wide .tc-t small { font-size: 12px; }
.team-chip.wide .tc-t b { font-size: 14px; }
.team-chip .tc-p { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; }
.pp-team { gap: 8px; margin-top: 4px; }
.team-chip > .tc-ic, .team-chip.wide > .tc-ic { flex: none; display: grid; place-items: center; }
.team-chip.wide > .tc-ic { width: 34px; height: 34px; }
.team-chip.wide > .tc-t { flex: 1; }

/* ======================================================================
   Страница проекта, вторая версия
   ====================================================================== */
.proj-page { position: relative; max-width: 1160px; padding: 26px 36px 72px; }
.pp-head { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-bottom: 30px; padding-right: 48px; }
.pp-glow { position: absolute; left: -120px; top: -140px; width: 620px; height: 360px; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--pc) 16%, transparent), transparent 70%); filter: blur(10px); }
.pp-crumb { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; color: var(--faint); font-size: 13px; }
.pp-crumb span { color: var(--muted); }
.pp-back { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: none; color: var(--faint); font: inherit; cursor: pointer; }
.pp-back:hover { color: var(--text); background: var(--glass-2); }
.pp-crumb-sep { transform: rotate(-90deg); opacity: .6; }
.pp-titlerow { display: flex; align-items: center; gap: 14px; }
.pp-titlerow h1 { margin: 0; font-size: 34px; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; }
.pp-badge { width: 44px; height: 44px; border-radius: 12px; }
.pp-head .pp-desc { display: block; width: auto; height: auto; margin: 10px 0 0 52px; padding: 3px 8px; margin-left: 50px; font-size: 15px; color: var(--muted); justify-content: flex-start; border-radius: 7px; }
.pp-head .pp-desc.empty { color: var(--faint); border: 1px dashed transparent; }
.pp-head .pp-desc.empty:hover { border-color: var(--stroke-hi); }
.pp-head .pp-inline { margin: 10px 0 0 58px; max-width: 560px; }
.pp-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0 58px; }
.pp-stat { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255,255,255,.02); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.pp-stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pp-stat .ic { color: var(--faint); }
.pp-stat.zero b { color: var(--muted); }
.pp-stat:hover { border-color: var(--stroke-hi); color: var(--text); background: var(--glass-2); }
.pp-set { position: absolute; right: 0; top: 40px; }

.pp-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; }

/* поле ввода */
.pp-cwrap { position: relative; }
.pp-composer { position: relative; z-index: 2; padding: 16px 16px 12px; border-radius: 20px; border: 1px solid var(--stroke-hi); background: #151917;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 60px -28px rgba(0,0,0,.9); transition: border-color .25s, box-shadow .25s; }
.pp-composer:focus-within { border-color: rgba(92,207,156,.4); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 0 0 4px rgba(30,143,98,.08), 0 24px 60px -28px rgba(0,0,0,.9); }
.pp-composer.lead { background: linear-gradient(180deg, #151c19, #141816); }
.pp-composer textarea { min-height: 52px; max-height: 260px; padding: 2px 4px; font-size: 16px; line-height: 1.55; }
.pp-composer.shake { animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.pp-cbar { flex-wrap: nowrap; margin-top: 8px; gap: 8px; }
.pp-plus { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--stroke); border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s, transform .2s; }
.pp-plus:hover { color: var(--text); border-color: var(--stroke-hi); transform: rotate(90deg); }
.pp-mode { position: relative; display: inline-flex; padding: 3px; border-radius: 19px; background: rgba(0,0,0,.35); border: 1px solid var(--stroke); }
.pp-mode button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border: 0; border-radius: 15px; background: none; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: color .2s; }
.pp-mode button.active { color: #eafff4; }
.pp-mode button:hover:not(.active) { color: var(--text); }
.pp-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 15px; background: var(--green); box-shadow: 0 4px 14px -4px rgba(30,143,98,.7); transition: transform .35s cubic-bezier(.22, 1, .36, 1); }
.pp-composer.lead .pp-thumb { transform: translateX(100%); }
.pp-mode button { flex: 1; justify-content: center; min-width: 96px; }
.pp-kbd { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; opacity: 0; transition: opacity .2s; }
.pp-composer.filled .pp-kbd { opacity: 1; }
.pp-send { width: 40px; height: 40px; border-radius: 50%; background: #2a302d; color: var(--muted); }
.pp-composer.filled .pp-send { background: var(--green); color: #fff; }
.pp-composer.filled .pp-send:hover { background: var(--green-hi); }

/* лоток под полем: модели */
.pp-tray { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -14px 14px 0; padding: 24px 12px 10px; border: 1px solid var(--stroke); border-top: 0; border-radius: 0 0 16px 16px; background: #0f1311; }
.pp-tray .team-chip { height: 40px; border-color: transparent; background: none; padding: 0 8px 0 6px; }
.pp-tray .team-chip:hover { background: var(--glass-2); border-color: var(--stroke); }
.pp-sees { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--faint); font-size: 12.5px; }

/* вкладки и список */
.pp-tabs { gap: 2px; margin: 34px 0 10px; border-bottom: 0; padding: 3px; width: fit-content; border-radius: 11px; background: rgba(255,255,255,.03); border: 1px solid var(--stroke); }
.pp-tabs button { gap: 7px; padding: 7px 14px; border-radius: 8px; font-size: 13.5px; transition: background .15s, color .15s; }
.pp-tabs button.active { background: var(--glass-2); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.pp-tabs button.active::after { display: none; }
.pp-tabs button em { min-width: 18px; padding: 0 5px; border-radius: 9px; background: rgba(255,255,255,.06); text-align: center; line-height: 18px; }
.pp-tabs button em:empty { display: none; }
.pp-list { gap: 4px; }
.pp-row { margin: 0; padding: 11px 12px; border: 1px solid transparent; border-radius: 12px; }
.pp-row:hover { background: rgba(255,255,255,.03); border-color: var(--stroke); }
.pp-ric { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.03); }
.pp-row:hover .pp-ric { color: var(--green-text); border-color: rgba(92,207,156,.3); }
.pp-rt b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-go { transform: rotate(-90deg); color: var(--faint); opacity: 0; transition: opacity .15s, transform .2s; }
.pp-row:hover .pp-go { opacity: 1; transform: rotate(-90deg) translateY(2px); }

/* пусто: идеи для старта */
.pp-empty { align-items: flex-start; text-align: left; padding: 18px 2px 0; gap: 4px; }
.pp-empty b { font-size: 15px; }
.pp-empty span { max-width: 520px; }
.pp-ideas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 14px; }
.pp-idea { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255,255,255,.02); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.pp-idea:hover { border-color: rgba(92,207,156,.35); background: rgba(30,143,98,.06); transform: translateY(-2px); }
.pi-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(30,143,98,.14); color: var(--green-text); margin-bottom: 6px; }
.pp-idea b { font-size: 14px; font-weight: 600; }
.pp-idea small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* правая колонка: карточки */
.pp-rail { gap: 10px; top: 16px; }
.pp-sec { border: 1px solid var(--stroke); border-radius: 14px; background: #111513; transition: border-color .2s; }
.pp-sec.open { border-color: var(--stroke-hi); }
.pp-sh { gap: 12px; padding: 12px 14px; }
.pp-sic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; background: rgba(255,255,255,.04); color: var(--muted); transition: background .2s, color .2s; }
.pp-sec.open .pp-sic { background: rgba(30,143,98,.14); color: var(--green-text); }
.pp-stt { flex: 1; font-weight: 550; font-size: 14px; }
.pp-sh > span:not(.pp-sic):not(.pp-stt) { flex: none; }
.pp-sh em { font-size: 12.5px; }
.pp-chev { color: var(--faint); transition: transform .25s cubic-bezier(.22, 1, .36, 1); flex: none; }
.pp-sec.open .pp-chev { transform: rotate(180deg); }
.pp-sec.open .pp-sb { padding: 0 14px 14px; }
.pp-sec .pp-text { font-size: 13px; }

@media (max-width: 980px) {
  .proj-page { padding: 18px 16px 56px; }
  .pp-head .pp-desc, .pp-stats { margin-left: 0; }
  .pp-ideas { grid-template-columns: 1fr; }
  .pp-kbd, .pp-sees { display: none; }
  .pp-mode button { min-width: 0; padding: 0 10px; }
}
.pp-stats:empty { display: none; }
.pp-lh { display: flex; align-items: center; gap: 8px; margin: 36px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.pp-lh em { font-style: normal; min-width: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 12px; line-height: 20px; text-align: center; }
.pp-lh + .pp-list .pp-empty { padding-top: 0; }
/* кнопка отправки в проекте: стрелка вверх, контрастная, без «улёта» */
.pp-send { transition: background .2s, transform .15s; }
.pp-send .ic { stroke-width: 2.4; color: #7d8682; stroke: currentColor; transition: color .2s, transform .25s cubic-bezier(.22, 1, .36, 1); animation: none !important; }
.pp-composer.filled .pp-send .ic, .pp-composer.filled .pp-send:hover .ic { color: #fff; }
.pp-composer.filled .pp-send:hover .ic { transform: translateY(-2px); }
.pp-send:active { transform: scale(.92); }
/* основная кнопка «Отправить»: мягкий подъём вместо исчезновения */
@keyframes ic-lift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.pp-send:hover .ic, .pp-send:focus-visible .ic { color: #fff !important; }
.pp-send:hover .ic { transform: translateY(-2px); }
.pp-sugg-h span { flex: 1; }
.pp-sugg-all { border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--muted); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.pp-sugg-all:hover { color: var(--text); background: var(--glass-2); }

/* ======================================================================
   Основное поле ввода в стиле страницы проекта: карточка и лоток с моделью
   ====================================================================== */
#composer { padding: 8px 12px 14px; }
#composer > * { max-width: 820px; }
#composer .composer { position: relative; z-index: 2; padding: 12px 12px 10px; border-radius: 20px; border: 1px solid var(--stroke-hi); background: #151917;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 60px -28px rgba(0,0,0,.9); transition: border-color .25s, box-shadow .25s; }
#composer .composer:focus-within { border-color: rgba(92,207,156,.4); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 0 0 4px rgba(30,143,98,.08), 0 24px 60px -28px rgba(0,0,0,.9); }
#composer .composer::before, #composer .composer::after { display: none; }
#composer #input { font-size: 15.5px; line-height: 1.55; }
#composer .comp-bar { padding: 6px 0 0; gap: 6px; }
#composer .cbtn { width: 36px; height: 36px; border-radius: 50%; }
#composer .estimate { border-radius: 18px; }
#composer .send { width: 40px; height: 40px; border-radius: 50%; background: #2a302d; color: #7d8682; transition: background .2s, transform .15s; }
#composer .send .ic { stroke: currentColor; stroke-width: 2.4; transition: transform .25s cubic-bezier(.22, 1, .36, 1); animation: none !important; }
#composer .composer.filled .send, #composer .send.busy { background: var(--green); color: #fff; }
#composer .send:hover { background: var(--green-hi); color: #fff; }
#composer .send:hover .ic { transform: translateY(-2px); }
#composer .send.busy:hover .ic { transform: none; }
#composer .send:active { transform: scale(.92); }

.comp-tray { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: -14px 14px 0 !important; padding: 22px 10px 8px; border: 1px solid var(--stroke); border-top: 0; border-radius: 0 0 16px 16px; background: #0f1311; }
.comp-tray .team-chip { height: 40px; border-color: transparent; background: none; padding: 0 8px 0 6px; }
.comp-tray .team-chip:hover:not(:disabled) { background: var(--glass-2); border-color: var(--stroke); }
.comp-tray .team-chip:disabled { cursor: default; opacity: 1; }
.comp-tray .model-chip { margin-right: 4px; }
.comp-tray .model-chip.hidden { display: none; }
.comp-tray .quick { display: contents; }
.comp-tray .qchip { height: 34px; border-radius: 10px; border-color: transparent; background: none; color: var(--text); font-size: 13px; padding: 0 10px; }
.comp-tray .qchip:hover { background: var(--glass-2); border-color: var(--stroke); }
.comp-tray .qchip.vis.pub { border-color: rgba(92,207,156,.35); background: rgba(30,143,98,.1); }
.comp-tray .model-chip + .qchip:not(.hidden), .comp-tray .model-chip + .qchip.hidden + .quick > :first-child { margin-left: 0; }
.comp-tray::before { content: ''; position: absolute; left: 0; right: 0; top: 14px; height: 1px; background: transparent; }
.start-model { display: none !important; }
#composer .hint { display: none; }
#composer .comp-tray { margin: -14px auto 0 !important; width: calc(100% - 28px); max-width: 792px; box-sizing: border-box; }
#composer .pp-mode { margin-left: 4px; }
#composer .pp-mode.hidden { display: none; }
#composer .composer.lead .pp-thumb { transform: translateX(100%); }
#composer .composer.lead { background: linear-gradient(180deg, #151c19, #141816); }
@media (max-width: 720px) { #composer .pp-mode button { min-width: 0; padding: 0 10px; } }
.pp-mic { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.pp-mic.rec { width: auto; padding: 0 12px; border-radius: 18px; }

/* план команды: согласование */
.run-card.muted { opacity: .6; padding: 10px 14px; }
.run-card.awaiting { border-color: rgba(92,207,156,.35); box-shadow: 0 0 0 4px rgba(30,143,98,.06); }
.rc-th.t-image .rc-st, .rc-th.t-video .rc-st, .rc-th.proposed .rc-st { color: var(--muted); }
.rc-model { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px 0 6px; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(255,255,255,.02); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; flex: none; max-width: 210px; transition: border-color .15s, background .15s; }
.rc-model span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-model .logo { flex: none; }
.rc-model .i-chevron { color: var(--faint); flex: none; }
.rc-model:hover { border-color: var(--stroke-hi); background: var(--glass-2); }
.rc-th.proposed { cursor: default; }
.rc-th.proposed:hover { background: none; }
.rc-th .rc-cost { min-width: 64px; text-align: right; }
.rc-approve { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(30,143,98,.07); border: 1px solid rgba(92,207,156,.22); }
.rc-est { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rc-est small { color: var(--muted); font-size: 12px; }
.rc-est b { font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rc-est span { color: var(--faint); font-size: 12px; line-height: 1.4; }
.rc-approve .btn.primary { height: 40px; padding: 0 18px; border-radius: 10px; }
.rc-approve .btn { height: 40px; border-radius: 10px; }
.rc-hint { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--faint); font-size: 12.5px; }
.run-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; width: 100%; max-width: 720px; margin-top: 12px; }
.run-videos figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.run-videos video { width: 100%; border-radius: 10px; border: 1px solid var(--stroke); background: #000; }
.run-videos figcaption { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; }
.run-videos a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.run-videos a:hover { color: var(--text); }
.mp-auto { min-height: 48px; margin-bottom: 6px; border: 1px dashed var(--stroke-hi) !important; border-radius: 9px; }
.mp-auto .mp-n { display: flex; flex-direction: column; gap: 1px; }
.mp-auto .mp-n b { font-weight: 600; font-size: 13.5px; }
.mp-auto .mp-n small { color: var(--muted); font-size: 12px; white-space: normal; }
.mp-auto > .ic:first-child { color: var(--green-text); }
.team-chip.auto .tc-ic { color: var(--green-text); }
@media (max-width: 720px) { .rc-approve { flex-wrap: wrap; } .rc-est { flex-basis: 100%; } .rc-model { max-width: 130px; } }
.popover.model-pop > * { flex: none; }
.popover.model-pop > .mp-body { flex: 1 1 auto; }
.popover .mp-search { height: 40px !important; min-height: 40px; padding: 0 12px !important; box-sizing: border-box; font-size: 14px; }
