:root {
  --bg: #08080d;
  --text: #f1f5f9;
  --sub: #94a3b8;
  --sub-dim: #64748b;
  --primary: #a855f7;
  --primary2: #7c3aed;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.14);
  --danger: #ef4444;
  --radius: 18px;
  --sb-w: 264px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

.context-tree { display: grid; gap: 10px; max-width: 720px; }
.ctx-product { border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 12px; overflow: hidden; }
.ctx-product-row, .ctx-chat-row { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.ctx-product-row { padding: 14px; background: transparent; font-weight: 700; }
.ctx-product-row:hover, .ctx-chat-row:hover { background: rgba(255,255,255,.06); }
.ctx-chevron { margin-left: auto; transition: transform .2s ease; }
.ctx-product.open .ctx-chevron { transform: rotate(90deg); }
.ctx-chats { display: none; padding: 0 8px 8px 28px; }
.ctx-product.open .ctx-chats { display: grid; gap: 2px; }
.ctx-chat-row { padding: 9px 10px; background: transparent; color: var(--muted, #94a3b8); border-radius: 8px; }
.ctx-file-dot { color: #a78bfa; font-size: 18px; line-height: 0; }
.ctx-count { margin-left: auto; color: var(--muted, #64748b); font-size: 11px; }
.ctx-empty { padding: 8px 10px; color: var(--muted, #64748b); font-size: 12px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; height: 100dvh; height: calc(var(--vvh, 100dvh));
  background: var(--bg); color: var(--text);
  font-family: var(--font); overflow: hidden;
}
button, textarea, input { font: inherit; color: inherit; }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; }
svg.ic.sm { width: 15px; height: 15px; }
svg.ic.xl { width: 34px; height: 34px; }
svg.ic path, svg.ic circle, svg.ic rect { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ── mesh background: /mesh.js сам создаёт <canvas id="mesh-bg"> первым
   элементом в body — здесь только фиксируем что он под всем UI ── */
#mesh-bg {
  position: fixed !important; inset: 0; width: 100vw; height: 100vh;
  z-index: 0; pointer-events: none;
}

#app {
  position: relative; z-index: 1;
  display: flex; height: 100%; height: 100dvh; min-height: 0;
  background: transparent; /* критично: НЕ перекрывать mesh собственным фоном */
}

/* ════════ SIDEBAR ════════ */
.sidebar {
  width: var(--sb-w); flex-shrink: 0; display: flex; flex-direction: column;
  position: relative; z-index: 30;
  border-radius: 0 20px 20px 0;
  border-left: none;
}
.sb-head { padding: 14px 12px 8px; }
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px 14px; }
.sb-brand-mark {
  width: 24px; height: 24px; border-radius: 7px; overflow: hidden; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(168,85,247,0.4);
}
.sb-brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.btn-new {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; font-weight: 500; font-size: 14px; cursor: pointer;
  color: var(--text);
}
.btn-new .ic { color: var(--primary); }
.sb-chats { flex: 1; overflow-y: auto; padding: 4px 10px; }
.chat-row {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
  color: var(--sub); margin-bottom: 2px;
}
.chat-row .ct { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .cx {
  flex-shrink: 0; width: 20px; height: 20px; border: none; border-radius: 6px; padding: 0;
  background: transparent; color: var(--sub-dim); cursor: pointer; opacity: 0;
  display: grid; place-items: center; transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-row .cx svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.chat-row:hover .cx, .chat-row.on .cx { opacity: 1; }
.chat-row .cx:hover { background: rgba(239,68,68,0.14); color: var(--danger); }
.chat-row:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.chat-row.on { background: rgba(168,85,247,0.14); color: var(--text); }
.sb-foot { padding: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 12px; border: none; background: transparent; cursor: pointer;
  border-radius: 10px; font-size: 13.5px; color: var(--sub);
}
.sb-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sb-item .ic { color: var(--sub-dim); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; margin-top: 6px; cursor: pointer; border-radius: 10px; transition: background 0.15s; }
.user-chip:hover { background: rgba(255,255,255,0.05); }
.user-chip.authed .av { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; }
.av {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.un { font-size: 13px; font-weight: 600; }
.us { font-size: 11px; color: var(--sub-dim); }
.backdrop {
  display: none; position: fixed; inset: 0; z-index: 25; pointer-events: none;
  /* лёгкое затемнение без blur — чат остаётся читаемым */
  background: rgba(2, 6, 23, 0.42);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: opacity 0.28s ease;
  opacity: 0;
}
.backdrop.show { display: block; pointer-events: auto; opacity: 1; }

/* убрать синюю системную обводку при тапе/фокусе */
button, a, input, textarea, [tabindex] {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
button:focus-visible, a:focus-visible {
  outline: 1px solid rgba(168, 85, 247, 0.45) !important;
  outline-offset: 2px;
}

/* ════════ MAIN ════════ */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: transparent; }
.top {
  height: 54px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; position: relative; z-index: 20;
}
.icon-only {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: transparent; cursor: pointer; display: grid; place-items: center;
  color: var(--text); text-decoration: none;
}
.icon-only:hover { background: rgba(255,255,255,0.06); }
.mobile { display: none; }
.model-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; font-weight: 600; font-size: 13.5px; cursor: pointer; border-radius: 11px; }
.model-btn .ic.sm { color: var(--sub-dim); }
.grow { flex: 1; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sub-dim); margin-right: 6px; transition: background 0.3s; }
.conn-dot.live { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.conn-dot.down { background: var(--danger); }

/* ════════ WORKSPACE (chat + canvas split) ════════ */
.workspace { display: none; flex: 1; min-height: 0; }
.workspace.active { display: flex; }
#view-chat { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.workspace.canvas-open #view-chat { flex: 1 1 52%; }

/* Экраны, что занимают весь main — БЕЗ собственного фона, mesh должен просвечивать */
.view { display: none; flex-direction: column; flex: 1; min-height: 0; background: transparent; }
.view.active { display: flex; }
#view-chat.active { display: flex; }

.msgs { flex: 1; overflow-y: auto; padding: 18px 0 10px; background: transparent; }
.hero { max-width: 620px; margin: 8vh auto 0; text-align: center; padding: 0 20px; }
.hero-mark {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px; overflow: hidden;
  display: grid; place-items: center;
  box-shadow: 0 14px 40px rgba(168,85,247,0.38);
  animation: glassFloat 3600ms var(--ease-glass, ease-in-out) infinite;
}
.hero-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.hero p { margin: 0 0 24px; color: var(--sub); font-size: 14.5px; }
.sugs { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.sug {
  padding: 13px 16px; border-radius: 14px; cursor: pointer; font-size: 13.5px;
  color: var(--sub); text-align: left; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.sug:hover { border-color: rgba(168,85,247,0.35); color: var(--text); }

.row { display: flex; justify-content: center; padding: 10px 18px; }
.row .inner { width: 100%; max-width: 760px; display: flex; gap: 13px; align-items: flex-start; }
/* GhoGem слева, пользователь справа */
.row.user .inner { flex-direction: row-reverse; }
.row.user { justify-content: center; }
.row.user .body { text-align: right; }
.row.user .txt { display: inline-block; text-align: left; background: rgba(168,85,247,0.12); border: 1px solid rgba(168,85,247,0.22); border-radius: 14px 14px 4px 14px; padding: 10px 13px; max-width: 100%; }
.row.user .msg-actions { justify-content: flex-end; }
.mav {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.mav img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row.bot .mav { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; }
.row.user .mav { background: rgba(255,255,255,0.12); color: var(--text); }
.body { flex: 1; min-width: 0; padding-top: 2px; }
.body.dim { opacity: 0.55; }
.role { font-size: 12px; font-weight: 600; color: var(--sub-dim); margin-bottom: 3px; }
.txt { font-size: 14.5px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

/* контекстное меню под сообщением */
.msg-actions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
  opacity: 0.55; transition: opacity 0.18s ease;
}
.row:hover .msg-actions, .row:focus-within .msg-actions { opacity: 1; }
.msg-act {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.03); color: var(--sub); font-size: 11.5px;
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.msg-act:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--border-strong); }
.msg-act .ic { width: 13px; height: 13px; }

/* markdown rendering inside .txt when set via innerHTML */
.txt p { margin: 0 0 9px; }
.txt p:last-child { margin-bottom: 0; }
.txt ul, .txt ol { margin: 0 0 9px; padding-left: 20px; }
.txt code { font-family: var(--mono); font-size: 12.5px; background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 5px; }
.txt pre { margin: 8px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #0d0d13; }
.txt pre code { display: block; padding: 13px 15px; font-size: 12.5px; line-height: 1.55; background: none; overflow-x: auto; white-space: pre; }

/* ── thinking block ── */
.think-block { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,0.02); overflow: hidden; }
.think-head { display: flex; align-items: center; gap: 7px; padding: 8px 13px; cursor: pointer; font-size: 12px; color: var(--sub-dim); }
.think-head .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: dotPulse 1.2s infinite ease-in-out; }
.think-block.done .think-head .dot { animation: none; opacity: 0.4; }
@keyframes dotPulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
.think-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; font-size: 12px; color: var(--sub-dim); font-style: italic; white-space: pre-wrap; padding: 0 13px; }
.think-block.open .think-body { max-height: 320px; overflow-y: auto; padding: 0 13px 10px; }

/* ── action cards (tool calls) ── */
.agent-actions { margin: 6px 0; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,0.02); overflow: hidden; }
.agent-actions-head {
  width: 100%; display: flex; align-items: center; gap: 7px; padding: 9px 12px;
  border: none; background: transparent; color: var(--sub); font-size: 12.5px; cursor: pointer; text-align: left;
}
.agent-actions-chevron { transition: transform 0.2s; color: var(--sub-dim); }
.agent-actions.open .agent-actions-chevron { transform: rotate(180deg); }
.agent-actions-title { font-weight: 600; }
.agent-actions-count { margin-left: auto; font-size: 11px; color: var(--sub-dim); background: rgba(255,255,255,0.06); border-radius: 999px; padding: 1px 8px; }
.agent-actions-body { display: none; flex-direction: column; gap: 4px; padding: 0 8px 8px; }
.agent-actions.open .agent-actions-body { display: flex; }
.action-card { border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); font-size: 12.5px; color: var(--sub); cursor: pointer; overflow: hidden; }
.action-main { display: flex; align-items: center; gap: 8px; padding: 7px 10px; }
.action-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-chevron { color: var(--sub-dim); transition: transform 0.2s; font-size: 13px; }
.action-card.expanded .action-chevron { transform: rotate(90deg); }
.action-card.pending .spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.action-card.done { color: var(--sub); }
.action-details { display: none; padding: 0 10px 9px; }
.action-card.expanded .action-details { display: block; }
.action-detail-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--sub-dim); margin: 6px 0 3px; }
.action-details pre { margin: 0; padding: 8px 10px; border-radius: 8px; background: #0d0d13; border: 1px solid var(--border); font-family: var(--mono); font-size: 11px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word; color: var(--sub); }
.action-detail-empty { font-size: 11.5px; color: var(--sub-dim); font-style: italic; }

/* ── fallback note (переключение модели при лимите — НЕ tool card) ── */
.fallback-note {
  display: flex; align-items: center; gap: 7px; margin: 6px 0; padding: 7px 11px;
  border-radius: 10px; border: 1px dashed rgba(251,191,36,0.35); background: rgba(251,191,36,0.06);
  font-size: 12px; color: #fbbf24;
}
.fallback-icon { flex-shrink: 0; }

.stream { display: flex; flex-direction: column; }
.stream .txt { margin: 2px 0; }
.media-block { margin: 6px 0; max-width: 340px; }
.media-block audio { width: 100%; height: 40px; border-radius: 10px; }
.media-img { max-width: 100%; border-radius: 14px; border: 1px solid var(--border); display: block; }
.media-cap { font-size: 11.5px; color: var(--sub-dim); margin-top: 5px; }
.media-file {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.03); text-decoration: none; color: var(--text);
  width: 100%; text-align: left; cursor: pointer; font: inherit;
}
.media-file .ic { color: var(--primary); }
.media-file .fname { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════ DOCK / COMPOSER ════════ */
.dock { flex-shrink: 0; padding: 8px 16px calc(12px + var(--safe-b)); position: relative; z-index: 15; }
.box {
  max-width: 760px; margin: 0 auto; display: grid;
  grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 8px;
  padding: 10px 12px 10px 14px; border-radius: 20px !important;
  /* fallback на случай если liquid.css почему-то не подключился —
     .glass уже даёт настоящее стекло поверх этого */
  background: rgba(20,14,40,0.62);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.tools { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin-bottom: 7px; position: relative; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; font-size: 12px; font-weight: 500;
  color: var(--sub); cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: rgba(168,85,247,0.45); background: rgba(168,85,247,0.15); color: var(--text); }
.chip.danger { color: var(--danger); border-color: rgba(239,68,68,0.35); }
.chip.danger:hover { background: rgba(239,68,68,0.1); }
.back-btn { margin-bottom: 4px; }

#input {
  grid-column: 1; border: none; outline: none; background: transparent; resize: none;
  min-height: 24px; max-height: 160px; padding: 6px 0; font-size: 14.5px; line-height: 1.45; color: var(--text);
}
#input::placeholder { color: var(--sub-dim); }
.send {
  grid-column: 2; grid-row: 2; align-self: flex-end; width: 36px; height: 36px;
  border: none; border-radius: 11px; background: var(--text); color: #0a0a0f;
  cursor: pointer; display: grid; place-items: center;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.send:disabled { opacity: 0.25; cursor: default; }
.send.stop, .send.gen-active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.55);
  animation: genPulse 1.4s ease-out infinite;
}
.gen-orb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
  display: block;
  animation: genOrb 0.9s ease-in-out infinite alternate;
}
@keyframes genPulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}
@keyframes genOrb {
  from { transform: scale(0.85); opacity: 0.75; }
  to { transform: scale(1.15); opacity: 1; }
}
.hint { max-width: 760px; margin: 8px auto 0; text-align: center; font-size: 10.5px; color: var(--sub-dim); }

/* ── plus button: rotates into an X when menu is open ── */
.plus-wrap { position: relative; }
.plus-btn { width: 30px; height: 30px; padding: 0; border-radius: 999px; display: grid; place-items: center; transition: transform 0.32s var(--spring, cubic-bezier(0.34,1.56,0.64,1)); }
.plus-btn[aria-expanded="true"] { transform: rotate(135deg); }
.plus-menu {
  position: absolute; bottom: calc(100% + 10px); left: 0; min-width: 190px;
  border-radius: 16px; padding: 6px; display: none; flex-direction: column; gap: 2px;
  z-index: 40;
}
.plus-menu.open { display: flex; }
.plus-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  border: none; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
.plus-item:hover { background: rgba(255,255,255,0.07); }
.plus-item .ic { color: var(--sub); }
.plus-item.locked { opacity: 0.45; cursor: not-allowed; }
.plus-item.locked:hover { background: transparent; }
.pill-pro { margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: 0.05em; color: #fbbf24; border: 1px solid rgba(251,191,36,0.35); border-radius: 5px; padding: 1px 5px; }

/* ════════ CANVAS PANE ════════ */
.canvas-pane {
  display: none; flex-direction: column; width: 48%; min-width: 320px;
  border-left: 1px solid var(--border); background: rgba(5,5,9,0.55);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.workspace.canvas-open .canvas-pane { display: flex; }
.canvas-top { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; gap: 8px; border-bottom: 1px solid var(--border); }
.canvas-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.canvas-tab { padding: 6px 12px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-size: 12px; color: var(--sub); cursor: pointer; white-space: nowrap; flex-shrink: 0; font-family: var(--mono); }
.canvas-tab.active { background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--text); }
.canvas-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.canvas-mode-btn { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border); background: transparent; font-size: 11px; color: var(--sub); cursor: pointer; }
.canvas-mode-btn.active { background: rgba(168,85,247,0.16); border-color: rgba(168,85,247,0.4); color: var(--text); }
.canvas-content { flex: 1; min-height: 0; position: relative; }
.canvas-code { margin: 0; height: 100%; overflow: auto; padding: 15px; font-size: 12.5px; line-height: 1.6; }
.canvas-code code { font-family: var(--mono); }
.canvas-frame { width: 100%; height: 100%; border: none; background: #fff; }

/* ════════ PAGES (models / files / settings) ════════ */
.page { flex: 1; overflow-y: auto; padding: 20px 20px 40px; max-width: 720px; margin: 0 auto; width: 100%; }
.page-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.page h2 { margin: 6px 0 4px; font-size: 21px; font-weight: 800; }
.muted { margin: 0 0 18px; color: var(--sub); font-size: 13.5px; }

.prov-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.prov-tab { flex-shrink: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; font-size: 12.5px; font-weight: 500; color: var(--sub); cursor: pointer; }
.prov-tab.on { border-color: rgba(168,85,247,0.45); background: rgba(168,85,247,0.15); color: var(--text); }
.prov-tab.limited { color: var(--sub-dim); border-style: dashed; }

.model-list { display: flex; flex-direction: column; gap: 8px; }
.mcard { display: flex; padding: 14px 16px; border-radius: 15px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); cursor: pointer; text-align: left; width: 100%; }
.mcard.on { border-color: var(--primary); background: rgba(168,85,247,0.1); }
.mcard.locked { opacity: 0.45; cursor: not-allowed; }
.mcard .nm { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.mcard .ds { font-size: 12px; color: var(--sub-dim); }
.model-meta { margin-top: 6px; color: var(--sub); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.01em; }
.badge { font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); color: var(--sub); }
.badge.pro { color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.badge.pwr { color: #60a5fa; border-color: rgba(96,165,250,0.35); }
.badge.tier { border-width: 1px; }
.badge.tier.red { color: #ff6b7a; border-color: rgba(255,107,122,0.42); background: rgba(255,107,122,0.08); }
.badge.tier.yellow { color: #f6c85f; border-color: rgba(246,200,95,0.44); background: rgba(246,200,95,0.08); }
.badge.tier.green { color: #59d38b; border-color: rgba(89,211,139,0.44); background: rgba(89,211,139,0.08); }
.badge.tier.crown { color: #d9a7ff; border-color: rgba(217,167,255,0.55); background: linear-gradient(135deg, rgba(217,167,255,0.14), rgba(255,213,110,0.1)); }
.mcard.tier-crown .model-meta { color: #d9a7ff; }
.mcard.tier-green .model-meta { color: #75dca0; }
.mcard.tier-yellow .model-meta { color: #e5c875; }
.mcard.tier-red .model-meta { color: #e78b97; }

.empty { padding: 26px; text-align: center; border: 1px dashed var(--border); border-radius: 14px; color: var(--sub); font-size: 13.5px; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.fcard { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.fcard .nm { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.factions { display: flex; gap: 6px; flex-shrink: 0; }

.settings-group { border-radius: 16px; padding: 4px 4px; margin-bottom: 14px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-label { font-size: 13.5px; font-weight: 600; }
.settings-hint { font-size: 11.5px; color: var(--sub-dim); margin-top: 2px; }
.switch { width: 42px; height: 25px; border-radius: 999px; border: none; background: rgba(255,255,255,0.12); position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform 0.22s var(--spring, cubic-bezier(0.34,1.56,0.64,1)); }
.switch.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); }
.switch.active span { transform: translateX(17px); }
.segmented { display: flex; border-radius: 10px; background: rgba(255,255,255,0.05); padding: 3px; gap: 2px; }
.segmented button { padding: 6px 12px; border: none; background: transparent; border-radius: 8px; font-size: 12px; color: var(--sub); cursor: pointer; }
.segmented button.active { background: rgba(255,255,255,0.1); color: var(--text); }

/* ════════ PREVIEW ════════ */
#view-preview { flex-direction: column; }
.preview-bar { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.preview-name { font-size: 12.5px; color: var(--sub); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { flex: 1; min-height: 0; position: relative; }
.preview-frame { width: 100%; height: 100%; border: none; background: #fff; }
.preview-code { margin: 0; height: 100%; overflow: auto; padding: 18px; font-size: 13px; line-height: 1.6; }
.preview-code code { font-family: var(--mono); }
.preview-media { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.preview-media img { max-width: 100%; max-height: 100%; border-radius: 14px; object-fit: contain; }
.preview-media audio { width: 100%; max-width: 420px; }

/* ── loading tip (composer disabled during initial load) ── */
.loading-tip {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(6px);
  background: rgba(20,14,40,0.92); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 12.5px; padding: 9px 16px; border-radius: 12px;
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); white-space: nowrap; max-width: 88vw; text-overflow: ellipsis; overflow: hidden;
}
.loading-tip.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ════════ RESPONSIVE ════════ */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
    border-radius: 0 20px 20px 0;
    will-change: transform;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile { display: grid; }
  .workspace.canvas-open #view-chat { display: none; }
  .canvas-pane { width: 100%; min-width: 0; border-left: none; }
  .msg-actions { opacity: 0.85; } /* на таче всегда чуть виднее */
}

/* density: compact */
body.density-compact .row { padding: 6px 18px; }
body.density-compact .txt { font-size: 13.5px; }

/* mesh toggle off — управляется через JS (setMeshEnabled), см. app.js */

/* burger: жёсткое закрытие на мобиле + плавность */
@media (max-width: 820px) {
  .sidebar:not(.open) {
    transform: translateX(-105%) !important;
    pointer-events: none !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }
  .backdrop { z-index: 40; }
  .backdrop.show { display: block !important; pointer-events: auto !important; }
  /* КРИТИЧНО: сайдбар должен быть НАД backdrop, иначе клики по кнопкам
     внутри открытого меню (чаты, "новый чат" и т.д.) попадают на сам
     backdrop и закрывают панель вместо того чтобы сработать по назначению —
     весь экран превращается в один большой триггер закрытия */
  .sidebar.open { z-index: 45; }
  body.sb-open { overflow: hidden; }
  body.sb-open .workspace { pointer-events: none; }
  body.sb-open .sidebar,
  body.sb-open .backdrop { pointer-events: auto !important; }
}

/* Unified production LiquidGlass: the mesh remains visible through every
   surface; /liquid.js supplies the SVG lens/refraction filter. */
:root {
  --glass-bg: transparent !important;
  --glass-bg-strong: transparent !important;
  --glass-bg-lite: transparent !important;
  --glass-border: transparent !important;
  --glass-border-hi: transparent !important;
  --glass-glow: none !important;
}

html,
body {
  background: var(--bg, #08080d) !important;
  background-color: #08080d !important;
  background-image: none !important;
  color: var(--text, #f1f5f9) !important;
}

#app,
.main,
.workspace,
.view,
.msgs,
.page,
.canvas-content {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
}

#mesh-bg {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  display: block;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none !important;
}

#app { position: relative; z-index: 1; }

.glass,
.glass-lite,
.glass-strong,
.glass-bar,
.glass-btn,
.glass-btn:hover,
.glass-btn.primary,
.glass-btn.primary:hover,
.sidebar,
.top,
.box,
.plus-menu,
.chat-row,
.chat-row:hover,
.chat-row.on,
.sug,
.sug:hover,
.msg-act,
.msg-act:hover,
.think-block,
.agent-actions,
.action-card,
.fallback-note,
.media-file,
.canvas-pane,
.canvas-top,
.canvas-tab,
.canvas-tab.active,
.canvas-mode-btn,
.canvas-mode-btn.active,
.page,
.prov-tab,
.prov-tab.on,
.mcard,
.mcard.on,
.fcard,
.empty,
.settings-group,
.segmented,
.preview-bar,
.loading-tip,
.sb-item,
.sb-item:hover,
.user-chip,
.backdrop.show,
.play-btn {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

input,
textarea,
select,
.box,
.box textarea,
.model-btn,
.chip,
.plus-item,
.canvas-mode-btn,
.settings-row,
.segmented button {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
}

.glass-btn.primary,
.play-btn,
.send,
.send.stop,
.send.gen-active {
  color: var(--text) !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

.glass-btn:hover,
.glass-btn.primary:hover,
.icon-only:hover,
.sb-item:hover,
.chat-row:hover,
.sug:hover,
.msg-act:hover,
.canvas-tab.active,
.canvas-mode-btn.active,
.mcard.on {
  background: rgba(255,255,255,.045) !important;
  background-image: none !important;
}

.txt pre,
.action-details pre,
.preview-code,
.preview-frame,
.canvas-code,
.canvas-frame {
  background-color: transparent !important;
}

/* Mobile/touch fallback matching GhostSound: matte frosted layers without
   the SVG displacement engine. The desktop LiquidGlass rules above remain
   unchanged and /liquid.js is conditionally loaded from index.html. */
html.ghogem-mobile-matte {
  --glass-bg: rgba(13,16,23,.44) !important;
  --glass-bg-strong: rgba(10,13,19,.58) !important;
  --glass-bg-lite: rgba(18,21,29,.32) !important;
  --glass-border: rgba(255,255,255,.09) !important;
  --glass-border-hi: rgba(255,255,255,.14) !important;
  --glass-glow: none !important;
  --glass-shadow: 0 10px 28px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.06) !important;
}

/* Kill inherited/nested blur first. Blur is restored only on actual panels,
   keeping text and menu contents crisp and reducing work on mobile GPUs. */
html.ghogem-mobile-matte *,
html.ghogem-mobile-matte *::before,
html.ghogem-mobile-matte *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.ghogem-mobile-matte .sidebar,
html.ghogem-mobile-matte .top,
html.ghogem-mobile-matte .box,
html.ghogem-mobile-matte .plus-menu,
html.ghogem-mobile-matte .canvas-pane,
html.ghogem-mobile-matte .canvas-top,
html.ghogem-mobile-matte .settings-group,
html.ghogem-mobile-matte .preview-bar,
html.ghogem-mobile-matte .loading-tip {
  background: rgba(8,11,17,.52) !important;
  background-color: rgba(8,11,17,.52) !important;
  background-image: linear-gradient(145deg,rgba(255,255,255,.055),rgba(255,255,255,.008) 44%,rgba(121,88,180,.025)) !important;
  border-color: rgba(255,255,255,.10) !important;
  box-shadow: var(--glass-shadow) !important;
  backdrop-filter: blur(9px) saturate(107%) !important;
  -webkit-backdrop-filter: blur(9px) saturate(107%) !important;
  filter: none !important;
}

html.ghogem-mobile-matte .sidebar {
  background: rgba(8,11,17,.72) !important;
  border-right: 1px solid rgba(255,255,255,.10) !important;
}

html.ghogem-mobile-matte .top {
  background: rgba(8,11,17,.42) !important;
  border-bottom: 1px solid rgba(255,255,255,.07) !important;
  box-shadow: 0 7px 22px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.045) !important;
  backdrop-filter: blur(8px) saturate(106%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(106%) !important;
}

html.ghogem-mobile-matte .box {
  background: rgba(9,12,18,.58) !important;
  border: 1px solid rgba(255,255,255,.11) !important;
}

html.ghogem-mobile-matte .glass,
html.ghogem-mobile-matte .glass-lite,
html.ghogem-mobile-matte .glass-strong,
html.ghogem-mobile-matte .glass-bar {
  border-color: rgba(255,255,255,.09) !important;
  filter: none !important;
}

html.ghogem-mobile-matte .sug,
html.ghogem-mobile-matte .think-block,
html.ghogem-mobile-matte .agent-actions,
html.ghogem-mobile-matte .action-card,
html.ghogem-mobile-matte .media-file,
html.ghogem-mobile-matte .mcard,
html.ghogem-mobile-matte .fcard,
html.ghogem-mobile-matte .empty,
html.ghogem-mobile-matte .segmented {
  background: rgba(15,18,25,.34) !important;
  background-color: rgba(15,18,25,.34) !important;
  background-image: linear-gradient(145deg,rgba(255,255,255,.035),rgba(255,255,255,.006)) !important;
  border-color: rgba(255,255,255,.085) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04) !important;
  backdrop-filter: blur(4px) saturate(104%) !important;
  -webkit-backdrop-filter: blur(4px) saturate(104%) !important;
  filter: none !important;
}

/* Rows and controls use tint instead of their own blur layer. */
html.ghogem-mobile-matte .glass-btn,
html.ghogem-mobile-matte .model-btn,
html.ghogem-mobile-matte .chip,
html.ghogem-mobile-matte .plus-item,
html.ghogem-mobile-matte .msg-act,
html.ghogem-mobile-matte .canvas-tab,
html.ghogem-mobile-matte .canvas-mode-btn,
html.ghogem-mobile-matte .prov-tab,
html.ghogem-mobile-matte .sb-item,
html.ghogem-mobile-matte .chat-row,
html.ghogem-mobile-matte .user-chip,
html.ghogem-mobile-matte .segmented button {
  background: rgba(255,255,255,.035) !important;
  background-image: none !important;
  border-color: rgba(255,255,255,.075) !important;
  box-shadow: none !important;
  filter: none !important;
}

html.ghogem-mobile-matte .glass-btn:hover,
html.ghogem-mobile-matte .model-btn:hover,
html.ghogem-mobile-matte .chip:hover,
html.ghogem-mobile-matte .plus-item:hover,
html.ghogem-mobile-matte .msg-act:hover,
html.ghogem-mobile-matte .canvas-tab.active,
html.ghogem-mobile-matte .canvas-mode-btn.active,
html.ghogem-mobile-matte .prov-tab.on,
html.ghogem-mobile-matte .sb-item:hover,
html.ghogem-mobile-matte .chat-row:hover,
html.ghogem-mobile-matte .user-chip:hover {
  background: rgba(255,255,255,.072) !important;
  border-color: rgba(255,255,255,.11) !important;
}

html.ghogem-mobile-matte .chat-row.on,
html.ghogem-mobile-matte .mcard.on,
html.ghogem-mobile-matte .chip[aria-pressed="true"] {
  background: rgba(148,103,235,.13) !important;
  border-color: rgba(184,146,255,.23) !important;
  box-shadow: inset 2px 0 #b892ff !important;
}

html.ghogem-mobile-matte input,
html.ghogem-mobile-matte textarea,
html.ghogem-mobile-matte select,
html.ghogem-mobile-matte .box textarea {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
}

html.ghogem-mobile-matte .glass-btn.primary,
html.ghogem-mobile-matte .send,
html.ghogem-mobile-matte .send.stop,
html.ghogem-mobile-matte .send.gen-active {
  color: #fff !important;
  background: linear-gradient(135deg,#a66df2,#7459e8) !important;
  background-color: #7459e8 !important;
  box-shadow: 0 5px 14px rgba(91,57,169,.25) !important;
}

html.ghogem-mobile-matte .backdrop.show {
  background: rgba(1,3,7,.38) !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: blur(3px) !important;
  -webkit-backdrop-filter: blur(3px) !important;
}

html.ghogem-mobile-matte .sidebar > *,
html.ghogem-mobile-matte .top > *,
html.ghogem-mobile-matte .box > *,
html.ghogem-mobile-matte .plus-menu > * {
  filter: none !important;
}

@media (max-width: 820px) {
  html.ghogem-mobile-matte .sidebar {
    transition: transform .22s cubic-bezier(.2,.8,.2,1) !important;
  }

  html.ghogem-mobile-matte .top {
    height: 52px;
    padding-inline: 10px;
  }

  html.ghogem-mobile-matte .dock {
    padding-inline: 10px;
  }

  html.ghogem-mobile-matte .box {
    border-radius: 17px !important;
    padding: 9px 10px 9px 12px;
  }

  html.ghogem-mobile-matte .row {
    padding-inline: 11px;
  }

  html.ghogem-mobile-matte .page {
    padding-inline: 12px;
  }

  html.ghogem-mobile-matte button:active:not(:disabled),
  html.ghogem-mobile-matte a:active,
  html.ghogem-mobile-matte [role="button"]:active,
  html.ghogem-mobile-matte .sug:active,
  html.ghogem-mobile-matte .mcard:active,
  html.ghogem-mobile-matte .fcard:active {
    transform: scale(.975);
  }
}

@media (max-width: 560px) {
  html.ghogem-mobile-matte .sidebar,
  html.ghogem-mobile-matte .box,
  html.ghogem-mobile-matte .plus-menu,
  html.ghogem-mobile-matte .settings-group,
  html.ghogem-mobile-matte .preview-bar {
    backdrop-filter: blur(8px) saturate(105%) !important;
    -webkit-backdrop-filter: blur(8px) saturate(105%) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.ghogem-mobile-matte *,
  html.ghogem-mobile-matte *::before,
  html.ghogem-mobile-matte *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ═══════════════ Bot ↔ Web parity ═══════════════ */
.sb-foot {
  max-height: 58vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.chat-row { position: relative; padding: 0; overflow: visible; }
.chat-open {
  min-width: 0; flex: 1; border: 0; background: transparent; color: inherit;
  text-align: left; padding: 10px 8px 10px 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-more {
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent;
  color: var(--sub); cursor: pointer; flex: 0 0 auto;
}
.chat-more:hover { background: rgba(255,255,255,.06); color: var(--text); }
.chat-inline-actions {
  display: none; position: absolute; right: 4px; top: calc(100% - 2px); z-index: 50;
  min-width: 130px; padding: 5px; border: 1px solid var(--border);
  border-radius: 12px; background: rgba(15,15,23,.98); box-shadow: 0 14px 38px rgba(0,0,0,.38);
}
.chat-row.actions-open .chat-inline-actions { display: grid; }
.chat-inline-actions button {
  border: 0; background: transparent; color: var(--text); text-align: left;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 12px;
}
.chat-inline-actions button:hover { background: rgba(255,255,255,.06); }

.parity-page { max-width: 860px; padding-bottom: 72px; }
.parity-list { display: grid; gap: 10px; margin-top: 14px; }
.parity-card {
  border: 1px solid var(--border); border-radius: 18px; padding: 15px;
  background: rgba(255,255,255,.025);
}
.parity-card-title { font-weight: 800; margin-bottom: 12px; font-size: 14px; }
.parity-card-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.parity-card-main b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parity-card-main span, .parity-muted { color: var(--sub-dim); font-size: 11px; }
.archive-card, .key-card, .storage-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.parity-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.parity-actions button, .model-fav, .model-default {
  border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.035);
  color: var(--text); padding: 7px 10px; font-size: 11px; cursor: pointer;
}
.parity-actions button:hover, .model-fav:hover, .model-default:hover { background: rgba(255,255,255,.075); }
.danger-mini { color: #fca5a5 !important; border-color: rgba(239,68,68,.24) !important; }
.primary-action {
  border: 0; border-radius: 12px; padding: 10px 15px; cursor: pointer;
  background: linear-gradient(135deg,var(--primary),var(--primary2)); color: #fff; font-weight: 750;
}
.parity-input {
  width: 100%; min-height: 40px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,.025); color: var(--text); outline: 0; padding: 9px 11px;
}
.parity-input:focus { border-color: rgba(168,85,247,.5); box-shadow: 0 0 0 3px rgba(168,85,247,.08); }
.parity-textarea { min-height: 86px; resize: vertical; line-height: 1.45; }
.compact-input { width: min(330px,52vw); }
.settings-column { align-items: stretch !important; flex-direction: column; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.form-note { color: var(--sub); font-size: 11px; min-height: 16px; margin-top: 8px; }
.form-grid {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 10px 0;
}
.form-grid label { display: grid; gap: 6px; color: var(--sub); font-size: 10px; }
.weekday-row { display: none; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.weekday-row.show { display: flex; }
.weekday-row button {
  width: 36px; height: 34px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,.025); color: var(--sub); cursor: pointer;
}
.weekday-row button.active { color: #fff; border-color: rgba(168,85,247,.5); background: rgba(168,85,247,.17); }

.reminder-create-card { margin-top: 14px; }
.reminder-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.reminder-head > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reminder-head b { font-size: 14px; }
.reminder-head span { color: var(--sub); font-size: 11px; }
.mode-pill {
  flex: 0 0 auto; border: 1px solid rgba(168,85,247,.25); color: #d8b4fe !important;
  background: rgba(168,85,247,.09); border-radius: 999px; padding: 4px 7px; font-size: 9px !important; font-weight: 800;
}
.reminder-instruction { margin: 11px 0; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.reminder-meta { color: var(--sub-dim); font-size: 10px; margin-bottom: 10px; }

.storage-summary-grid, .status-grid, .premium-grid {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 14px 0;
}
.storage-stat, .status-card, .premium-grid > div {
  min-height: 74px; border: 1px solid var(--border); border-radius: 15px;
  background: rgba(255,255,255,.025); padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.storage-stat b, .status-card b, .premium-grid b { font-size: 14px; }
.storage-stat span, .status-card span, .premium-grid span { color: var(--sub-dim); font-size: 10px; }
.storage-tabs { display: flex; gap: 6px; margin: 10px 0; overflow-x: auto; }
.storage-tabs button {
  border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,.025);
  color: var(--sub); padding: 7px 11px; cursor: pointer; font-size: 11px;
}
.storage-tabs button.active { background: rgba(168,85,247,.14); color: #fff; border-color: rgba(168,85,247,.4); }

.ref-tier { color: #d8b4fe; font-size: 12px; font-weight: 800; }
.ref-count { display: flex; align-items: baseline; gap: 7px; margin: 12px 0 9px; }
.ref-count b { font-size: 30px; line-height: 1; }
.ref-count span { color: var(--sub); font-size: 11px; }
.progress-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; margin: 10px 0; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--primary2),var(--primary)); }
.ref-link { margin: 13px 0 10px; padding: 10px; border-radius: 11px; background: rgba(0,0,0,.15); color: var(--sub); font: 10px var(--mono); word-break: break-all; }

.premium-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.premium-head > div { display: flex; flex-direction: column; gap: 4px; }
.premium-head b { font-size: 18px; }
.premium-head span { color: var(--sub); font-size: 11px; }
.premium-crown { color: #d8b4fe !important; font-size: 28px !important; }
.premium-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.premium-actions { margin-top: 14px; }

.help-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.help-grid .parity-card { display: flex; flex-direction: column; gap: 7px; }
.help-grid b { font-size: 13px; }
.help-grid span { color: var(--sub); font-size: 11px; line-height: 1.5; }

.git-toolbar { display: flex; gap: 7px; flex-wrap: wrap; margin: 8px 0 10px; }
.git-output {
  max-height: 260px; overflow: auto; margin: 0 0 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: 13px; background: rgba(0,0,0,.25);
  color: #cbd5e1; font: 10.5px/1.5 var(--mono); white-space: pre-wrap;
}

.mcard { display: block; padding: 0; overflow: hidden; }
.mcard-main {
  width: 100%; border: 0; background: transparent; color: inherit; text-align: left;
  padding: 14px 16px; cursor: pointer;
}
.mcard-actions {
  display: flex; align-items: center; gap: 6px; padding: 0 12px 11px;
  border-top: 1px solid rgba(255,255,255,.045); padding-top: 9px;
}
.model-fav { width: 34px; color: #f5d76e; font-size: 14px; padding: 6px; }
.model-default { margin-left: auto; }
.badge.default {
  border: 1px solid rgba(168,85,247,.22); background: rgba(168,85,247,.09);
  color: #d8b4fe; padding: 2px 5px; border-radius: 999px; font-size: 8px;
}

.rating-panel {
  margin-top: 12px; padding: 11px; border: 1px solid var(--border); border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.rating-panel.required { border-color: rgba(168,85,247,.32); background: rgba(168,85,247,.065); }
.rating-title { font-size: 11px; font-weight: 700; margin-bottom: 8px; }
.rating-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.rating-buttons button {
  border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.03);
  color: var(--text); padding: 6px 8px; cursor: pointer; font-size: 10px;
}
.rating-buttons button:hover { border-color: rgba(245,215,110,.35); color: #f5d76e; }
.rating-model { margin-top: 7px; color: var(--sub-dim); font-size: 9px; }
.rating-done { color: #a7f3d0; font-size: 11px; }

@media (max-width: 720px) {
  .sb-foot { max-height: 62vh; }
  .parity-page { padding: 14px 12px 70px; }
  .form-grid, .storage-summary-grid, .status-grid { grid-template-columns: 1fr; }
  .premium-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .help-grid { grid-template-columns: 1fr; }
  .archive-card, .key-card, .storage-row { align-items: flex-start; flex-direction: column; }
  .parity-actions { width: 100%; }
  .compact-input { width: min(58vw,290px); }
}

.pending-rating-gate {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto 8px;
}
.pending-rating-gate .rating-panel { margin: 0; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.storage-summary-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
@media (max-width:720px) { .storage-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }


.choice-card {
  margin: 10px 0 4px; padding: 13px; border: 1px solid rgba(168,85,247,.28);
  border-radius: 16px; background: rgba(168,85,247,.055);
}
.choice-question { font-weight: 750; font-size: 12.5px; line-height: 1.45; margin-bottom: 10px; }
.choice-options { display: grid; gap: 7px; }
.choice-options button, .choice-custom-actions button {
  width: 100%; border: 1px solid var(--border); border-radius: 11px;
  background: rgba(255,255,255,.035); color: var(--text); padding: 9px 10px;
  cursor: pointer; text-align: left;
}
.choice-options button:hover { border-color: rgba(168,85,247,.42); background: rgba(168,85,247,.08); }
.choice-options button span { display: block; color: var(--sub-dim); font-size: 9px; margin-bottom: 3px; }
.choice-options button b { font-size: 11.5px; font-weight: 650; }
.choice-options .choice-custom { color: #d8b4fe; text-align: center; font-size: 11px; }
.choice-custom-box textarea {
  width: 100%; min-height: 70px; resize: vertical; border: 1px solid var(--border);
  border-radius: 11px; background: rgba(0,0,0,.16); color: var(--text); padding: 10px; outline: 0;
}
.choice-custom-actions { display: flex; gap: 7px; margin-top: 7px; }
.choice-custom-actions button { text-align: center; font-size: 10px; }
.choice-state { margin-top: 8px; color: var(--sub-dim); font-size: 9.5px; }
.choice-card.resolved { opacity: .82; }
.choice-card.resolved button { cursor: default; }


.reminder-proposal-card {
  margin: 10px 0 4px; padding: 13px; border: 1px solid rgba(168,85,247,.28);
  border-radius: 16px; background: rgba(168,85,247,.05);
}
.reminder-proposal-head { display: flex; gap: 9px; align-items: flex-start; }
.reminder-proposal-head > span { font-size: 18px; }
.reminder-proposal-head > div { display: flex; flex-direction: column; gap: 3px; }
.reminder-proposal-head b { font-size: 12.5px; }
.reminder-proposal-head small { color: var(--sub); font-size: 10px; }
.reminder-proposal-text { margin: 10px 0; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; }
.reminder-proposal-meta { color: var(--sub-dim); font-size: 9.5px; margin-bottom: 10px; }
.reminder-proposal-actions { display: flex; gap: 7px; }
.reminder-proposal-actions button {
  border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.035);
  color: var(--text); padding: 7px 10px; font-size: 10.5px; cursor: pointer;
}
.reminder-proposal-actions [data-confirm] { border-color: rgba(168,85,247,.35); background: rgba(168,85,247,.12); }
.reminder-proposal-state { margin-top: 8px; color: var(--sub-dim); font-size: 9.5px; }
.reminder-proposal-card.resolved { opacity: .85; }
.reminder-proposal-card.resolved.ok { border-color: rgba(52,211,153,.24); }
