.install-page .site-header nav a{display:none}.install-shell{width:min(1040px,calc(100% - 32px));min-height:610px;margin:38px auto;display:grid;grid-template-columns:220px minmax(0,1fr);border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow);overflow:hidden}.install-shell.complete{display:block;min-height:0;max-width:760px;padding:46px}.step-list{background:#18221d;color:#eef5f0;padding:28px 24px}.step-list>div{display:grid;gap:6px}.step-list small{color:#a7b8ad}.step-list ol{margin:40px 0 0;padding:0;list-style:none;display:grid;gap:3px;counter-reset:steps}.step-list li{padding:11px 10px;color:#9fb1a6;border-left:2px solid transparent}.step-list li.active{color:#fff;border-left-color:#4fd1a1;background:#23352b}.install-form{min-width:0}.wizard-step{display:none;padding:44px 50px}.wizard-step.active{display:block}.wizard-step h1,.complete h1{font-size:31px;letter-spacing:0;margin:0 0 24px}.lead{color:var(--muted);line-height:1.7}.check-list{border-top:1px solid var(--line)}.check-list>div{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:10px;padding:13px 0;border-bottom:1px solid var(--line)}.check-list small{color:var(--muted)}.check-symbol{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent);font-size:12px}.check-symbol.bad{background:var(--danger-soft);color:var(--danger)}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.field-grid.three{grid-template-columns:repeat(3,1fr)}.field-grid .wide{grid-column:1/-1}.form-actions{display:flex;justify-content:space-between;gap:10px;margin-top:28px}.form-actions.end{justify-content:flex-end}.notice{padding:12px 14px;border-left:3px solid var(--accent);background:var(--accent-soft);margin:0 0 20px;line-height:1.6}.notice.warning{border-color:var(--warn);background:color-mix(in srgb,var(--warn) 12%,var(--surface))}.summary-list{border-top:1px solid var(--line)}.summary-list>div{display:flex;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--line)}.summary-list small{color:var(--muted)}.success-icon{width:48px;height:48px;display:grid;place-items:center;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-size:24px;margin-bottom:22px}.code-output{border:1px solid var(--line);border-radius:5px;overflow:hidden;margin:20px 0}.code-output>div{padding:9px 12px;display:flex;justify-content:space-between;background:var(--surface-2)}.code-output button{border:0;background:transparent;color:var(--accent);cursor:pointer}.code-output pre{margin:0;padding:14px;overflow:auto;background:#111612;color:#eaf0eb;font-size:12px}
:root {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --surface-2: #f6f6f5; --sidebar: #f8f8f7;
  --text: #242424; --muted: #767676; --line: #e9e9e7; --accent: #252525;
  --accent-strong: #111; --accent-soft: #ededeb; --on-accent: #fff;
  --danger: #b63d37; --danger-soft: #fcf0ef; --warn: #9a6700;
  --radius: 10px; --shadow: 0 18px 60px #00000016;
}
html[data-theme=dark] {
  color-scheme: dark;
  --bg: #212121; --surface: #252525; --surface-2: #2e2e2e; --sidebar: #191919;
  --text: #ececec; --muted: #a0a0a0; --line: #383838; --accent: #ececec;
  --accent-strong: #fff; --accent-soft: #333; --on-accent: #202020;
  --danger: #ee928b; --danger-soft: #402827; --warn: #d9b369; --shadow: 0 18px 60px #0005;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif; }
button,input,select,textarea { font: inherit; }
button,a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible,a:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }
.icon { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon-button,.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 8px; }
.icon-button { width: 36px; height: 36px; flex-shrink: 0; font-size: 22px; }
.icon-button:hover,.theme-toggle:hover { color: var(--text); background: var(--accent-soft); }
.button { min-height: 38px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.button:hover { background: var(--surface-2); border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { background: var(--surface-2); }
.button.compact { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.button.wide { width: 100%; }
.button.danger { color: var(--danger); }
.button.danger-solid { background: #b63d37; color: #fff; border-color: #b63d37; }
.button.danger-solid:hover { background: #99332e; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--text); font-size: 13px; }
input,select,textarea { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--surface); outline: none; }
input:focus,select:focus,textarea:focus { border-color: var(--muted); }
input::placeholder,textarea::placeholder { color: var(--muted); opacity: .8; }
label small { color: var(--muted); font-weight: 400; font-size: 12px; line-height: 1.6; }
.form-error { padding: 10px 12px; border-radius: 6px; color: var(--danger); background: var(--danger-soft); font-size: 13px; overflow-wrap: anywhere; }
.form-status { color: var(--muted); font-size: 13px; }
.error-text { color: var(--danger) !important; }
.muted { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { font-size: 16px; letter-spacing: -.4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header { height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header nav { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.site-header nav a:hover { color: var(--text); }
.page { min-height: calc(100dvh - 64px); }
.mobile-only { display: none; }

/* Conversation */
.chat-page .page { height: 100dvh; min-height: 0; overflow: hidden; }
.chat-app { height: 100%; display: grid; grid-template-columns: 248px minmax(0,1fr); }
.conversation-panel,.admin-sidebar { background: var(--sidebar); min-height: 0; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 76px; padding: 0 22px; flex-shrink: 0; }
.new-chat-button { margin: 4px 14px 20px; padding: 11px 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 9px; display: flex; align-items: center; gap: 10px; text-align: left; }
.new-chat-button:hover { background: var(--accent-soft); }
.sidebar-label { margin: 7px 24px 10px; color: var(--muted); font-size: 11px; }
.conversation-list { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 14px; }
.conversation-row { display: flex; align-items: center; border-radius: 7px; margin: 2px 0; }
.conversation-row:hover,.conversation-row.active { background: var(--accent-soft); }
.conversation-item { flex: 1; min-width: 0; padding: 11px 12px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: 13px; }
.conversation-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-delete { width: 32px; height: 32px; margin-right: 4px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 6px; color: var(--muted); background: transparent; opacity: 0; }
.conversation-delete .icon { width: 16px; height: 16px; }
.conversation-row:hover .conversation-delete,.conversation-row:focus-within .conversation-delete,.conversation-row.active .conversation-delete { opacity: 1; }
.conversation-delete:hover { background: var(--surface); color: var(--danger); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--line); }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.sidebar-link:hover,.sidebar-account:hover { background: var(--accent-soft); color: var(--text); }
.sidebar-account { padding: 11px 12px; display: flex; align-items: center; gap: 11px; border-radius: 7px; }
.account-avatar { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; }
.account-avatar .icon { width: 16px; height: 16px; }
.sidebar-account > span:last-child { flex: 1; min-width: 0; }
.sidebar-account b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 500; }
.sidebar-account small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.sidebar-account strong { font-weight: 400; }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.sidebar-bottom .theme-toggle { font-size: 11px; }
.sidebar-bottom .icon { width: 16px; height: 16px; }
.sidebar-bottom a { padding: 8px; color: var(--muted); border-radius: 7px; }
.sidebar-bottom a:hover { background: var(--accent-soft); }
.chat-workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: 70px minmax(0,1fr) auto; }
.chat-title { display: flex; align-items: center; gap: 12px; padding: 0 28px; }
.model-picker { max-width: min(300px,65%); }
.model-picker select { padding: 7px 28px 7px 0; border: 0; background-color: transparent; font-weight: 600; font-size: 16px; cursor: pointer; }
.model-picker select:disabled { opacity: 1; color: var(--text); cursor: default; }
.chat-storage { white-space: nowrap; color: var(--muted); font-size: 11px; margin-left: auto; }
[data-chat-count] { float: right; font-size: 10px; }
.file-download { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 420px; padding: 13px 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.file-download:hover { background: var(--surface-2); }
.file-download > span:first-child { min-width: 0; }
.file-download b { display: block; overflow-wrap: anywhere; font-weight: 500; }
.file-download small { display: block; color: var(--muted); margin-top: 4px; }
.chat-current-title { margin-left: auto; color: var(--muted); font-size: 12px; max-width: 32%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-feed { min-height: 0; overflow-y: auto; padding: 24px max(28px,calc((100% - 780px)/2)); scrollbar-gutter: stable; overscroll-behavior: contain; }
.empty-state { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding-bottom: 8vh; text-align: center; }
.empty-state h1 { margin: 0 0 13px; font-size: 29px; letter-spacing: -1px; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.message { margin: 0 0 34px; display: flex; gap: 12px; align-items: flex-start; }
.message-avatar { flex-shrink: 0; display: grid; place-items: center; width: 25px; height: 25px; margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 500; }
.message-body { min-width: 0; max-width: 100%; overflow-wrap: anywhere; font-size: 15px; line-height: 1.85; }
.message.user { justify-content: flex-end; margin-top: 14px; }
.message.user .message-body { max-width: 85%; padding: 11px 18px; background: var(--surface-2); border-radius: 18px; }
.message.assistant .message-body { flex: 1; }
.message-body p { margin: 0 0 12px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body code:not(pre code) { background: var(--accent-soft); border-radius: 4px; padding: 2px 5px; font-size: .9em; font-family: Consolas,monospace; }
.code-block { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 14px 0; background: var(--surface-2); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.code-copy { border: 0; padding: 3px 5px; background: transparent; color: var(--muted); font-size: 11px; }
.code-block pre { margin: 0; padding: 16px; overflow: auto; }
.code-block code { font: 13px/1.65 Consolas,"SFMono-Regular",monospace; white-space: pre; }
/* A quiet status beside ai, only for the current assistant message. */
.message.assistant { display:block; }
.message-heading { display:flex; align-items:center; gap:10px; min-height:28px; margin-bottom:6px; }
.message-heading .message-avatar { display:block; width:auto; height:auto; margin:0; color:var(--text); }
.reply-status { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; }
.reply-status[hidden] { display:none; }
.reply-status i { width:10px; height:10px; border:1.5px solid var(--line); border-top-color:var(--muted); border-radius:50%; }
.reply-status.waiting i { animation:reply-spin 1s linear infinite; }
@keyframes reply-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .reply-status.waiting i { animation:none; } }
.composer-dock { width: min(780px,calc(100% - 56px)); margin: 0 auto; padding-bottom: max(10px,env(safe-area-inset-bottom)); }
.chat-feedback { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; margin: 0 5px 7px; }
.chat-feedback > span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.composer { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 12px 12px 10px; box-shadow: 0 2px 8px #00000004; }
.composer:focus-within { border-color: color-mix(in srgb,var(--muted) 50%,var(--line)); }
.composer textarea { display: block; padding: 4px 6px 12px; min-height: 42px; max-height: 180px; resize: none; line-height: 1.6; border: 0; border-radius: 0; background: transparent; font-size: 15px; }
.composer-toolbar { display: flex; align-items: center; gap: 6px; }
.composer-toolbar small { color: var(--muted); font-size: 11px; }
.send-button { margin-left: auto; background: var(--accent); color: var(--on-accent); border-radius: 50%; }
.send-button:hover { color: var(--on-accent); background: var(--accent-strong); }
.registration-note,.model-price-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-list:empty { display: none; }
.attachment-chip { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 0 0 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 12px; }
.attachment-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip small { display: block; color: var(--muted); font-size: 10px; }
.attachment-chip button { background: transparent; border: 0; color: var(--muted); font-size: 18px; }

/* Management */
.admin-page { background: var(--surface-2); }
.admin-page .page { min-height: 100dvh; }
.admin-shell { display: grid; grid-template-columns: 224px minmax(0,1fr); min-height: 100dvh; }
.admin-sidebar { height: 100dvh; position: sticky; top: 0; border-right: 1px solid var(--line); }
.admin-sidebar .sidebar-footer { margin-top: auto; }
.admin-nav { padding: 0 12px; display: grid; gap: 5px; }
.admin-nav button { padding: 11px 13px; display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; text-align: left; }
.admin-nav button:hover,.admin-nav button.active { color: var(--text); background: var(--accent-soft); }
.admin-nav button.active { font-weight: 600; }
.admin-nav .icon { width: 18px; height: 18px; }
.admin-workspace { min-width: 0; }
.admin-topbar { height: 64px; padding: 0 36px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--muted); font-size: 12px; }
.admin-topbar b { color: var(--text); font-weight: 500; }
.breadcrumb-separator { margin: 0 12px; opacity: .5; }
.admin-topbar > a { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.admin-topbar .icon { width: 16px; height: 16px; }
.admin-content { max-width: 1440px; margin: 0 auto; padding: 36px; }
.admin-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.admin-page-heading h1 { font-size: 25px; line-height: 1.4; font-weight: 600; margin: 0; letter-spacing: -.5px; }
.admin-page-heading p { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
[data-admin-error] { margin-bottom: 20px; }
.tab-pane { display: none; }.tab-pane.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 28px; }
.metric { padding: 23px; min-width: 0; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.metric > b { font-size: 25px; line-height: 1.3; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.metric > small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.admin-section { margin-top: 32px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { font-size: 15px; font-weight: 600; margin: 0; }
.section-heading > span { font-size: 12px; color: var(--muted); }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
th,td { padding: 16px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
th { background: var(--sidebar); color: var(--muted); font-weight: 500; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
td b { font-weight: 500; }
td code { font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb,var(--surface-2) 50%,var(--surface)); }
td .muted { display: inline-block; margin-top: 4px; font-size: 11px; }
.empty-row { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.status-pill { display: inline-flex; padding: 3px 8px; border-radius: 5px; background: var(--accent-soft); font-size: 11px; color: var(--text); white-space: nowrap; }
.status-pill.off { color: var(--muted); }
.status-pill.error { background: var(--danger-soft); color: var(--danger); }
.price-summary { display: grid; grid-template-columns: repeat(2,minmax(70px,1fr)); gap: 5px 12px; font-size: 11px; color: var(--muted); }
.gateway-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gateway-item { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; padding: 22px; border-bottom: 1px solid var(--line); font-size: 12px; }
.gateway-item:last-child { border-bottom: 0; }
.gateway-item small { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.gateway-item b { font-weight: 500; }
.settings-form { max-width: 1000px; }
.settings-section { display: grid; grid-template-columns: minmax(150px,.75fr) minmax(0,1.5fr); gap: 32px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.settings-intro h2 { margin: 0; font-size: 15px; font-weight: 600; }
.settings-intro p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 8px 0 0; }
.settings-fields { display: grid; align-content: start; gap: 20px; min-width: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.settings-grid .wide { grid-column: 1/-1; }
.settings-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.payment-channel-summary { display: flex; gap: 10px; }
.payment-channel-summary span { border: 1px solid var(--line); background: var(--surface-2); padding: 7px 12px; border-radius: 6px; font-size: 12px; }

/* Account and shared forms */
.content-shell { width: min(1060px,calc(100% - 64px)); margin: 0 auto 60px; }
.section-title { padding: 38px 0 30px; }.section-title h1 { font-size: 27px; font-weight: 600; margin: 0; }
.section-title p { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.plain-section { padding: 28px 0; border-top: 1px solid var(--line); }
.plain-section.narrow { max-width: 760px; }
.token-grid { grid-template-columns: repeat(5,minmax(0,1fr)); background: var(--surface-2); }
.token-grid .metric { padding: 18px; }.token-grid .metric b { font-size: 20px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 16px; }
.inline-form .form-status { grid-column: 1/-1; }
.money.plus { color: var(--text); }.money.minus { color: var(--danger); }
.recharge-form { display: grid; grid-template-columns: 220px minmax(250px,1fr) auto; gap: 20px; align-items: end; }
.recharge-form .form-status { grid-column: 1/-1; }
.payment-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.payment-choices legend { padding: 0; margin-bottom: 8px; font-size: 13px; }
.payment-options { display: flex; gap: 10px; }
.payment-choice { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 9px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; flex: 1; white-space: nowrap; }
.payment-choice:has(input:checked) { background: var(--surface-2); border-color: var(--text); }
.payment-choice input { width: 14px; height: 14px; margin: 0; accent-color: var(--text); }
.auth-shell { width: min(860px,calc(100% - 40px)); min-height: calc(100dvh - 64px); margin: auto; display: grid; grid-template-columns: 1fr 360px; align-items: center; gap: 80px; padding: 32px 0; }
.auth-copy h1 { font-size: 36px; line-height: 1.25; font-weight: 500; margin: 0 0 16px; }
.auth-copy > p:last-child { color: var(--muted); line-height: 1.8; }
.auth-form { background: var(--surface); padding: 26px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 18px; }
.auth-link { text-align: center; color: var(--muted); font-size: 13px; }
dialog { width: min(460px,calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: #0006; }
.dialog-form { padding: 24px; display: grid; gap: 18px; }
.dialog-form header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-form h2 { margin: 0; font-size: 19px; font-weight: 600; }
.dialog-description { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.delete-chat-name { margin: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
dialog:has(.model-form) { width: min(620px,calc(100% - 32px)); }
.model-form { grid-template-columns: 1fr 1fr; }.model-form header,.model-form .span-2 { grid-column: 1/-1; }
.check-row { flex-direction: row; align-items: center; gap: 10px; }.check-row input { width: auto; }
.sidebar-scrim { display: none; }

@media(max-width:1100px) {
  .admin-content { padding: 28px; }.admin-shell { grid-template-columns: 205px minmax(0,1fr); }
  .metric { padding: 18px; }.metric > b { font-size: 22px; }
  .settings-section { gap: 24px; padding: 22px; grid-template-columns: 150px minmax(0,1fr); }
  .settings-fields.settings-grid { grid-template-columns: 1fr; }
}
@media(max-width:800px) {
  .mobile-only { display: inline-flex; }
  .site-header { padding: 0 18px; }.site-header nav { gap: 12px; }.site-header .brand b { max-width: 120px; }
  .chat-app,.admin-shell { grid-template-columns: minmax(0,1fr); }
  .conversation-panel,.admin-sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px,85vw); height: 100dvh; z-index: 40; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar-open .conversation-panel,.sidebar-open .admin-sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; border: 0; background: #0005; z-index: 35; }
  .panel-head { height: 68px; padding: 0 18px; }
  .conversation-delete { opacity: 1; }
  .chat-workspace { grid-template-rows: 60px minmax(0,1fr) auto; }
  .chat-title { padding: 0 12px; gap: 9px; }.chat-title > [data-new-chat] { margin-left: auto; }
  .chat-current-title { display: none; }.model-picker { max-width: calc(100% - 96px); }.model-picker select { font-size: 14px; }
  .message-feed { padding: 20px 18px; }.message { gap: 9px; }.message-body { font-size: 14px; }
  .message.user .message-body { padding: 10px 14px; max-width: 90%; }
  .empty-state h1 { font-size: 25px; }.empty-state { padding-bottom: 5vh; }
  .composer-dock { width: calc(100% - 24px); }.composer { border-radius: 17px; }
  .composer textarea { font-size: 16px; }
  .admin-topbar { padding: 0 18px; height: 60px; }.admin-content { padding: 26px 18px; }
  .admin-page-heading { margin-bottom: 24px; }.admin-page-heading h1 { font-size: 23px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric:nth-child(2n) { border-right: 0; }.metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .settings-section { grid-template-columns: 1fr; gap: 22px; padding: 22px; }
  .settings-fields.settings-grid { grid-template-columns: 1fr 1fr; }
  .gateway-item { grid-template-columns: 1fr; gap: 14px; }
  .content-shell { width: calc(100% - 36px); }.section-title { padding-top: 28px; }
  .token-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }.token-grid .metric:last-child { grid-column: 1/-1; }
  .recharge-form { grid-template-columns: 1fr; gap: 18px; }
  .inline-form { grid-template-columns: 1fr; }
  table:has(tbody > tr:only-child > td.empty-row) { min-width: 0; }
  table:has(tbody > tr:only-child > td.empty-row) thead { display: none; }
  .auth-shell { grid-template-columns: 1fr; gap: 24px; max-width: 400px; align-content: center; }.auth-copy h1 { font-size: 28px; }.auth-copy > p:last-child { display: none; }
  .model-form { grid-template-columns: 1fr; }.model-form header,.model-form .span-2 { grid-column: 1; }
  .install-shell { grid-template-columns: 1fr !important; }.step-list { padding: 18px !important; }.step-list ol { margin-top: 18px !important; display: flex !important; flex-wrap: wrap; }.wizard-step { padding: 26px 20px !important; }
  .field-grid,.field-grid.three { grid-template-columns: 1fr !important; }
}
@media(max-width:420px) {
  .settings-grid,.settings-fields.settings-grid { grid-template-columns: 1fr; }.settings-section { padding: 18px; }
  .admin-topbar > a { font-size: 11px; }.admin-page-heading p { max-width: 210px; }
  .section-heading { flex-wrap: wrap; }.settings-actions { align-items: flex-start; flex-direction: column; }
  .site-header nav { gap: 9px; }.site-header nav a { font-size: 12px; }.site-header .brand b { max-width: 90px; }
  .metric { padding: 17px; }.metric > b { font-size: 21px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* v6: editable site content and focused management forms. */
.plain-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.plain-content:empty, .empty-state h1:empty, .auth-copy h1:empty { display: none; }
.auth-copy > p.plain-content:not(:empty) { display: block; }
.settings-fields textarea, .dialog-form textarea { width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; line-height: 1.65; resize: vertical; }
.document-dialog { width: min(760px, calc(100vw - 32px)); }
.info-shell { max-width: 820px; margin: 36px auto 80px; padding: 0 24px; line-height: 1.8; }
.info-shell h1 { font-size: 30px; margin: 24px 0; }
.info-shell h2 { font-size: 18px; margin-bottom: 12px; }
.info-shell article { padding: 20px 0; border-bottom: 1px solid var(--line); }
.info-shell .plain-content { margin-bottom: 24px; }
.info-nav, .info-documents { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.info-documents { flex-direction: column; padding: 20px 0; }
[data-order-filters] { display: grid; gap: 14px; }
[data-order-filters][hidden] { display: none; }
.button.danger { color: var(--danger); }
@media (max-width: 600px) { .info-shell { margin-top: 16px; padding: 0 16px; } .site-header { gap: 10px; flex-wrap: wrap; } .site-header nav { gap: 12px; flex-wrap: wrap; } }

/* Timing only: no internal reasoning or phase timeline. */
.task-timing { color:var(--muted); font-size:12px; margin:0 4px 12px; font-variant-numeric:tabular-nums; }
.task-timing[hidden] { display:none; }
.task-timing-summary { display:flex; gap:10px; align-items:center; padding:4px 0; }
.task-timing-summary > :first-child { color:var(--text); }
.task-timing-dates { display:flex; gap:6px 20px; flex-wrap:wrap; font-size:11px; }
.task-timing-dates > span { white-space:nowrap; }
.upload-progress { font-size:12px; margin:0 0 12px; border:1px solid var(--line); border-radius:9px; padding:10px 12px; }
.upload-progress > div { display:flex; justify-content:space-between; gap:12px; }
[data-upload-name] { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
[data-upload-percent] { flex-shrink:0; font-variant-numeric:tabular-nums; }
.upload-progress progress { display:block; width:100%; height:6px; margin:9px 0; accent-color:var(--text); }
.upload-progress p { margin:0; color:var(--muted); overflow-wrap:anywhere; }
.upload-progress[data-failed="true"] p { color:var(--danger); }
.chat-feedback { gap:10px; }
.chat-feedback > span { overflow-wrap:anywhere; min-width:0; }
