:root {
  --bg: #0e0e11;
  --bg-2: #15151a;
  --bg-3: #1d1d24;
  --line: #2a2a33;
  --text: #ece9e4;
  --text-2: #a19d96;
  --text-3: #6d6a65;
  --accent: #e8a54b;
  --accent-ink: #1a1206;
  --danger: #e5675c;
  --radius: 14px;
  --sidebar: 268px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

#app { display: flex; height: 100dvh; overflow: hidden; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar); flex: none; display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px; background: var(--bg-2); border-right: 1px solid var(--line);
  transition: margin-left .2s ease;
}
#app.collapsed #sidebar { margin-left: calc(-1 * var(--sidebar)); }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; }
.logo { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 21px; letter-spacing: .01em; flex: 1; }

.new-chat {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-3); text-align: left; transition: border-color .15s;
}
.new-chat:hover { border-color: var(--accent); }
.new-chat span { color: var(--accent); font-weight: 600; }

.search input {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent;
  background: var(--bg); outline: none; font-size: 14px;
}
.search input:focus { border-color: var(--line); }

.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.conv-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 12px 8px 4px; }
.conv {
  display: flex; align-items: center; gap: 4px; padding: 7px 8px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; cursor: pointer;
}
.conv:hover { background: var(--bg-3); color: var(--text); }
.conv.active { background: var(--bg-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.conv .title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .title-input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; outline: none; }
.conv .acts { display: none; gap: 2px; }
.conv:hover .acts, .conv.active .acts { display: flex; }
.conv .acts button { background: none; border: 0; padding: 2px 5px; border-radius: 5px; color: var(--text-3); font-size: 13px; }
.conv .acts button:hover { color: var(--text); background: var(--line); }
.conv .acts button.confirm { color: var(--danger); font-size: 12px; }
.conv-none { color: var(--text-3); font-size: 13.5px; padding: 10px 8px; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.privacy-note { font-size: 12.5px; color: var(--text-3); line-height: 1.45; display: flex; gap: 8px; padding: 0 4px; }
.privacy-note .lock { color: #6fbf73; font-size: 9px; padding-top: 3px; }

/* ===== Main ===== */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.icon-btn { background: none; border: 0; width: 34px; height: 34px; border-radius: 8px; color: var(--text-2); font-size: 17px; }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

.mode-tabs { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.mode-tabs button { background: none; border: 0; padding: 5px 14px; border-radius: 7px; color: var(--text-2); font-size: 14px; }
.mode-tabs button.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }

.model-pick select {
  appearance: none; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a19d96' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 30px 6px 12px; font-size: 14px; max-width: 220px;
}
.model-pick { margin-left: auto; }
.demo-badge:not([hidden]) + .model-pick { margin-left: 0; }
.model-pick select:disabled { opacity: .6; }
.demo-badge { margin-left: auto; font-size: 12px; color: var(--accent); border: 1px solid rgba(232,165,75,.4); padding: 2px 10px; border-radius: 99px; }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroller { flex: 1; overflow-y: auto; scroll-behavior: smooth; }

/* Empty state */
.empty { max-width: 680px; margin: 0 auto; padding: 14vh 24px 24px; text-align: center; }
.empty h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 4vw, 38px); margin: 0 0 6px; }
.empty p { color: var(--text-2); margin: 0 0 28px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.chip {
  text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text-2); font-size: 14px; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

/* Messages */
.messages { max-width: 780px; margin: 0 auto; padding: 24px 20px 40px; }
.msg { display: flex; gap: 14px; padding: 14px 0; }
.msg .avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; margin-top: 2px;
}
.msg.user .avatar { background: var(--bg-3); color: var(--text-2); }
.msg.assistant .avatar { background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20120%20120%22%3E%3Cpath%20d%3D%22M24%20110%20V58%20A36%2036%200%200%201%2096%2058%20V110%22%20fill%3D%22none%22%20stroke%3D%22%23e8a54b%22%20stroke-width%3D%2213%22%20stroke-linecap%3D%22round%22/%3E%3Cpath%20d%3D%22M60%2052%20L66%2070%20L84%2076%20L66%2082%20L60%20100%20L54%2082%20L36%2076%20L54%2070%20Z%22%20fill%3D%22%23fff1d6%22/%3E%3C/svg%3E") center / 22px no-repeat; }
.msg .content { flex: 1; min-width: 0; }
.msg.user .body { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: inline-block; white-space: pre-wrap; max-width: 100%; }
.msg .body { overflow-wrap: anywhere; }
.msg .body > :first-child { margin-top: 0; }
.msg .body > :last-child { margin-bottom: 0; }
.msg .body p { margin: 0 0 12px; }
.msg .body h1, .msg .body h2, .msg .body h3 { font-family: var(--serif); font-weight: 500; margin: 20px 0 8px; line-height: 1.3; }
.msg .body h1 { font-size: 22px; } .msg .body h2 { font-size: 19px; } .msg .body h3 { font-size: 17px; }
.msg .body ul, .msg .body ol { padding-left: 22px; margin: 0 0 12px; }
.msg .body li { margin: 3px 0; }
.msg .body a { color: var(--accent); }
.msg .body blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--text-2); }
.msg .body code { font-family: var(--mono); font-size: 13px; background: var(--bg-3); padding: 1px 5px; border-radius: 5px; }
.msg .body pre { position: relative; background: #0a0a0c; border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; margin: 0 0 12px; }
.msg .body pre code { background: none; padding: 0; font-size: 13px; line-height: 1.55; }
.msg .body pre .lang { position: absolute; top: 6px; left: 12px; font: 11px var(--mono); color: var(--text-3); }
.msg .body pre.has-lang { padding-top: 28px; }
.copy-code { position: absolute; top: 6px; right: 6px; background: var(--bg-3); border: 1px solid var(--line); color: var(--text-2); font-size: 11.5px; padding: 2px 8px; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.msg .body pre:hover .copy-code { opacity: 1; }
.msg .body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.msg .body table { border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
.msg .body th, .msg .body td { border: 1px solid var(--line); padding: 6px 10px; }
.msg.error .body { color: var(--danger); }

.cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent); vertical-align: text-bottom; animation: blink 1s steps(2) infinite; border-radius: 1px; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 4px; padding: 6px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5 } 40% { transform: translateY(-4px); opacity: 1 } }

.msg-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:last-child .msg-actions { opacity: 1; }
.msg-actions button { background: none; border: 0; color: var(--text-3); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; }
.msg-actions button:hover { background: var(--bg-3); color: var(--text); }

/* Gallery */
.gallery { max-width: 1100px; margin: 0 auto; padding: 24px 20px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card .img { aspect-ratio: 1; background: var(--bg-3); display: grid; place-items: center; overflow: hidden; }
.card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .img.loading { background: linear-gradient(110deg, var(--bg-3) 30%, #26262f 50%, var(--bg-3) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.card .meta { padding: 10px 12px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.card .meta .p { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta .row { display: flex; justify-content: space-between; align-items: center; }
.card .meta a, .card .meta button { color: var(--text-3); font-size: 12.5px; background: none; border: 0; text-decoration: none; padding: 0; }
.card .meta a:hover, .card .meta button:hover { color: var(--accent); }
.card.err .img { color: var(--danger); font-size: 13px; padding: 16px; text-align: center; }

/* Video and voice */
.card .img.media { background: #000; }
.card .img video, .card .img img { width: 100%; height: 100%; display: block; }
.card .img video { object-fit: contain; background: #000; }
.card .img.missing { color: var(--text-3); font-size: 13px; padding: 16px; text-align: center; background: var(--bg-3); }
.gen-note { font-size: 13px; color: var(--text-2); background: rgba(14,14,17,.7); padding: 4px 10px; border-radius: 99px; }
.card .img.loading { display: grid; place-items: center; }
.need-models { color: var(--accent) !important; }
.need-models code, .empty code { font-family: var(--mono); font-size: 13px; background: var(--bg-3); padding: 1px 5px; border-radius: 5px; }

.voice-list { max-width: 780px; margin: 0 auto; padding: 24px 20px 40px; display: grid; gap: 12px; }
.vcard { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; }
.vcard .vtext { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.vcard .player audio { width: 100%; height: 40px; display: block; }
.vcard .player.loading { height: 40px; border-radius: 10px; background: linear-gradient(110deg, var(--bg-3) 30%, #26262f 50%, var(--bg-3) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.vcard .player.missing, .vcard .player.error-text { font-size: 13px; color: var(--text-3); }
.vcard .player.error-text { color: var(--danger); }
.vcard .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.vcard .row a, .vcard .row button, .card .meta .acts a { color: var(--text-3); font-size: 12.5px; background: none; border: 0; text-decoration: none; padding: 0; }
.vcard .row a:hover, .vcard .row button:hover { color: var(--accent); }

/* Composer */
.composer { padding: 0 16px 18px; }
.composer-box {
  max-width: 780px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 12px 12px 8px 16px; transition: border-color .15s;
}
.composer-box:focus-within { border-color: #44434d; }
.composer textarea { width: 100%; resize: none; border: 0; outline: none; background: none; max-height: 220px; line-height: 1.5; padding: 2px 0; }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.opts { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--text-3); }
.opt { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 13px; color: var(--text-2); }
.opt.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.opt.check input { accent-color: var(--accent); margin: 0; }
.voice-input { width: 170px; outline: none; }
.voice-input:focus { border-color: #44434d; }
.send-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 700; display: grid; place-items: center; transition: transform .1s, opacity .15s;
}
.send-btn:disabled { opacity: .35; cursor: default; }
.send-btn:not(:disabled):active { transform: scale(.94); }
.send-btn.stop { background: var(--text); }
.send-btn.stop::before { content: ""; width: 11px; height: 11px; background: var(--bg); border-radius: 2px; }

/* Buttons & dialog */
.ghost-btn, .danger-btn, .primary-btn { border-radius: 10px; padding: 8px 14px; font-size: 14px; }
.ghost-btn { background: none; border: 1px solid var(--line); color: var(--text-2); text-align: left; }
.ghost-btn:hover { color: var(--text); border-color: #44434d; }
.danger-btn { background: none; border: 1px solid rgba(229,103,92,.45); color: var(--danger); }
.danger-btn.confirm { background: var(--danger); color: #fff; }
.primary-btn { background: var(--accent); border: 0; color: var(--accent-ink); font-weight: 600; }

dialog { border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.settings { padding: 22px 24px; display: grid; gap: 18px; }
.settings h2 { font-family: var(--serif); font-weight: 400; margin: 0; font-size: 24px; }
.field { display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.field textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; outline: none; color: var(--text); }
.field textarea:focus { border-color: #44434d; }
.field input[type=range] { accent-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 10px; font-size: 14px; z-index: 50; }

.only-mobile { display: none; }
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9; }

@media (max-width: 800px) {
  #sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; margin-left: calc(-1 * var(--sidebar)); box-shadow: 0 0 40px rgba(0,0,0,.5); }
  #app.sidebar-open #sidebar { margin-left: 0; }
  .only-mobile { display: block; }
  .hint { display: none; }
  .topbar { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .model-pick { order: 3; flex-basis: 100%; margin-left: 0; }
  .model-pick select { max-width: none; width: 100%; }
  .mode-tabs button { padding: 5px 9px; font-size: 13.5px; }
  .voice-input { width: 140px; }
  .voice-list { padding: 16px 14px 30px; }
  .messages { padding: 16px 14px 30px; }
  .msg { gap: 10px; }
  .composer { padding: 0 10px 12px; }
  .copy-code { opacity: 1; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Credit estimate & pricing */
.estimate { font-size: 12px; color: var(--text-3); white-space: nowrap; margin-right: 4px; }
.estimate.warn { color: var(--accent); }
dialog.wide { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.settings h3 { margin: 6px 0 -10px; font-size: 16px; font-weight: 600; color: var(--text); }
.muted { margin: 0; font-size: 13.5px; color: var(--text-3); }
.row.between { justify-content: space-between; align-items: center; }
.bill-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.bill-toggle button { background: none; border: 0; color: var(--text-2); padding: 5px 12px; border-radius: 7px; font-size: 13px; }
.bill-toggle button.active { background: var(--bg-3); color: var(--text); }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
@media (max-width: 700px) { .plan-grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); } }
.plan { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg); display: grid; gap: 6px; align-content: start; }
.plan.popular { border-color: var(--accent); }
.plan.current { box-shadow: 0 0 0 1px var(--text-3) inset; }
.plan .tag { position: absolute; top: -9px; right: 12px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.plan h4 { margin: 0; font-size: 15px; }
.plan .price { font-size: 24px; font-weight: 700; color: var(--text); }
.plan .price small { font-size: 13px; font-weight: 400; color: var(--text-3); }
.plan ul { margin: 4px 0 0; padding-left: 16px; font-size: 13px; color: var(--text-2); display: grid; gap: 3px; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pack { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.pack b { display: block; font-size: 18px; color: var(--text); }
.pack span { font-size: 13px; color: var(--text-2); }
.pack em { display: block; font-style: normal; font-size: 12px; color: var(--accent); }
.rate-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.rate-tables table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rate-tables caption { text-align: left; font-weight: 600; color: var(--text); padding-bottom: 4px; }
.rate-tables td, .rate-tables th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; color: var(--text-2); font-weight: 400; }
.rate-tables th { color: var(--text-3); font-size: 12px; }
.rate-tables td:not(:first-child), .rate-tables th:not(:first-child) { text-align: right; }
@media (max-width: 800px) { .estimate { display: none; } }

/* ===== Accounts, characters, memory, attachments, sources ===== */
.side-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-radius: 10px; border: 0; background: none; color: var(--text-2); text-align: left; }
.side-link:hover { background: var(--bg-3); color: var(--text); }
.side-link span { color: var(--accent); }
.account-btn { width: 100%; display: grid; gap: 1px; text-align: left; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.account-btn:hover { border-color: #44434d; }
.acct-email { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-meta { font-size: 12.5px; color: var(--text-3); }
.acct-meta b { color: var(--accent); font-weight: 600; }
.legal-links { font-size: 11.5px; color: var(--text-3); padding: 0 4px; }
.legal-links a { color: var(--text-3); text-decoration: none; }
.legal-links a:hover { color: var(--text-2); }

.text-input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; color: var(--text); min-width: 0; flex: 1; font-size: 14px; }
.text-input:focus { border-color: #44434d; }
textarea.text-input { resize: vertical; width: 100%; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--text-2); line-height: 1.4; }
.check-line input { accent-color: var(--accent); margin-top: 3px; }
.check-line a, .muted a { color: var(--accent); }
.form-error { color: var(--danger); font-size: 13.5px; margin: 0; }
.wide-btn { width: 100%; padding: 10px; }
.link-btn { background: none; border: 0; color: var(--accent); padding: 0; font-size: inherit; }
.center { text-align: center; }
#auth { width: min(420px, calc(100vw - 32px)); }

.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.acc-card { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); }
.acc-card b { font-size: 20px; color: var(--text); }
.upd-box h3 { margin: 0; }
.upd-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.upd-item .upd-title { color: var(--text); font-weight: 600; }
.upd-item .upd-meta { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.upd-item code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-3); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.upd-item .row { margin-top: 8px; gap: 8px; }
.upd-dot { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.ledger { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.ledger table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger td { padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.ledger td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger .neg { color: var(--text-3); } .ledger .pos { color: #6fbf73; }
.danger-zone { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 10px; }
.danger-zone summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.danger-zone[open] { gap: 10px; }
.danger-zone .row { flex-wrap: wrap; margin-top: 8px; }

.plan-cta { margin-top: 8px; justify-self: start; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 5px 14px; font-size: 13px; color: var(--text); }
.plan-cta:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.plan.popular .plan-cta { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pack { display: grid; gap: 2px; align-content: start; }
.pack .plan-cta { margin-top: 6px; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.char-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); display: grid; gap: 10px; }
.char-head { display: flex; gap: 10px; align-items: center; }
.char-head div { display: grid; min-width: 0; }
.char-head .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-emoji { font-size: 26px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--bg-3); border-radius: 50%; flex: none; }
.char-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.char-acts button { padding: 5px 10px; font-size: 13px; }
.char-acts .confirm { color: var(--danger); border-color: var(--danger); }
.char-edit { display: grid; gap: 10px; }
.emoji-input { flex: 0 0 64px; text-align: center; font-size: 20px; }
.char-banner { max-width: 760px; margin: 18px auto 0; padding: 12px 16px; display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.char-banner div { display: grid; }
.char-banner .muted { font-size: 13px; }

.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.mem-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; color: var(--text); }
.mem-list li.muted { color: var(--text-3); }
.mem-list button { background: none; border: 0; color: var(--text-3); }
.mem-list button:hover { color: var(--danger); }

.tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 4px 8px; }
.tray-item { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.tray-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.tray-item .pdf { display: grid; place-items: center; height: 64px; max-width: 150px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item em { font-style: normal; font-size: 11px; color: var(--text-3); }
.tray-item button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); font-size: 11px; line-height: 1; padding: 0; }
.composer-box.drop { border-color: var(--accent); }
.icon-opt { padding: 3px 7px; }
#enhanceBtn:disabled { opacity: .45; cursor: default; }

.att-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.att-chip { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--text-2); }
.att-chip img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.sources { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.sources a { display: inline-flex; gap: 6px; align-items: center; max-width: 260px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sources a:hover { border-color: var(--accent); color: var(--text); }
.sources a b { color: var(--accent); font-weight: 600; }
.sources a span { color: var(--text-3); }
.card .meta .tools { display: flex; flex-wrap: wrap; gap: 4px 12px; border-top: 1px solid var(--line); padding-top: 6px; }
.lyrics summary { cursor: pointer; font-size: 13px; color: var(--text-3); }
.lyrics pre { white-space: pre-wrap; font: 13.5px/1.5 var(--font); color: var(--text-2); margin: 6px 0 0; max-height: 240px; overflow: auto; }

.forgot-link { justify-self: start; font-size: 13.5px; margin-top: -8px; }
.form-ok { color: #6fbf73; font-size: 14px; line-height: 1.5; margin: 0; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px;
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer; }
.google-btn:hover { background: #f4f6f8; }
.google-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* email confirmation reminder */
.verify-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; padding: 9px 16px;
  background: var(--accent-soft, rgba(232,165,75,.12)); border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; text-align: center; }
.verify-bar b { font-weight: 600; }

/* long chats: where the summary starts; a backup model answered */
.summary-divider { display: flex; align-items: center; gap: 12px; margin: 6px auto 18px; max-width: 760px; color: var(--text-3); font-size: 12.5px; text-align: center; }
.summary-divider::before, .summary-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.served-by { margin-top: 8px; color: var(--text-3); font-size: 12.5px; }

/* model picker for Upscale / Remove background */
.pick-list { display: grid; gap: 8px; }
.pick-list button { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; text-align: left; cursor: pointer; }
.pick-list button:hover { border-color: var(--text-3); }
.pick-list button.last { border-color: var(--accent); }
.pick-list .price { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.pick-list .name { overflow-wrap: anywhere; }
