/* zeroclaude — original design system */
:root {
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-sunken: #eef0f3;
  --sidebar: #eff1f4;
  --hover: rgba(20, 30, 50, 0.06);
  --active: rgba(20, 30, 50, 0.1);
  --border: #dfe3e8;
  --border-strong: #c7cdd5;
  --text: #1b1f24;
  --text-2: #4a525c;
  --text-3: #7a838e;
  --accent: #0e8f7e;
  --accent-hover: #0b7a6b;
  --accent-soft: rgba(14, 143, 126, 0.12);
  --accent-text: #ffffff;
  --danger: #d1403a;
  --danger-soft: rgba(209, 64, 58, 0.1);
  --warn: #b7791f;
  --user-bubble: #e6ebf1;
  --code-bg: #f3f5f8;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Source Serif Pro", Georgia, "Songti SC", "Noto Serif SC", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar-w: 272px;
  --content-w: 760px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101217;
  --bg-elev: #181b22;
  --bg-sunken: #0b0d11;
  --sidebar: #14161c;
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.1);
  --border: #2a2f39;
  --border-strong: #3a414d;
  --text: #e6e9ee;
  --text-2: #b0b7c2;
  --text-3: #808894;
  --accent: #2bb8a3;
  --accent-hover: #3fcab5;
  --accent-soft: rgba(43, 184, 163, 0.16);
  --accent-text: #06201c;
  --danger: #f0625c;
  --danger-soft: rgba(240, 98, 92, 0.14);
  --user-bubble: #232833;
  --code-bg: #0c0e12;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
:root[data-font="serif"] { --font: var(--font-serif); }
:root[data-font="mono"] { --font: var(--font-mono); }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow: hidden;
}
#app { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

.boot { height: 100%; display: grid; place-items: center; }
.boot-logo { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  font-weight: 500; font-size: 14px; transition: background 0.12s, border-color 0.12s, transform 0.05s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); transition: background 0.12s, color 0.12s; flex: none;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn:active:not(:disabled) { background: var(--active); }
.icon-btn:disabled { opacity: 0.4; }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 16px; height: 16px; }

.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border); background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; transition: border-color 0.12s, box-shadow 0.12s; outline: none;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.error-text { color: var(--danger); font-size: 13px; }

/* ---------- layout ---------- */
.layout { display: flex; height: 100%; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid transparent; position: relative; z-index: 5;
}
.topbar.bordered { border-bottom-color: var(--border); }
.topbar .spacer { flex: 1; }
.topbar-title {
  min-width: 0; max-width: 60%; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--radius-sm);
  border: 0; background: transparent; font-weight: 600; font-size: 14px;
}
.topbar-title:hover { background: var(--hover); }
.topbar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title input { font-weight: 600; font-size: 14px; border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; background: var(--bg-elev); outline: none; width: min(420px, 60vw); }
.crumb { color: var(--text-3); font-size: 14px; text-decoration: none; padding: 4px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.crumb:hover { background: var(--hover); color: var(--text); }
.mobile-only { display: none !important; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: margin-left 0.2s ease, transform 0.2s ease; z-index: 30;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }
.sb-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 14px; height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand-mark { width: 24px; height: 24px; flex: none; }
.brand b { color: var(--accent); font-weight: 700; }
.sb-head .spacer { flex: 1; }
.sb-actions { padding: 4px 8px; display: grid; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); text-decoration: none; font-size: 14px; text-align: left;
}
.sb-item:hover { background: var(--hover); color: var(--text); }
.sb-item.active { background: var(--active); color: var(--text); }
.sb-item svg { width: 18px; height: 18px; flex: none; }
.sb-item .kbd { margin-left: auto; }
.sb-new { color: var(--accent); font-weight: 600; }
.sb-new .plus { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
.sb-new .plus svg { width: 14px; height: 14px; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 12px; overscroll-behavior: contain; }
.sb-group { margin-top: 12px; }
.sb-group-title { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 10px; position: sticky; top: -6px; background: var(--sidebar); z-index: 1; }
.conv-item {
  position: relative; display: flex; align-items: center; height: 34px; border-radius: var(--radius-sm); color: var(--text-2);
}
.conv-item a { flex: 1; min-width: 0; padding: 0 10px; height: 100%; display: flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; font-size: 14px; }
.conv-item a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item:hover { background: var(--hover); color: var(--text); }
.conv-item.active { background: var(--active); color: var(--text); }
.conv-item .more { opacity: 0; margin-right: 2px; }
.conv-item:hover .more, .conv-item.active .more, .conv-item .more:focus-visible, .conv-item .more.open { opacity: 1; }
.conv-item input { flex: 1; margin: 0 4px; height: 28px; border: 1px solid var(--accent); border-radius: 6px; padding: 0 8px; background: var(--bg-elev); outline: none; font-size: 14px; min-width: 0; }
.conv-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.sb-foot { border-top: 1px solid var(--border); padding: 8px; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: var(--radius-sm); border: 0; background: transparent; text-align: left; }
.user-btn:hover, .user-btn.open { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; text-transform: uppercase; }
.user-btn .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-btn .who b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { font-size: 12px; color: var(--text-3); }
.scrim { display: none; }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--hover) 25%, var(--active) 37%, var(--hover) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel-line { height: 14px; margin: 10px; }

/* ---------- menus / popovers ---------- */
.menu {
  position: fixed; z-index: 200; min-width: 200px; max-width: 320px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; animation: pop 0.12s ease-out;
  max-height: 70vh; overflow-y: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 0;
  background: transparent; text-align: left; font-size: 14px; color: var(--text);
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:disabled { opacity: 0.45; }
.menu-item svg { width: 16px; height: 16px; color: var(--text-2); flex: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-item .desc { display: block; font-size: 12px; color: var(--text-3); }
.menu-item .check { margin-left: auto; color: var(--accent); }
.menu-item .grow { flex: 1; min-width: 0; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-label { font-size: 12px; color: var(--text-3); padding: 6px 10px 2px; font-weight: 600; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 300; background: rgba(8, 12, 18, 0.45); display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg-elev); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 22px; animation: pop 0.15s ease-out; border: 1px solid var(--border);
}
.modal.wide { width: min(640px, 100%); }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 0 0 16px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* command palette */
.palette { width: min(600px, 100%); padding: 0; overflow: hidden; align-self: start; margin-top: 12vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input svg { width: 18px; height: 18px; color: var(--text-3); }
.palette-input input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.palette-item.sel { background: var(--hover); }
.palette-item svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.palette-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item small { color: var(--text-3); }

.kbd { display: inline-flex; gap: 3px; font-size: 11px; color: var(--text-3); }
.kbd kbd { font-family: var(--font-mono); min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-elev); }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: calc(20px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 400; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn 0.2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { background: transparent; border: 0; color: inherit; font-weight: 600; text-decoration: underline; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- composer ---------- */
.composer-wrap { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 0 16px; }
.composer {
  position: relative; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--border-strong); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.composer.drag { border-color: var(--accent); border-style: dashed; }
.composer textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 14px 16px 4px;
  font-size: 16px; line-height: 1.5; max-height: 40vh; min-height: 28px; overflow-y: auto;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; }
.composer-bar .spacer { flex: 1; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px; border: 0; background: transparent; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); max-width: 46vw; }
.model-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-btn:hover { background: var(--hover); color: var(--text); }
.model-btn svg { width: 14px; height: 14px; }
.send-btn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; transition: background 0.12s, opacity 0.12s, transform 0.05s; }
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:active:not(:disabled) { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.35; }
.send-btn svg { width: 18px; height: 18px; }
.send-btn.stop { background: var(--text); color: var(--bg); }
.chip-tog { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.chip-tog svg { width: 14px; height: 14px; }
.attachments { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; }
.att {
  position: relative; flex: none; width: 120px; height: 84px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-sunken); padding: 8px; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; overflow: hidden;
}
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.att .meta { color: var(--text-3); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
.att .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; opacity: 0; transition: opacity 0.12s; z-index: 2; }
.att:hover .x, .att .x:focus-visible { opacity: 1; }
.att .x svg { width: 12px; height: 12px; }
.att.uploading::after { content: ""; position: absolute; inset: 0; background: var(--bg-elev); opacity: 0.6; }
.att .spin { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; z-index: 3; }
.att.err { border-color: var(--danger); }
.composer-note { text-align: center; color: var(--text-3); font-size: 12px; padding: 8px 0 calc(10px + var(--safe-b)); }

/* ---------- new chat / home ---------- */
.home { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 0 10vh; }
.greet { display: flex; align-items: center; gap: 12px; font-size: clamp(26px, 4vw, 38px); font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; margin: 0 16px 28px; text-align: center; }
.greet .brand-mark { width: 34px; height: 34px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; padding: 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); font-size: 13px; color: var(--text-2); }
.chip:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.chip svg { width: 15px; height: 15px; }

/* ---------- chat ---------- */
.chat-scroll { flex: 1; overflow-y: auto; overflow-anchor: none; scroll-behavior: auto; }
.thread { max-width: var(--content-w); margin: 0 auto; padding: 16px 16px 24px; }
.msg { margin: 18px 0; position: relative; }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.bubble { background: var(--user-bubble); border-radius: 18px; padding: 10px 16px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-user .att-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; max-width: 85%; }
.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 4px; min-height: 32px; opacity: 0; transition: opacity 0.12s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.last .msg-actions { opacity: 1; }
.msg-actions .ts { font-size: 12px; color: var(--text-3); margin: 0 6px; }
.branch { display: inline-flex; align-items: center; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.edit-box { width: min(100%, 680px); background: var(--bg-elev); border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px; box-shadow: 0 0 0 3px var(--accent-soft); }
.edit-box textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; font-size: 15px; line-height: 1.5; max-height: 50vh; }
.edit-box .row { display: flex; justify-content: flex-end; gap: 8px; }
.msg-asst .who { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg-asst .who .brand-mark { width: 22px; height: 22px; }
.msg-asst .who .brand-mark.busy { animation: spin 1.6s linear infinite; }
.loading-dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.loading-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s infinite ease-in-out; }
.loading-dots i:nth-child(2) { animation-delay: 0.15s; } .loading-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.msg-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-top: 6px; }
.msg-error { margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.msg-error .grow { flex: 1; min-width: 160px; }
.thinking { margin: 4px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-sunken); }
.thinking summary { cursor: pointer; padding: 8px 12px; font-size: 13px; color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary svg { width: 14px; height: 14px; transition: transform 0.15s; }
.thinking[open] summary svg { transform: rotate(90deg); }
.thinking .body { padding: 0 12px 10px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; max-height: 320px; overflow-y: auto; }
.to-bottom {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 100%; margin-bottom: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text-2); z-index: 4; animation: fade 0.15s;
}
.to-bottom:hover { color: var(--text); background: var(--bg-sunken); }
.to-bottom svg { width: 18px; height: 18px; }
.chat-foot { position: relative; flex: none; }
.context-warn { max-width: var(--content-w); margin: 0 auto 8px; padding: 0 16px; }
.context-warn div { font-size: 13px; color: var(--warn); background: rgba(183, 121, 31, 0.1); border-radius: var(--radius-sm); padding: 8px 12px; }

/* markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.8em; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 1.3em 0 0.5em; font-weight: 650; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.28em; } .md h3 { font-size: 1.12em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.5em; margin: 0 0 0.8em; }
.md li { margin: 0.25em 0; }
.md li > p { margin: 0.2em 0; }
.md blockquote { margin: 0 0 0.8em; padding: 2px 14px; border-left: 3px solid var(--accent); color: var(--text-2); }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.md code { font-family: var(--font-mono); font-size: 0.88em; background: var(--code-bg); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.md pre code { border: 0; padding: 0; background: none; font-size: 13px; }
.md table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--bg-sunken); font-weight: 600; white-space: nowrap; }
.md img { max-width: 100%; border-radius: var(--radius-sm); }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.code-block { margin: 0 0 1em; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--bg-sunken); font-family: var(--font-mono); }
.code-head .lang { flex: 1; }
.code-head button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--text-2); padding: 4px 8px; border-radius: 6px; font-size: 12px; font-family: var(--font); }
.code-head button:hover { background: var(--hover); color: var(--text); }
.code-head button svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; line-height: 1.5; }
.code-block .hljs { background: transparent; padding: 0; }
.md.cursor-wrap > :last-child:not(.code-block)::after, .md.cursor-wrap:empty::after { content: ""; display: inline-block; width: 8px; height: 1em; vertical-align: -2px; margin-left: 2px; background: var(--accent); border-radius: 2px; animation: pulse 0.9s infinite; }

/* artifact panel */
.artifact-panel { width: min(46vw, 720px); flex: none; border-left: 1px solid var(--border); background: var(--bg-elev); display: flex; flex-direction: column; animation: slideIn 0.2s ease-out; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.ap-head { height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--border); }
.ap-head .title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.ap-body { flex: 1; overflow: auto; }
.ap-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.ap-body pre { margin: 0; padding: 14px; font-size: 13px; }
.art-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); margin: 0 0 1em; cursor: pointer; width: 100%; text-align: left; }
.art-card:hover { border-color: var(--border-strong); background: var(--bg-sunken); }
.art-card .ic { width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.art-card .ic svg { width: 18px; height: 18px; }
.art-card b { display: block; font-size: 14px; }
.art-card small { color: var(--text-3); }

/* ---------- pages ---------- */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 880px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; flex: 1; font-family: var(--font-serif); font-weight: 500; }
.search { position: relative; margin-bottom: 14px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search .input { padding-left: 36px; height: 42px; font-size: 15px; }
.list-toolbar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-3); margin-bottom: 8px; min-height: 32px; flex-wrap: wrap; }
.list-toolbar .spacer { flex: 1; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--radius); border: 1px solid transparent; border-top-color: var(--border); text-decoration: none; color: var(--text); cursor: pointer; }
.row-item:hover { background: var(--hover); border-color: transparent; }
.row-item.sel { background: var(--accent-soft); }
.row-item + .row-item:hover, .row-item:hover + .row-item { border-top-color: transparent; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item b { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item small { color: var(--text-3); font-size: 13px; }
.row-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.empty { text-align: center; color: var(--text-3); padding: 48px 16px; display: grid; justify-items: center; gap: 10px; }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); }
.empty b { color: var(--text-2); font-size: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); padding: 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; min-height: 130px; transition: border-color 0.12s, box-shadow 0.12s; position: relative; }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card b { font-size: 15px; }
.card p { margin: 0; color: var(--text-2); font-size: 13px; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card small { color: var(--text-3); font-size: 12px; }
.card .star { position: absolute; top: 10px; right: 10px; }
.proj-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); padding: 14px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.panel .muted { color: var(--text-3); font-size: 13px; white-space: pre-wrap; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-top: 1px solid var(--border); }
.file-row:first-of-type { border-top: 0; }
.file-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.setting-row .lbl b { display: block; font-size: 14px; }
.setting-row .lbl small { color: var(--text-3); font-size: 13px; }
.theme-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 120px)); gap: 10px; }
.theme-opt { border: 2px solid var(--border); border-radius: var(--radius); padding: 0; background: transparent; overflow: hidden; text-align: left; font-size: 13px; }
.theme-opt:hover { border-color: var(--border-strong); }
.theme-opt.on { border-color: var(--accent); }
.theme-opt .pv { height: 60px; display: flex; gap: 4px; padding: 8px; }
.theme-opt .pv i { flex: 1; border-radius: 4px; }
.theme-opt span { display: block; padding: 6px 8px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; background: var(--bg-elev); }
.plan.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan h3 { margin: 0; } .plan .price { font-size: 28px; font-weight: 700; margin: 8px 0; }
.plan ul { padding-left: 18px; color: var(--text-2); font-size: 14px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; }

/* auth */
.auth { min-height: 100%; height: 100dvh; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #0e8f7e 0%, #0b5f6b 55%, #183049 100%); color: #eafaf6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-family: var(--font-serif); font-weight: 500; font-size: 38px; line-height: 1.2; margin: 0 0 16px; max-width: 440px; }
.auth-side p { opacity: 0.85; max-width: 420px; }
.auth-side .brand { color: #fff; } .auth-side .brand b { color: #9ff3e2; }
.auth-feats { display: grid; gap: 12px; margin-top: 24px; }
.auth-feats div { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.auth-feats svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(380px, 100%); }
.auth-card h1 { font-family: var(--font-serif); font-weight: 500; font-size: 30px; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 24px; }
.auth-card .switch { margin-top: 18px; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-card .switch a { font-weight: 600; }
.pw-wrap { position: relative; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.auth-brand { display: none; margin-bottom: 24px; }
.auth-top { position: absolute; top: 16px; right: 16px; display: flex; gap: 4px; }

/* share */
.share-banner { background: var(--accent-soft); color: var(--text); padding: 10px 16px; font-size: 14px; display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .proj-grid { grid-template-columns: 1fr; }
  .artifact-panel { position: fixed; inset: 0; width: 100%; z-index: 60; }
}
@media (max-width: 768px) {
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; margin-left: 0 !important; transform: translateX(-100%); box-shadow: var(--shadow-lg); width: min(var(--sidebar-w), 86vw); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 12, 18, 0.45); z-index: 25; animation: fade 0.15s; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-brand { display: block; }
  .bubble { max-width: 92%; }
  .msg-actions { opacity: 1; }
  .conv-item .more { opacity: 1; }
  .composer-wrap { padding: 0 10px; }
  .thread { padding: 8px 14px 20px; }
  .page-inner { padding: 16px 16px 48px; }
  .page-head h1 { font-size: 22px; }
  .topbar-title { max-width: calc(100vw - 140px); }
  .att .x { opacity: 1; }
}

.thinking-now { margin-top: 0; gap: 8px; }
.thinking-now .loading-dots { padding: 0; }
.elapsed { font-variant-numeric: tabular-nums; color: var(--text-3); }
a.btn { text-decoration: none; }
@media (pointer: coarse) { .sb-item .kbd, .menu-item .kbd { display: none; } }
@media (max-width: 768px) { .tabs { scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); } .sidebar { transition: transform 0.2s ease, visibility 0.2s; } .sidebar:not(.open) { box-shadow: none; visibility: hidden; } }

/* ---------- v2 layout: sidebar ---------- */
.sb-wordmark { font-family: var(--font-serif); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; color: var(--text); text-decoration: none; padding: 0 4px; white-space: nowrap; }
.sb-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--bg-sunken); }
.sb-modes .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.sb-modes .icon-btn svg { width: 16px; height: 16px; }
.icon-btn.on-soft { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
a.icon-btn { text-decoration: none; display: inline-grid; place-items: center; }
.sb-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item .kbd { opacity: 0; transition: opacity 0.12s; }
.sb-item:hover .kbd { opacity: 1; }
.sb-item .badge { font-size: 10px; padding: 1px 6px; }
.sb-group-title { display: flex; align-items: center; gap: 4px; width: 100%; border: 0; text-align: left; cursor: pointer; }
.sb-group-title:hover { color: var(--text-2); }
.sb-group-title svg { opacity: 0; transition: opacity 0.12s; }
.sb-group:hover .sb-group-title svg, .sb-group-title:focus-visible svg { opacity: 1; }
.sb-group .conv-item a svg { width: 16px; height: 16px; color: var(--text-3); }
.sb-empty { font-size: 13px; color: var(--text-3); padding: 6px 10px; line-height: 1.45; }
.sb-all { display: block; font-size: 13px; color: var(--text-3); padding: 6px 10px; text-decoration: none; border-radius: var(--radius-sm); }
.sb-all:hover { background: var(--hover); color: var(--text); }
.sb-foot { display: flex; align-items: center; gap: 4px; }
.sb-foot .user-btn { flex: 1; min-width: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.user-btn .who { display: flex; align-items: baseline; min-width: 0; white-space: nowrap; overflow: hidden; }
.user-btn .who b { display: inline; flex: 0 1 auto; }
.user-btn .plan-tag { font-size: 12px; color: var(--text-3); flex: none; }

/* ---------- v2 layout: composer ---------- */
.mic-group { display: inline-flex; align-items: center; border-radius: var(--radius-sm); }
.mic-group .icon-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mic-group .caret { width: 20px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.mic-group .caret svg { width: 12px; height: 12px; }
.icon-btn.rec { color: #d64545; background: rgba(214, 69, 69, 0.12); animation: pulse 1.2s ease-in-out infinite; }
.model-btn .muted, .sel-btn .muted { color: var(--text-3); }
.voice-btn { width: 32px; height: 32px; border-radius: 10px; background: var(--bg-sunken); }

/* ---------- v2 layout: home ---------- */
.home { justify-content: flex-start; padding: 0 0 48px; }
.home-main { width: 100%; display: flex; flex-direction: column; align-items: center; margin-top: max(12vh, 64px); }
.home .composer-wrap { max-width: 680px; }
.under-composer { display: flex; align-items: center; gap: 4px; padding: 8px 2px 0; flex-wrap: wrap; }
.under-composer .spacer { flex: 1; }
.sel-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); max-width: 60vw; }
.sel-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn:hover, .sel-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.sel-btn svg { width: 15px; height: 15px; flex: none; }
.sel-btn.bordered { border: 1px solid var(--border); background: var(--bg-elev); }
.incog-note { color: var(--text-3); font-size: 14px; margin: -14px 16px 20px; text-align: center; max-width: 520px; }
.home.incognito .composer { border-style: dashed; }
.home.incognito .greet { font-size: clamp(22px, 3vw, 30px); }

/* ---------- recent artifacts ---------- */
.recent-art { width: 100%; max-width: 680px; padding: 0 16px; margin-top: 40px; }
.ra-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.ra-head a { font-size: 13px; color: var(--text-3); text-decoration: none; }
.ra-head a:hover { color: var(--text); }
.ra-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.art-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ra-card { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 0; background: transparent; padding: 0; color: var(--text); min-width: 0; }
.ra-open { border: 0; padding: 0; background: transparent; display: block; width: 100%; }
.ra-card b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.ra-card small { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.ra-meta { display: flex; flex-direction: column; min-width: 0; }
.ra-from { font-size: 12px; color: var(--text-3); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ra-from:hover { color: var(--text); text-decoration: underline; }
.thumb { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; transition: border-color 0.12s, box-shadow 0.12s; }
.ra-card:hover .thumb, .ra-open:focus-visible .thumb { border-color: var(--border-strong); box-shadow: var(--shadow); }
.thumb iframe { position: absolute; top: 0; left: 0; width: 400%; height: 400%; border: 0; transform: scale(0.25); transform-origin: 0 0; pointer-events: none; }
.thumb.code { background: var(--bg-sunken); }
.thumb.code pre { margin: 0; padding: 10px; font-family: var(--font-mono); font-size: 9px; line-height: 1.4; color: var(--text-2); white-space: pre; overflow: hidden; height: 100%; }
@media (max-width: 560px) { .ra-grid:not(.art-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ra-grid:not(.art-grid) > :nth-child(3) { display: none; } }

/* ---------- v2 pages ---------- */
.page-inner.wide { max-width: 1080px; }
.page-sub { color: var(--text-2); margin: -8px 0 18px; }
.page-head h1 + .spacer { display: none; }
.search-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); margin-bottom: 18px; color: var(--text-3); }
.search-field input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; color: var(--text); }
.sec-title { font-size: 14px; color: var(--text-2); font-weight: 600; margin: 24px 0 10px; }
.design-start { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.design-start .textarea { width: 100%; }
.split-page { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.side-tabs { display: flex; flex-direction: column; gap: 2px; }
.side-tabs a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-size: 14px; }
.side-tabs a:hover { background: var(--hover); color: var(--text); }
.side-tabs a.on { background: var(--active); color: var(--text); font-weight: 500; }
.split-body { min-width: 0; }
.split-body > .page-sub { margin-top: 0; }
.opt-list, .apps-list { display: grid; gap: 8px; margin-bottom: 16px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); text-align: left; color: var(--text); width: 100%; }
button.opt:hover { border-color: var(--border-strong); }
.opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.opt b { font-size: 14px; font-weight: 600; }
.opt span:not(.badge):not(.spacer) { color: var(--text-3); font-size: 13px; }
.opt > div { display: flex; flex-direction: column; gap: 2px; }
.opt .spacer { flex: 1; }
.opt svg { width: 18px; height: 18px; flex: none; color: var(--text-2); }
.opt.on > svg:last-child { color: var(--accent); margin-left: auto; }
.detect-box { border: 1px solid var(--border); border-radius: var(--radius-lg, 16px); background: var(--bg-elev); padding: 8px; margin-bottom: 16px; }
.detect-box .textarea { border: 0; box-shadow: none; width: 100%; resize: vertical; background: transparent; }
.detect-bar { display: flex; align-items: center; gap: 8px; padding: 4px 6px; }
.detect-bar .spacer { flex: 1; }
.meter { height: 8px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 720px) { .split-page { grid-template-columns: 1fr; gap: 12px; } .side-tabs { flex-direction: row; overflow-x: auto; } .side-tabs a { white-space: nowrap; } }
/* v2 tuning after side-by-side with reference 01-home */
.home-main { margin-top: max(26vh, 80px); }
.home .composer textarea { min-height: 56px; padding-top: 16px; }
.user-btn .who { flex: 0 1 auto; }
.sb-foot .user-btn { justify-content: flex-start; }
.sb-group-title { width: auto; }
.sb-group-title svg { opacity: 1; }
.ra-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); padding: 6px 6px 10px; transition: border-color 0.12s, box-shadow 0.12s; }
.ra-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ra-card .thumb { border-radius: calc(var(--radius) - 4px); aspect-ratio: 16 / 7; }
.ra-card:hover .thumb { box-shadow: none; }
.ra-card b, .ra-card small, .ra-meta, .ra-from { padding: 0 6px; }
.ra-meta b, .ra-meta small { padding: 0; }
.ra-card b { font-size: 14px; }
/* review round: taller home composer, subtle focus */
.home .composer textarea { min-height: 84px; }
.composer:focus-within { box-shadow: var(--shadow); border-color: var(--border-strong); }

/* artifact card in messages (long code / html / svg open in the side panel) */
.code-block.art-card { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); overflow: hidden; max-width: 420px; margin: 12px 0; }
.art-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent; text-align: left; color: var(--text); cursor: pointer; }
.art-open:hover { background: var(--hover); }
.art-ic { width: 40px; height: 40px; border-radius: 8px; background: var(--bg-sunken); display: grid; place-items: center; flex: none; color: var(--text-2); }
.art-ic svg { width: 20px; height: 20px; }
.art-txt { display: flex; flex-direction: column; min-width: 0; }
.art-txt b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-txt small { font-size: 12px; color: var(--text-3); }
.art-copy { border: 0; border-left: 1px solid var(--border); background: transparent; padding: 0 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.art-copy:hover { background: var(--hover); color: var(--text); }
.art-copy svg { width: 14px; height: 14px; }
.art-copy span { display: none; }

/* settings v2 */
.set-h { font-size: 16px; font-weight: 600; margin: 4px 0 14px; }
.set-h:not(:first-child) { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.with-avatar { display: flex; align-items: center; gap: 8px; }
.with-avatar .input { flex: 1; }
.pick-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.pick-card { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; padding: 0; font-size: 13px; color: var(--text-2); }
.pick-card > :first-child { border: 2px solid var(--border); border-radius: 10px; transition: border-color 0.12s; }
.pick-card:hover > :first-child { border-color: var(--border-strong); }
.pick-card.on > :first-child { border-color: var(--accent); }
.pick-card.on { color: var(--text); font-weight: 600; }
.mini-ui { width: 128px; height: 80px; display: flex; overflow: hidden; background: #f6f7f9; }
.mini-ui .sb { width: 32px; background: #e6ebf1; }
.mini-ui > div { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 5px; }
.mini-ui .l1, .mini-ui .l2 { height: 5px; border-radius: 3px; background: #cfd6df; }
.mini-ui .l2 { width: 60%; }
.mini-ui .box { margin-top: auto; height: 16px; border-radius: 5px; background: #fff; border: 1px solid #d5dbe3; }
.mini-ui.dark { background: #101217; }
.mini-ui.dark .sb { background: #181b22; }
.mini-ui.dark .l1, .mini-ui.dark .l2 { background: #2c323d; }
.mini-ui.dark .box { background: #232833; border-color: #333a46; }
.mini-ui.system { background: linear-gradient(90deg, #f6f7f9 50%, #101217 50%); }
.mini-ui.system .sb { background: #e6ebf1; }
.mini-ui.system .box { background: linear-gradient(90deg, #fff 50%, #232833 50%); }
.aa { width: 96px; height: 64px; display: grid; place-items: center; font-size: 24px; background: var(--bg-elev); color: var(--text); }
.aa.f-serif { font-family: var(--font-serif); }
.aa.f-mono { font-family: var(--font-mono); }
.toggle-sw { width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--border-strong); position: relative; flex: none; transition: background 0.15s; padding: 0; }
.toggle-sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.15s; }
.toggle-sw.on { background: var(--accent); }
.toggle-sw.on i { transform: translateX(16px); }
.modal.wide { max-width: 680px; width: calc(100vw - 32px); }
.modal-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.modal-title h2 { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl td a { color: var(--text); }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } .tbl th:nth-child(2), .tbl td:nth-child(2) { display: none; } }

/* collapsed sidebar = icon rail */
@media (min-width: 769px) {
  .sidebar { transition: width 0.18s ease; overflow: hidden; }
  .sidebar.collapsed { margin-left: 0; width: 56px; }
  .sidebar.collapsed .sb-head { padding: 10px 0 6px; justify-content: center; }
  .sidebar.collapsed .sb-wordmark, .sidebar.collapsed .sb-modes, .sidebar.collapsed .sb-head .spacer,
  .sidebar.collapsed .sb-group, .sidebar.collapsed .sb-item .badge, .sidebar.collapsed .sb-item .kbd,
  .sidebar.collapsed .user-btn .who, .sidebar.collapsed .user-btn > svg, .sidebar.collapsed .sb-foot > .icon-btn { display: none; }
  .sidebar.collapsed .sb-scroll { padding: 4px 0; overflow-x: hidden; }
  .sidebar.collapsed .sb-actions { padding: 4px 10px; }
  .sidebar.collapsed .sb-item { width: 36px; padding: 0; justify-content: center; }
  .sidebar.collapsed .sb-item .grow { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sidebar.collapsed .sb-newitem svg { width: 26px; height: 26px; padding: 5px; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
  .sidebar.collapsed .sb-newitem.active { background: transparent; }
  .sidebar.collapsed .sb-foot { border-top: 0; justify-content: center; padding: 8px 0 12px; }
  .sidebar.collapsed .user-btn { width: auto; flex: none; padding: 4px; }
}

/* auth v2: single centered column, email first */
.auth.auth-v2 { display: flex; flex-direction: column; grid-template-columns: none; background: var(--bg); }
.auth-v2 .auth-top { position: static; display: flex; align-items: center; gap: 4px; padding: 16px 20px; }
.auth-v2 .auth-top .spacer { flex: 1; }
.auth-center { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6vh 20px 40px; }
.auth-title { font-family: var(--font-serif); font-weight: 500; font-size: clamp(34px, 5vw, 52px); letter-spacing: -0.02em; margin: 0 0 10px; text-align: center; }
.auth-sub { color: var(--text-2); font-size: 17px; margin: 0 0 32px; text-align: center; }
.auth-v2 .auth-card { width: min(420px, 100%); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-v2 .auth-card .input { height: 44px; }
.btn-google { height: 44px; gap: 10px; justify-content: center; }
.btn-google .g { font-weight: 700; color: #4285f4; }
.btn-google .badge { margin-left: 4px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-step2 { display: none; flex-direction: column; gap: 12px; }
.auth-step2.open { display: flex; animation: fade 0.2s; }
.btn-dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-dark:hover:not(:disabled) { background: var(--text); opacity: 0.9; }
.auth-v2 .auth-card .switch { margin: 4px 0 0; }
.auth-legal { color: var(--text-3); font-size: 12px; margin-top: 18px; text-align: center; max-width: 420px; }
.page-inner.narrow { max-width: 640px; }
.new-project { margin-top: 6vh; display: flex; flex-direction: column; gap: 4px; }
.np-title { font-family: var(--font-serif); font-weight: 500; font-size: 30px; margin: 0 0 20px; }
.np-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.list-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.list-tools .search-field { flex: 1; margin: 0; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.sel-btn .muted + span { color: var(--text); }
.move-list { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.menu-item.sub-open { background: var(--hover); }
.menu-item > svg:last-child:not(:first-child) { color: var(--text-3); }
.menu-val { color: var(--text-3); font-size: 12px; margin-left: auto; }
.toggle-sw.sm { width: 30px; height: 18px; margin-left: auto; display: inline-block; }
.toggle-sw.sm i { width: 12px; height: 12px; }
.toggle-sw.sm.on i { transform: translateX(12px); }
.submenu { z-index: 401; max-height: 70vh; overflow-y: auto; }
.insp-thumb { display: grid; place-items: center; color: var(--accent); aspect-ratio: 16 / 9 !important; }
.insp-thumb svg { width: 36px; height: 36px; }
.ra-card.insp { cursor: pointer; }
.ra-card .ra-meta small { white-space: normal; }
.page-inner .tabs + .page-sub { margin-top: 14px; }

/* ---------- round 2: library skeleton ---------- */
.lib { padding: 28px 48px 64px; max-width: 1400px; }
.lib-title { font-family: var(--font-serif); font-weight: 500; font-size: 32px; letter-spacing: -0.01em; margin: 8px 0 22px; }
.lib-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.lib-bar .spacer { flex: 1; }
.lib-tools { display: flex; align-items: center; gap: 2px; }
.seg-tabs { display: inline-flex; gap: 2px; }
.seg-tabs > * { border: 0; background: transparent; height: 34px; padding: 0 14px; border-radius: 10px; font-size: 14px; color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.seg-tabs > *:hover { color: var(--text); background: var(--hover); }
.seg-tabs > .on { background: var(--active); color: var(--text); font-weight: 500; }
.vsep { width: 1px; height: 22px; background: var(--border); margin: 0 8px; }
.search-field.inline { margin: 0; height: 36px; width: 220px; }
.search-field.inline.wide { width: 300px; }
.lib-banner { position: relative; display: flex; gap: 16px; border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px; margin-bottom: 26px; background: var(--bg-elev); }
.lb-txt { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.lb-txt b { font-size: 15px; } .lb-txt p { margin: 0 0 8px; color: var(--text-2); font-size: 14px; } .lb-txt small { color: var(--text-3); }
.lb-x { position: absolute; top: 12px; right: 12px; }
.btn-soft { background: var(--bg-sunken); border-color: transparent; }
.btn-soft:hover:not(:disabled) { background: var(--active); }
.badge.soft { background: transparent; border: 1px solid var(--border); color: var(--text-3); font-weight: 500; }
.new-tiles { margin-bottom: 30px; }
.nt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 210px)); gap: 16px; }
.nt { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; color: var(--text); }
.nt-art { aspect-ratio: 10 / 7; border-radius: 14px; display: grid; place-items: center; transition: transform 0.12s, box-shadow 0.12s; }
.nt:hover .nt-art { box-shadow: var(--shadow); transform: translateY(-1px); }
.nt-art svg { width: 44px; height: 44px; }
.nt-lbl { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.tone-blue { background: #dfe9fb; color: #2a5bb8; } .tone-orange { background: #f8e2d6; color: #9a4a22; }
.tone-purple { background: #e7e1f8; color: #5a3fb0; } .tone-pink { background: #f6dcdf; color: #a3333f; } .tone-green { background: #dcefe9; color: #0e7a6b; }
:root[data-theme="dark"] .tone-blue { background: #1e2a40; color: #8fb2f0; } :root[data-theme="dark"] .tone-orange { background: #3a2a22; color: #f0b08f; }
:root[data-theme="dark"] .tone-purple { background: #2c2640; color: #b9a6f2; } :root[data-theme="dark"] .tone-pink { background: #3c2428; color: #f0a2ab; } :root[data-theme="dark"] .tone-green { background: #1d332e; color: #7fd8c7; }
.art-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.art-card2 { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg-elev); transition: box-shadow 0.12s; }
.art-card2:hover { box-shadow: var(--shadow); }
.ac-thumb { display: block; width: 100%; border: 0; padding: 24px 28px 0; background: var(--bg-sunken); cursor: pointer; }
.thumb.paper { aspect-ratio: 16 / 9; border-radius: 10px 10px 0 0; border-bottom: 0; box-shadow: 0 -1px 6px rgba(0,0,0,.05); }
.ac-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.ac-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-sunken); display: grid; place-items: center; flex: none; color: var(--text-2); }
.ac-txt { min-width: 0; display: flex; flex-direction: column; }
.ac-txt b { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-txt small { color: var(--text-3); font-size: 13px; } .ac-txt small a { color: inherit; }
.art-list { display: flex; flex-direction: column; }
.art-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); }
.art-row:hover { background: var(--hover); } .art-row .spacer { flex: 1; } .art-row small { color: var(--text-3); }
/* row cards (projects / tasks / catalog) */
.row-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 14px; }
.row-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--bg-sunken); text-decoration: none; color: var(--text); transition: background 0.12s; }
.row-card:hover { background: var(--active); }
.rc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rc-txt b { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-txt small { color: var(--text-3); font-size: 14px; }
.rc-more { opacity: 0; } .row-card:hover .rc-more, .rc-more:focus-visible, .task-card:hover .rc-more { opacity: 1; }
.rc-pin { color: var(--text-3); } .rc-pin.on { color: var(--text); } .rc-pin.on svg { fill: currentColor; }
.task-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 14px; background: var(--bg-sunken); border: 0; text-align: left; color: var(--text); }
button.task-card:hover { background: var(--active); }
.tc-head { display: flex; align-items: center; gap: 8px; } .tc-head b { font-size: 16px; font-weight: 500; } .tc-head .spacer { flex: 1; }
.tag { font-size: 12px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 9px; color: var(--text-2); }
.task-card p { margin: 0; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card small { color: var(--text-3); font-size: 13px; }
.lib-hero { display: flex; align-items: center; gap: 24px; border-radius: 18px; padding: 28px 36px; margin-bottom: 30px; background: var(--accent-soft); }
.lib-hero > div { flex: 1; } .lib-hero small { color: var(--text-2); } .lib-hero h2 { font-family: var(--font-serif); font-weight: 500; font-size: 28px; margin: 4px 0 6px; } .lib-hero p { color: var(--text-2); margin: 0 0 14px; }
.lh-art { color: var(--accent); opacity: 0.8; } .lh-art svg { width: 96px; height: 96px; }
.cat-card { display: flex; gap: 14px; padding: 18px; border-radius: 14px; background: var(--bg-sunken); align-items: flex-start; }
.cc-ic { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); display: grid; place-items: center; flex: none; color: var(--text-2); }
.cc-txt { flex: 1; min-width: 0; } .cc-txt b { font-size: 16px; font-weight: 500; }
.cc-txt p { margin: 4px 0; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-txt small { color: var(--text-3); font-size: 13px; }
.cc-act { display: flex; gap: 6px; align-items: center; }
@media (max-width: 768px) { .lib { padding: 16px 16px 48px; } .lib-title { font-size: 26px; } .search-field.inline, .search-field.inline.wide { width: 100%; } .lib-hero { padding: 20px; } .lh-art { display: none; } }

/* ---------- project icon ---------- */
.p-ic { display: inline-grid; place-items: center; flex: none; border-radius: 10px; }
.p-ic.md { width: 40px; height: 40px; } .p-ic.md svg { width: 20px; height: 20px; }
.p-ic.lg { width: 48px; height: 48px; border-radius: 12px; } .p-ic.lg svg { width: 26px; height: 26px; }
.p-ic.sm { width: 28px; height: 28px; border-radius: 8px; } .p-ic.sm svg { width: 16px; height: 16px; }
.p-ic.xs { width: 18px; height: 18px; border-radius: 5px; } .p-ic.xs svg { width: 14px; height: 14px; }
.p-ic.plain { background: transparent !important; }
.pc-green { background: #dcefe9; color: #0e8f7e; } .pc-blue { background: #dfe9fb; color: #2f64c8; } .pc-purple { background: #ebe4fb; color: #6a4bc9; }
.pc-orange { background: #f9e7d8; color: #b8611f; } .pc-pink { background: #f8e0e4; color: #c13f57; } .pc-gray { background: var(--bg-sunken); color: var(--text-2); }
:root[data-theme="dark"] .pc-green { background: #1d332e; } :root[data-theme="dark"] .pc-blue { background: #1e2a40; } :root[data-theme="dark"] .pc-purple { background: #2c2640; }
:root[data-theme="dark"] .pc-orange { background: #3a2a22; } :root[data-theme="dark"] .pc-pink { background: #3c2428; }
.input-with-icon { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elev); padding-left: 6px; }
.input-with-icon:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-with-icon .input { border: 0; box-shadow: none !important; background: transparent; flex: 1; }
.input-with-icon.narrow { width: 300px; max-width: 100%; }
.iwi-btn { border: 0; background: transparent; padding: 2px; border-radius: 8px; display: grid; }
.iwi-btn:hover { background: var(--hover); }
.icon-picker { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.ip-grid { display: grid; grid-template-columns: repeat(6, 36px); gap: 4px; }
.ip-btn { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center; }
.ip-btn:hover { background: var(--hover); } .ip-btn.on { background: var(--active); }
.ip-colors { display: flex; gap: 8px; margin-top: 8px; }
.ip-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.ip-color.on { border-color: var(--text); }
.np-modal { width: min(560px, 100%); }
.np-modal .field label .muted, .field .muted { font-weight: 400; }
.ctx-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px 14px; margin: 6px 0 4px; }
.ctx-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; } .ctx-head .spacer { flex: 1; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--text-3); font-size: 14px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.static { cursor: default; }
.dz-file { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-sunken); border-radius: 6px; padding: 2px 8px; color: var(--text); font-size: 13px; }
.dz-file small { color: var(--text-3); }

/* ---------- project home / panel / settings ---------- */
.proj-title { gap: 8px; } .proj-title .p-ic { margin-left: -2px; }
.proj-crumb { display: inline-flex; align-items: center; gap: 6px; }
.proj-home { flex: 1; overflow-y: auto; display: flex; justify-content: center; }
.ph-inner { width: 100%; max-width: 720px; padding: 12vh 20px 40px; }
.ph-head { display: flex; align-items: center; gap: 14px; }
.ph-head h1 { font-family: var(--font-serif); font-weight: 500; font-size: 30px; margin: 0; }
.ph-desc { color: var(--text-2); margin: 10px 0 0; white-space: pre-wrap; }
.ph-composer { margin-top: 24px; }
.ph-composer .composer-wrap { padding: 0; max-width: none; }
.ph-meta { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.proj-panel { width: 340px; flex: none; border-left: 1px solid var(--border); background: var(--bg-elev); display: flex; flex-direction: column; min-height: 0; }
.pp-head { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); }
.pp-head .spacer { flex: 1; } .pp-t { color: var(--text-2); font-size: 15px; } .pp-head .input.sm { height: 32px; flex: 1; }
.pp-body { flex: 1; overflow-y: auto; padding: 12px; }
.tp-group { margin-bottom: 16px; }
.tp-title { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.tp-title:hover { background: var(--hover); }
.tp-empty { border: 1.5px dashed var(--border); border-radius: 10px; padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; margin-top: 6px; }
.tp-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.tp-row:hover { background: var(--hover); } .tp-row.active { background: var(--active); }
.tp-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tp-row small { color: var(--text-3); white-space: nowrap; }
.tp-st { width: 14px; height: 14px; border-radius: 50%; border: 1.5px dashed var(--text-3); flex: none; }
.tp-st.working { border: 2px solid var(--accent); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.tp-st.recent { border-style: solid; border-color: var(--text-3); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1024px) { .proj-panel { display: none; } }
.pset-modal { width: min(900px, 100%); padding: 0; max-height: min(720px, 90vh); display: flex; flex-direction: column; }
.modal-title.bordered { padding: 16px 20px; border-bottom: 1px solid var(--border); margin: 0; }
.pset-body { display: grid; grid-template-columns: 220px 1fr; min-height: 0; flex: 1; }
.pset-body .side-tabs { padding: 16px; border-right: 1px solid var(--border); }
.pset-body .side-tabs button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); font-size: 14px; text-align: left; }
.pset-body .side-tabs button:hover { background: var(--hover); color: var(--text); }
.pset-body .side-tabs button.on { background: var(--active); color: var(--text); font-weight: 500; }
.pset-main { padding: 18px 24px 24px; overflow-y: auto; }
.pset-main h3 { display: flex; align-items: center; font-size: 16px; font-weight: 500; margin: 0 0 14px; } .pset-main h3 .spacer { flex: 1; }
.pset-main h3.sub { margin-top: 24px; }
.counter { display: block; text-align: right; color: var(--text-3); font-size: 12px; margin-top: 4px; }
.linklike { border: 0; background: transparent; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.cap-bar { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; margin-bottom: 4px; } .cap-bar i { display: block; height: 100%; background: var(--accent); }
.file-list { margin-top: 12px; }
@media (max-width: 640px) { .pset-body { grid-template-columns: 1fr; } .pset-body .side-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; } }

/* ---------- search palette v2 ---------- */
.palette { width: min(760px, 100%); border-radius: 20px; }
.palette-input { border-bottom: 0; padding: 18px 16px 6px 22px; }
.palette-input input { font-size: 17px; }
.pal-types { display: flex; gap: 2px; padding: 4px 16px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.pal-types button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.pal-types button:hover { background: var(--hover); } .pal-types button.on { background: var(--active); color: var(--text); }
.palette-list { max-height: 52vh; padding: 8px 12px; }
.palette-item { min-height: 42px; }
.pi-enter { color: var(--text-3); font-size: 14px; margin-left: 4px; }
.pal-foot { display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.pal-foot .spacer { flex: 1; }
.pal-foot kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; margin-left: 3px; background: var(--bg-elev); }
@media (max-width: 640px) { .pal-foot { display: none; } }
