@font-face {
  font-family: Inter;
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root, [data-theme="dark"] {
  --bg: #0b0b0b; --bg-side: #101010; --bg-elev: #141414; --bg-user: #1a1a1a; --bg-code: #0e0e0e;
  --text: #f2ede6; --text-dim: #8a8680; --border: #262626; --accent: #ff5a1f; --accent-hover: #ff6d38;
  --accent-text: #140804; --danger: #ff6b6b; --ok: #5dcea8; --warn-bg: #2a1c12; --warn-border: #6a3d1a;
  --shadow: 0 8px 30px rgba(0,0,0,.45); --glow: rgba(255, 90, 31, .28);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Inter, ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
[data-theme="light"] {
  --bg: #f4f1eb; --bg-side: #ebe7df; --bg-elev: #fffcf7; --bg-user: #e8e4db; --bg-code: #ece8e0;
  --text: #161513; --text-dim: #6b675f; --border: #e0dbd2; --accent: #ff5a1f; --accent-hover: #e64e17;
  --accent-text: #140804; --danger: #c4452b; --ok: #2f7d4f; --warn-bg: #fff4e0; --warn-border: #e8b45c;
  --shadow: 0 8px 24px rgba(40,30,20,.08); --glow: rgba(255, 90, 31, .14);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body.site-page { height: auto; min-height: 100%; }
body.site-page, .app .main {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 70% 50% at 88% -8%, var(--glow), transparent 62%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout */
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 272px; flex: none; background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 12px; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-family: var(--font); font-size: 20px; font-weight: 700; letter-spacing: -.03em; text-decoration: none; color: var(--text); }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 15px; font-weight: 700; font-family: var(--font); letter-spacing: 0; }
.new-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); font-weight: 500; }
.new-chat:hover { border-color: var(--accent); }
.side-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: 18px 10px 6px; }
.convs { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.conv { display: flex; align-items: center; gap: 4px; border-radius: 9px; padding: 0 4px 0 0; }
.conv:hover, .conv.active { background: color-mix(in srgb, var(--text) 8%, transparent); }
.conv button.title { flex: 1; text-align: left; background: none; border: 0; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.conv .del { opacity: 0; border: 0; background: none; padding: 4px 7px; border-radius: 6px; color: var(--text-dim); }
.conv:hover .del { opacity: 1; }
.conv .del:hover { color: var(--danger); }
.side-empty { color: var(--text-dim); font-size: 14px; padding: 8px 10px; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-dim); }
.badge.pro { border-color: var(--accent); color: var(--accent); }
.foot-actions { display: flex; gap: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); font-weight: 600; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.grow { flex: 1; }
.icon-btn { border: 1px solid var(--border); background: var(--bg-elev); border-radius: 10px; width: 38px; height: 36px; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 52px; }
.topbar .menu { display: none; }
.topbar .spacer { flex: 1; }
.guest-pill { font-size: 13px; color: var(--text-dim); border: 1px solid var(--border); padding: 3px 12px; border-radius: 99px; background: var(--bg-elev); }
.guest-pill b { color: var(--accent); }
.scroller { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.col { max-width: 768px; margin: 0 auto; padding: 8px 20px 24px; }

.welcome { text-align: center; padding: 14vh 0 4vh; }
.welcome h1 { font-family: var(--font); font-weight: 700; font-size: 34px; margin: 0 0 8px; letter-spacing: -.04em; }
.welcome h1 .spark { color: var(--accent); margin-right: 10px; }
.welcome p { color: var(--text-dim); margin: 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.chip { border: 1px solid var(--border); background: var(--bg-elev); padding: 7px 14px; border-radius: 99px; font-size: 14px; }
.chip:hover { border-color: var(--accent); }

.msg { margin: 18px 0; display: flex; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--bg-user); padding: 10px 16px; border-radius: 18px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .ai-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; flex: none; margin-top: 2px; }
.msg.assistant .content { min-width: 0; flex: 1; font-size: 16.5px; line-height: 1.7; word-wrap: break-word; }
.msg.assistant .content.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.err-note { color: var(--danger); font-size: 14px; margin-top: 6px; }

/* ---------- markdown */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .6em 0; } .md h1, .md h2, .md h3, .md h4 { font-family: var(--font); font-weight: 700; letter-spacing: -.03em; line-height: 1.3; margin: 1.2em 0 .4em; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; }
.md ul, .md ol { padding-left: 1.5em; margin: .5em 0; } .md li { margin: .25em 0; }
.md blockquote { margin: .8em 0; padding: .1em 1em; border-left: 3px solid var(--border); color: var(--text-dim); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--bg-code); border: 1px solid var(--border); padding: .1em .38em; border-radius: 5px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md table { border-collapse: collapse; margin: .8em 0; font-size: .95em; } .md th, .md td { border: 1px solid var(--border); padding: 6px 12px; } .md th { background: var(--bg-code); }
.codeblock { margin: .9em 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-code); }
.codeblock .bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; font-size: 12.5px; color: var(--text-dim); border-bottom: 1px solid var(--border); font-family: var(--font); }
.codeblock .copy { border: 0; background: none; padding: 3px 9px; border-radius: 6px; font-size: 12.5px; color: var(--text-dim); }
.codeblock .copy:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.codeblock pre { margin: 0; padding: 12px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.55; }
.codeblock pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.tok-k { color: #b0467a; } .tok-s { color: #4a7d3a; } .tok-c { color: #8a8672; font-style: italic; } .tok-n { color: #b8742a; }
[data-theme="dark"] .tok-k { color: #e58fbd; } [data-theme="dark"] .tok-s { color: #9ccf86; } [data-theme="dark"] .tok-n { color: #e8a860; }

/* ---------- composer */
.composer-wrap { padding: 0 16px 14px; }
.composer { max-width: 768px; margin: 0 auto; border: 1px solid var(--border); background: var(--bg-elev); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 12px 10px 20px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; transition: border-color .15s; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-bar .send { margin-left: auto; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.composer textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16.5px; line-height: 1.5; max-height: 220px; padding: 6px 0; }
.composer textarea::placeholder { color: var(--text-dim); }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.send:hover { background: var(--accent-hover); } .send:disabled { opacity: .35; cursor: default; }
.disclaimer { text-align: center; color: var(--text-dim); font-size: 12.5px; margin-top: 8px; }

/* ---------- modal */
.overlay { position: fixed; inset: 0; background: rgba(20,18,10,.5); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(2px); }
.modal { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 8px; letter-spacing: -.01em; }
.modal p { color: var(--text-dim); margin: 6px 0 14px; }
.modal .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.cred { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-code); padding: 10px 12px; margin: 10px 0; }
.cred label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 4px; }
.cred .row { display: flex; align-items: center; gap: 8px; }
.cred code { flex: 1; font-family: var(--mono); font-size: 15px; word-break: break-all; user-select: all; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-border); cursor: pointer; font-size: 14.5px; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--accent); }
.note { font-size: 13.5px; color: var(--text-dim); }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin-top: 8px; }

/* ---------- standalone pages */
.page { min-height: 100%; display: flex; flex-direction: column; }
.site-page > .page { min-height: 0; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.page-head .brand { padding: 0; }
.card-wrap { flex: 1; display: grid; place-items: start center; padding: 24px 16px 60px; }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px; padding: 28px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.card.wide { max-width: 760px; }
.card h1 { font-family: var(--font); font-weight: 700; font-size: 28px; margin: 0 0 6px; letter-spacing: -.03em; }
.card .sub { color: var(--text-dim); margin: 0 0 18px; }
.field { display: block; margin: 12px 0; } .field span { display: block; font-size: 13.5px; color: var(--text-dim); margin-bottom: 4px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email], .field input[type=url], .field input[type=search], .field select, .field textarea { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; outline: 0; }
.field input:focus { border-color: var(--accent); }
.field input.mono { font-family: var(--mono); font-size: 13.5px; }

.plans { display: grid; gap: 14px; margin: 14px 0; }
.plan { border: 2px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; background: var(--bg); text-align: left; width: 100%; }
.plan.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.plan .pname { font-weight: 600; font-size: 17px; } .plan .pdesc { color: var(--text-dim); font-size: 14px; }
.plan .price { font-family: var(--serif); font-size: 26px; white-space: nowrap; } .plan .price small { font-size: 14px; color: var(--text-dim); font-family: var(--font); }
.coin-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); text-align: left; }
.coin-btn:hover { border-color: var(--accent); }
.coin-ico { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; font-family: var(--font); }
.std { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text-dim); font-weight: 600; }
.lowfee { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); font-weight: 600; }
.picker { max-width: 560px; }
.picker input.search { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; outline: 0; margin: 4px 0 12px; }
.pop-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pop-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 99px; background: var(--bg); }
.pop-chip:hover, .asset-row:hover { border-color: var(--accent); }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin: 16px 0 6px; }
.asset-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; }
.asset-row .grow { flex: 1; }

/* invoice page */
.pay-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.qr { background: #fff; border-radius: 14px; padding: 8px; border: 1px solid var(--border); }
.qr img { display: block; width: 100%; height: auto; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 99px; font-weight: 600; font-size: 14px; border: 1px solid var(--border); }
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.status-pill.awaiting .dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.status-pill.detected .dot { background: #d9a400; animation: pulse 1s ease-in-out infinite; }
.status-pill.confirmed .dot { background: var(--ok); } .status-pill.confirmed { color: var(--ok); border-color: var(--ok); }
.status-pill.expired .dot, .status-pill.cancelled .dot { background: var(--text-dim); }
.status-pill.underpaid .dot, .status-pill.overpaid .dot, .status-pill.late .dot { background: var(--danger); } .status-pill.underpaid, .status-pill.overpaid, .status-pill.late { color: var(--danger); border-color: var(--danger); }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .5; } }
.timer { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: .02em; }
.timer.low { color: var(--danger); }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; margin: 14px 0; }
.warn strong { display: block; margin-bottom: 2px; }
.kv { margin: 12px 0; } .kv label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 3px; }
.kv .row { display: flex; gap: 8px; align-items: center; } .kv .val { flex: 1; font-family: var(--mono); font-size: 15px; word-break: break-all; padding: 8px 12px; background: var(--bg-code); border: 1px solid var(--border); border-radius: 10px; }
.kv .val.big { font-size: 20px; font-weight: 600; }
.dev-banner { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); border: 1px dashed var(--accent); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.success { text-align: center; padding: 10px 0; } .success .tick { font-size: 54px; color: var(--ok); }

/* admin */
.admin-grid { display: grid; gap: 16px; }
.admin-sec { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--bg-elev); }
.admin-sec h2 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 0 0 10px; }
table.inv { width: 100%; border-collapse: collapse; font-size: 13.5px; } table.inv th, table.inv td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; } table.inv tr.flag { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 12px; font-size: 14px; } .toggles label { display: inline-flex; gap: 6px; align-items: center; }
.conf-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 18px; border-radius: 99px; font-size: 14px; z-index: 99; box-shadow: var(--shadow); }

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar .menu { display: grid; }
  .welcome h1 { font-size: 30px; }
  .pay-grid { grid-template-columns: 1fr; } .qr { max-width: 260px; margin: 0 auto; }
  .conf-row { grid-template-columns: repeat(2, 1fr); }
}
.min0 { min-width: 0; }
.mt { margin-top: 16px; } .actions { display: flex; gap: 10px; margin-top: 14px; }
.inline-flex { display: inline-flex; gap: 8px; align-items: center; }
.pay-grid .head { display: flex; align-items: center; gap: 12px; }
.wide-admin { width: 100%; max-width: 1040px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; } .admin-top h1 { font-family: var(--serif); font-weight: 500; margin: 0; }
.table-scroll { overflow-x: auto; } .mono-s { font-family: var(--mono); font-size: 12px; }
.admin-sec .actions { margin-top: 8px; }
textarea.preface { width: 100%; padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; outline: 0; resize: vertical; }
textarea.preface:focus { border-color: var(--accent); }
.testres { margin-top: 8px; font-size: 14px; min-height: 1.2em; color: var(--text-dim); } .testres.ok { color: var(--ok); } .testres.bad { color: var(--danger); }

/* ---------- motion (palette unchanged) */
button, .btn, .send, .icon-btn, .new-chat, .chip, .plan, .coin-btn, .asset-row, .pop-chip, .conv, a.btn {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .12s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active:not(:disabled), .send:active:not(:disabled), .new-chat:active, .chip:active, .plan:active, .coin-btn:active, .icon-btn:active { transform: scale(0.98); }
body.modal-open { overflow: hidden; }

.overlay { background: rgba(20, 18, 10, .48); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .22s ease; }
.overlay.show { opacity: 1; }
.overlay .modal { transform: scale(.96) translateY(10px); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
.overlay.show .modal { transform: scale(1) translateY(0); opacity: 1; }

.toast { transform: translateX(-50%) translateY(18px); opacity: 0; animation: toast-in .28s ease forwards; }
.toast.toast-out { animation: toast-out .28s ease forwards; }
@keyframes toast-in { to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(-50%) translateY(0); opacity: 1; } to { transform: translateX(-50%) translateY(18px); opacity: 0; } }

.steps { display: flex; gap: 8px; margin: 0 0 20px; }
.steps .step { flex: 1; height: 3px; border-radius: 99px; background: var(--border); overflow: hidden; }
.steps .step .fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.steps .step.on .fill { width: 100%; }

.icon-tile { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev)); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; flex: none; }
.icon-tile.ok { background: color-mix(in srgb, var(--ok) 16%, var(--bg-elev)); color: var(--ok); }
.icon-tile svg { display: block; }

.modal.flow { max-width: 440px; padding: 22px 26px 24px; }
.modal.flow h2 { margin-top: 0; }
.modal .link-btn { display: block; width: 100%; text-align: center; background: none; border: 0; color: var(--text-dim); padding: 10px 8px 0; font-weight: 500; }
.modal .link-btn:hover { color: var(--text); }
.modal .btn.wide, .btn.wide { width: 100%; padding: 11px 16px; border-radius: 12px; }
.modal.flow .field { margin: 10px 0; }
.modal.flow .field span { font-weight: 500; color: var(--text); }

.welcome .tagline { font-family: var(--font); font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 10px; letter-spacing: -.03em; line-height: 1.35; }
.pro-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--accent); color: var(--accent); background: var(--bg-elev); }
.top-cta { font-size: 14px; font-weight: 500; background: none; border: 0; color: var(--text-dim); padding: 6px 8px; border-radius: 8px; }
.top-cta:hover { color: var(--text); }

.guest-blurb { font-size: 13px; color: var(--text-dim); padding: 0 6px 2px; }
.paid-until { font-size: 12px; color: var(--text-dim); }

.composer-meta { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--text-dim); min-height: 0; }
.composer-meta a, .composer-meta button.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; font-size: inherit; }
.composer-meta a:hover, .composer-meta button.linkish:hover { text-decoration: underline; }
.dots { display: inline-flex; gap: 5px; align-items: center; }
.dot-msg { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background-color .2s ease; }
.dot-msg.used { background: var(--accent); }
.disclaimer { margin-top: 6px; }

.setup-steps { max-width: 440px; margin: 0 auto 18px; }
.card .tagline { font-family: var(--font); font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 8px; letter-spacing: -.03em; }


/* ---------- model picker (composer) */
.model-picker { position: relative; min-width: 0; }
.model-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px 6px 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 500; font-family: var(--mono); }
.model-btn:hover:not(.single) { background: var(--bg-user); color: var(--text); }
.model-btn.single { cursor: default; }
.model-btn[aria-expanded="true"] { background: var(--bg-user); color: var(--text); }
.model-btn svg { flex: none; transition: transform .18s ease; } .model-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.model-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-menu { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30; width: min(360px, 86vw); max-height: min(340px, 50vh); overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elev); box-shadow: 0 10px 34px rgba(40,35,20,.18); opacity: 0; transform: translateY(6px) scale(.98); transform-origin: bottom left; transition: opacity .16s ease, transform .16s ease; pointer-events: none; }
.model-menu.show { opacity: 1; transform: none; pointer-events: auto; }
.model-opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; color: var(--text); }
.model-opt:hover, .model-opt:focus-visible { background: var(--bg-user); outline: 0; }
.model-opt.sel { background: color-mix(in srgb, var(--accent) 12%, var(--bg-elev)); }
.mo-main { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.mo-prov { font-size: 12px; color: var(--text-dim); align-self: center; }
.mo-desc { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.35; color: var(--text-dim); }
.side-links { display: flex; gap: 14px; padding: 8px 6px 2px; font-size: 13px; }
.side-links a { color: var(--text-dim); text-decoration: none; } .side-links a:hover { color: var(--accent); }

/* ---------- public server-rendered pages (/models, /faq) */
.site-page { min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.site-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 18px 28px; max-width: 1200px; width: 100%; margin: 0 auto; position: relative; z-index: 2; }
.site-head .brand { padding: 0; }
.site-head .brand-name { letter-spacing: -.04em; }
.site-nav { display: flex; gap: 4px; justify-content: center; }
.site-nav a { padding: 7px 14px; border-radius: 999px; color: var(--text-dim); text-decoration: none; font-weight: 500; font-size: 15px; letter-spacing: -.01em; transition: color .15s ease, background-color .15s ease; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-head-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.open-chat { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px; letter-spacing: -.01em; text-decoration: none; line-height: 1; border: 0; }
.open-chat:hover { opacity: .9; color: var(--bg); }
.site-page .icon-btn { background: transparent; border-color: var(--border); color: var(--text-dim); }
.site-page .icon-btn:hover { color: var(--text); border-color: var(--text-dim); }
.site-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 18px 24px 56px; animation: page-in .28s ease both; position: relative; z-index: 1; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.site-main h1 { font-family: var(--font); font-weight: 750; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.04em; margin: 14px 0 8px; line-height: 1.1; }
.site-main .lead { color: var(--text-dim); font-size: 18px; max-width: 640px; margin: 0 0 26px; line-height: 1.5; }
.provider { margin: 28px 0 0; }
.provider h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; margin: 0 0 12px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.model-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px; box-shadow: var(--shadow); transition: border-color .15s ease, transform .15s ease; scroll-margin-top: 20px; }
.model-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
.model-card h3 { margin: 0 0 6px; font-size: 18px; font-family: var(--font); font-weight: 650; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-card p { margin: 0; color: var(--text-dim); line-height: 1.5; font-size: 15px; }
.faq { max-width: 760px; display: grid; gap: 10px; }
.faq-item { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; transition: border-color .15s ease; }
.faq-item[open] { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.faq-item summary { cursor: pointer; list-style: none; padding: 15px 44px 15px 18px; font-weight: 600; position: relative; border-radius: 14px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: ''; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); transform: rotate(45deg); transition: transform .2s ease; }
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item summary:hover { color: var(--accent); }
.faq-a { padding: 0 18px 14px; color: var(--text-dim); line-height: 1.6; animation: page-in .22s ease both; }
.faq-a p { margin: 0 0 10px; }
.cta { margin: 36px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.cta.tight { margin: 0; }
.empty { color: var(--text-dim); }
.site-foot { max-width: 1200px; width: 100%; margin: 0 auto; padding: 22px 28px 36px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--text-dim); font-size: 14px; border-top: 1px solid var(--border); position: relative; z-index: 1; }
.site-foot nav { display: flex; gap: 16px; } .site-foot a { color: var(--text-dim); text-decoration: none; } .site-foot a:hover { color: var(--accent); }
@media (max-width: 720px) { .site-head { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; } .site-nav { order: 3; width: 100%; justify-content: flex-start; } .site-head-right { margin-left: auto; } .site-main { padding: 10px 16px 40px; } }
@media (prefers-reduced-motion: reduce) { .site-main, .faq-a { animation: none; } .model-menu { transition: none; } }

/* ---------- admin: models + FAQ editors */
.mlist { display: grid; gap: 10px; margin-top: 12px; }
.mrow { border: 1px solid var(--border); border-radius: 14px; background: var(--bg); transition: border-color .15s ease; }
.mrow.open { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--bg-elev); }
.mrow.off .m-title { color: var(--text-dim); }
.m-sum { display: flex; align-items: center; gap: 12px; padding: 11px 14px; flex-wrap: wrap; }
.m-main { flex: 1; min-width: 200px; } .m-title { font-weight: 600; } .m-sub { font-size: 12.5px; color: var(--text-dim); font-family: var(--mono); overflow-wrap: anywhere; }
.m-flags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.m-body { padding: 4px 14px 14px; border-top: 1px dashed var(--border); }
.m-body .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } @media (max-width: 640px) { .m-body .two { grid-template-columns: 1fr; } }
.faq-edit { display: grid; gap: 12px; margin-top: 12px; }
.faq-row { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--bg); }
.faq-row input[type=text], .faq-row textarea { width: 100%; }
.faq-row textarea { min-height: 84px; padding: 10px 12px; font: inherit; font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; resize: vertical; outline: 0; }
.faq-row textarea:focus { border-color: var(--accent); }
.faq-tools { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }


/* ---------- home landing */
.home-main { max-width: 920px; padding-top: 48px; }
.hero { text-align: left; padding: 28px 0 8px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border: 1px solid var(--border); border-radius: 999px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); margin: 0 0 22px; }
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: none; }
.hero h1 { font-size: clamp(44px, 8vw, 80px); font-weight: 750; letter-spacing: -.045em; line-height: 1.02; margin: 0 0 18px; max-width: 16ch; }
.hero h1 .accent { color: var(--accent); }
.hero-sub { font-size: clamp(17px, 2vw, 20px); color: var(--text-dim); max-width: 36em; margin: 0 0 28px; line-height: 1.45; }
.hero-composer { border: 1px solid var(--border); border-radius: 20px; background: var(--bg-elev); overflow: hidden; box-shadow: var(--shadow); }
.hero-composer-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.model-chips { display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.model-chips::-webkit-scrollbar { display: none; }
.mchip { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-family: var(--mono); font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: border-color .15s ease, color .15s ease, background-color .15s ease; }
.mchip:hover { color: var(--text); }
.mchip.on, .mchip:has(input:checked) { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.mchip input { position: absolute; opacity: 0; pointer-events: none; }
.hero-meta { font-family: var(--mono); font-size: 12px; color: var(--text-dim); letter-spacing: .02em; flex: none; margin-left: auto; }
.hero-composer textarea { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.5; padding: 16px 18px 8px; min-height: 88px; resize: none; outline: 0; }
.hero-composer textarea::placeholder { color: color-mix(in srgb, var(--text-dim) 80%, transparent); }
.hero-composer-bot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px 14px; }
.hero-go { padding: 10px 16px; border-radius: 12px; font-size: 15px; }
.hero-go svg { width: 16px; height: 16px; }
.hero-hint { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.hero-sugs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.sug { border: 1px solid var(--border); background: transparent; color: var(--text-dim); padding: 8px 14px; border-radius: 999px; font-size: 14px; text-decoration: none; }
.sug:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

.home-sec { margin: 72px 0 0; }
.home-sec h2 { font-size: 13px; font-family: var(--mono); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 16px; }
.model-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.model-strip a, .model-strip span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--bg-elev); font-size: 14px; font-weight: 550; }
.model-strip a:hover { border-color: var(--accent); }
.model-strip .prov { font-family: var(--mono); font-size: 11px; color: var(--text-dim); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step-card { border: 1px solid var(--border); border-radius: 16px; padding: 20px 18px 18px; background: var(--bg-elev); }
.step-card .n { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: .06em; font-weight: 500; }
.step-card h3 { margin: 8px 0 8px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.step-card p { margin: 0; color: var(--text-dim); font-size: 14.5px; line-height: 1.5; }

.price-tease { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; border: 1px solid var(--border); border-radius: 20px; padding: 24px; background: var(--bg-elev); }
.price-tease .amt { font-size: clamp(36px, 6vw, 52px); font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.price-tease .amt span { font-size: .4em; font-weight: 550; color: var(--text-dim); letter-spacing: 0; }
.price-tease p { margin: 0 0 8px; color: var(--text-dim); max-width: 36em; }
.price-tease .coins { font-family: var(--mono); font-size: 12px; color: var(--text-dim); letter-spacing: .04em; }

.home-faq { max-width: 760px; }
@media (max-width: 720px) {
  .hero h1 { max-width: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .home-sec { margin-top: 48px; }
  .hero { padding-top: 8px; }
}


/* ---------- extension install (post-purchase + account) */
.ext-modal { max-width: 560px; }
.ext-modal > p { color: var(--text-dim); margin: 0 0 16px; }
.ext-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px 16px; background: var(--bg-elev); margin: 0 0 12px; }
.ext-card.rec { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.ext-card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ext-card-h h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.ext-badge { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 2px 8px; }
.ext-ver { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-left: auto; }
.ext-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.ext-size { font-weight: 500; opacity: .85; }
.ext-steps { margin: 12px 0 0; padding-left: 1.2em; color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.ext-steps li { margin: 4px 0; }
.ext-code { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.ext-code code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-code); border: 1px solid var(--border); padding: 2px 7px; border-radius: 6px; color: var(--text); }
.ext-other-h { font-size: 12px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); font-weight: 500; margin: 18px 0 10px; }
.ext-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.ext-foot .link-btn { width: auto; padding: 8px 10px 8px 0; }
.ext-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 16px 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev)); font-size: 14px; }
.ext-banner .ext-banner-x { width: 32px; height: 32px; margin-left: auto; background: transparent; }
.admin-ext { display: grid; gap: 14px; margin-top: 12px; }
.ext-admin { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; background: var(--bg); }
.ext-admin h3 { margin: 0 0 8px; font-size: 16px; }
.ext-stats { font-family: var(--mono); font-size: 12px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 10px; }
.sha { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--text-dim); }

/* ---- pricing (home + plans + admin) ---- */
.price-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.price-card { border: 1px solid var(--border); border-radius: 18px; padding: 22px 20px 18px; background: var(--bg-elev); display: flex; flex-direction: column; gap: 8px; position: relative; }
.price-card.popular, .plan.popular { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-card h3, .plan .pname { margin: 0; font-size: 18px; }
.price-card .amt { font-size: clamp(28px, 4vw, 40px); font-weight: 750; letter-spacing: -.04em; line-height: 1.1; }
.price-card .amt span { font-size: .42em; font-weight: 550; color: var(--text-dim); letter-spacing: 0; }
.price-card p, .pquota { margin: 0; color: var(--text-dim); font-size: 14px; }
.price-card .cta { margin-top: auto; }
.pop-flag { display: inline-block; margin: 0 0 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: 2px 8px; font-weight: 650; width: fit-content; }
.feats { margin: 8px 0 0; padding: 0 0 0 1.1em; color: var(--text); font-size: 13.5px; }
.feats li { margin: 0 0 4px; }
.home-coins { margin: 16px 0 0; font-family: var(--mono); font-size: 12px; color: var(--text-dim); letter-spacing: .04em; }
.plan { position: relative; text-align: left; }
.plan .pquota { margin-top: 4px; }
.guest-limit-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0 16px; }
.guest-limit-row .field { min-width: 200px; flex: 1; }
.admin-plans, .admin-users { display: grid; gap: 14px; margin-top: 12px; }
.plan-admin { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; background: var(--bg); }
.plan-admin.popular { border-color: var(--accent); }
.feature-toggle { margin: 4px 0 10px; font-weight: 600; }
.user-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.user-table th, .user-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.user-table th { color: var(--text-dim); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 550; }
.hint { display: block; margin-top: 4px; font-size: 12px; color: var(--text-dim); }
.field .hint { font-weight: 400; }
