:root {
  --brand: #6d5ef5; --brand-hover: #5b4be6; --brand-soft: rgba(109, 94, 245, .12);
  --bg: #ffffff; --surface: #f7f7f9; --surface-2: #efeff3; --border: #e5e5ec; --text: #17171f; --muted: #6b6b7b;
  --danger: #d93f3f; --danger-soft: rgba(217, 63, 63, .1); --ok: #1f9d63; --ok-soft: rgba(31, 157, 99, .12); --warn: #c77c0a; --warn-soft: rgba(199, 124, 10, .12);
  --code-bg: #0f1117; --shadow: 0 8px 30px rgba(20, 20, 40, .12); --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111116; --surface: #18181f; --surface-2: #20202a; --border: #2b2b37; --text: #ececf2; --muted: #9b9bad;
    --brand-soft: rgba(139, 127, 249, .18); --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111116; --surface: #18181f; --surface-2: #20202a; --border: #2b2b37; --text: #ececf2; --muted: #9b9bad;
  --brand-soft: rgba(139, 127, 249, .18); --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); cursor: pointer; font-weight: 500; font-size: .92rem; white-space: nowrap; transition: background .15s, border-color .15s; color: var(--text); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-fill:hover { background: #bf3030; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg, .btn svg, .nav-item svg { width: 18px; height: 18px; flex: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.soft { background: var(--surface); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot .logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }

/* Auth pages */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin-top: 18px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.auth-brand:hover { text-decoration: none; }
.auth-footer { text-align: center; font-size: .88rem; color: var(--muted); margin: 16px 0 0; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
.form-ok { background: var(--ok-soft); color: var(--ok); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }

/* Landing */
.land-body { background: var(--bg); }
.land-head, .land-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px clamp(16px, 4vw, 48px); gap: 12px; }
.land-head nav { display: flex; gap: 8px; }
.land { max-width: 1080px; margin: 0 auto; padding: 0 16px 60px; }
.hero { text-align: center; padding: clamp(40px, 9vw, 110px) 0 50px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); max-width: 820px; margin: 0 auto 16px; letter-spacing: -.03em; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.feature { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.feature p { margin: 0; color: var(--muted); }
.land-foot { color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); }

/* App shell */
.app-body { overflow: hidden; }
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 16px; }
.side-top .auth-brand { font-size: 1rem; }
.auth-brand span:first-child { display: inline-flex; }
.new-chat { margin: 4px 12px 10px; }
.nav { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); font-size: .92rem; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: .75rem; color: var(--muted); }
.side-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 18px 6px; font-weight: 600; }
.side-scroll { flex: 1; overflow-y: auto; padding-bottom: 8px; min-height: 0; }
.chat-link { display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin: 0 8px; border-radius: 8px; color: var(--text); font-size: .88rem; }
.chat-link span.t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-link:hover { background: var(--surface-2); text-decoration: none; }
.chat-link.active { background: var(--surface-2); font-weight: 600; }
.chat-link .pin { color: var(--brand); width: 12px; height: 12px; }
.side-foot { border-top: 1px solid var(--border); padding: 10px 12px; }
.credit-meter { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.meter { height: 6px; background: var(--surface-2); border-radius: 9px; overflow: hidden; margin-top: 5px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.meter.low > i { background: var(--warn); }
.meter.out > i { background: var(--danger); }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.user-btn .who { flex: 1; min-width: 0; font-size: .88rem; }
.user-btn .who b, .user-btn .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); min-height: 52px; }
.topbar .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }
.view { flex: 1; overflow-y: auto; min-height: 0; }
.page { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 39; }
  .topbar .menu-btn { display: inline-grid; }
  .page { padding: 18px 16px 50px; }
}

/* Chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.thread { flex: 1; overflow-y: auto; min-height: 0; }
.thread-inner { max-width: 820px; margin: 0 auto; padding: 24px 20px 12px; }
.msg { margin-bottom: 22px; }
.msg-role { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg.user .bubble { background: var(--surface-2); border-radius: 16px; padding: 10px 14px; display: inline-block; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { text-align: right; }
.msg.user .msg-role { justify-content: flex-end; }
.msg.user .bubble { text-align: left; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.last .msg-actions { opacity: 1; }
.msg.user .msg-actions { justify-content: flex-end; }
.msg-actions .icon-btn { width: 28px; height: 28px; }
.msg-actions .icon-btn svg { width: 15px; height: 15px; }
.msg-meta { font-size: .75rem; color: var(--muted); align-self: center; margin-left: 6px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: .8rem; max-width: 240px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; font-size: 1rem; }
.chip.uploading { opacity: .6; }
.status-line { color: var(--muted); font-size: .85rem; font-style: italic; margin: 6px 0; }
.typing::after { content: '▍'; animation: blink 1s steps(2) infinite; color: var(--brand); }
@keyframes blink { 50% { opacity: 0; } }
.notice { border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: .92rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--brand-soft); color: var(--text); }
.notice .btn { margin-top: 8px; }

.composer-wrap { padding: 0 16px 16px; }
.composer { max-width: 820px; margin: 0 auto; border: 1px solid var(--border); border-radius: 18px; background: var(--bg); box-shadow: 0 2px 12px rgba(0, 0, 0, .04); padding: 8px; transition: border-color .15s; }
.composer:focus-within { border-color: var(--brand); }
.composer.drag { border-color: var(--brand); background: var(--brand-soft); }
.composer textarea { border: 0; box-shadow: none !important; resize: none; min-height: 44px; max-height: 260px; padding: 8px 10px; background: transparent; }
.composer .files { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px; }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.composer-bar select { width: auto; max-width: 210px; padding: 5px 8px; font-size: .85rem; border-radius: 8px; background: var(--surface); }
.composer-bar .spacer { flex: 1; }
.send-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-btn.stop { background: var(--text); color: var(--bg); }
.composer-hint { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.welcome { text-align: center; padding: 8vh 16px 20px; }
.welcome h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; max-width: 760px; margin: 22px auto 0; }
.suggestion { text-align: left; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); cursor: pointer; font-size: .9rem; }
.suggestion:hover { border-color: var(--brand); }
.suggestion b { display: block; margin-bottom: 2px; }

/* Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md table, .md blockquote, .md pre { margin: 0 0 .9em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li + li { margin-top: .25em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 .5em; }
.md code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: .12em .38em; border-radius: 5px; }
.md pre { position: relative; background: var(--code-bg); color: #e6e6ef; border-radius: 12px; overflow: hidden; }
.md pre code { display: block; padding: 14px 16px; overflow-x: auto; background: none; font-size: .85rem; line-height: 1.55; color: inherit; }
.md pre .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 16px; font: .75rem var(--mono); color: #9da0b3; background: rgba(255, 255, 255, .05); }
.md pre .code-head button { background: none; border: 0; color: #c9cbe0; cursor: pointer; font: inherit; padding: 3px 6px; border-radius: 6px; }
.md pre .code-head button:hover { background: rgba(255, 255, 255, .1); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface); }
.md blockquote { border-left: 3px solid var(--brand); padding-left: 12px; color: var(--muted); }
.md img { max-width: 100%; border-radius: 8px; }
.md .mermaid { background: #fff; border-radius: 12px; padding: 12px; overflow-x: auto; margin-bottom: .9em; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }

/* Lists, tables, modals */
.list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b, .list-row .grow .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: .82rem; color: var(--muted); }
.list-row.link { cursor: pointer; }
.list-row.link:hover { background: var(--surface); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; background: var(--bg); display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.tile:hover { border-color: var(--brand); }
.tile p { margin: 0; color: var(--muted); font-size: .88rem; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 9px 12px; border-top: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th { border-top: 0; background: var(--surface); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data tr.link { cursor: pointer; }
table.data tr.link:hover td { background: var(--surface); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: .82rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bars > div { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; position: relative; }
.bars > div:hover { opacity: 1; }

.modal-back { position: fixed; inset: 0; background: rgba(10, 10, 20, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
.modal { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
.menu { position: fixed; z-index: 110; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 5px; min-width: 190px; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: .9rem; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); animation: fade .15s; max-width: min(92vw, 480px); }
.toast.error { background: var(--danger); color: #fff; }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 120; background: rgba(10, 10, 20, .4); display: flex; justify-content: center; padding: 12vh 16px 16px; }
.palette-box { width: 100%; max-width: 620px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; align-self: flex-start; }
.palette input { border: 0 !important; box-shadow: none !important; border-bottom: 1px solid var(--border) !important; border-radius: 0; padding: 16px 18px; font-size: 1rem; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: .92rem; }
.palette-item .k { margin-left: auto; font-size: .75rem; color: var(--muted); }
.palette-item.sel { background: var(--brand-soft); }
.palette-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; font-weight: 600; }
kbd { font: .75rem var(--mono); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--surface); }

.font-sm { font-size: 14px; }
.font-lg { font-size: 16.5px; }

/* Share page */
.share-body { background: var(--bg); }
.share-head { display: flex; justify-content: space-between; align-items: center; padding: 14px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.share { max-width: 820px; margin: 0 auto; padding: 28px 16px 60px; }
.share .msg.user .md { background: var(--surface-2); border-radius: 16px; padding: 10px 14px; display: inline-block; text-align: left; white-space: pre-wrap; }

/* Admin */
.admin-body .shell { grid-template-columns: 240px 1fr; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.secret { font: .95rem var(--mono); letter-spacing: .1em; background: var(--surface-2); padding: 8px 12px; border-radius: 8px; display: inline-block; user-select: all; overflow-wrap: anywhere; }

/* Invoice & billing */
.invoice-body { background: var(--surface); }
.invoice { max-width: 780px; margin: 24px auto; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
@media print { .invoice-body { background: #fff; } .invoice { border: 0; margin: 0; } [data-print] { display: none; } }
.cycle-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.cycle-toggle button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.cycle-toggle button.on { background: var(--brand); color: #fff; }
.price { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.price small { font-size: .85rem; color: var(--muted); font-weight: 500; }
