/* Ablitron settings view. Values follow the Paper file "Ablitron · Website"
   (Settings · General / API keys & Guardrails / Billing / Usage / Privacy & data, Create API key). */
:root{--well:#070f10;--tint:#ffffff0a;--tint-2:#ffffff14;--line-soft:#ffffff0f;--line-card:#ffffff14;--danger:#e8b44a;--avatar:#11706b;--seg-on:#22d3c524}

/* ---- Light theme (Settings · General → Theme). Redefines the shared tokens and the
   few fixed dark tints of chat.css; there is no light artboard, so it mirrors the dark one. ---- */
:root[data-theme=light]{--bg:#f6f8f8;--side:#eef3f3;--surface:#ffffff;--line:#0b2b2a1a;--line-strong:#0b2b2a29;--ink:#0c1717;--body:#0c1717e0;--soft:#0c1717c2;
  --muted:#566766;--faint:#768685;--accent:#13b3a6;--bright:#0b8a80;--on-accent:#ffffff;--code:#0c1717;
  --well:#f1f5f5;--tint:#0b2b2a0a;--tint-2:#0b2b2a12;--line-soft:#0b2b2a12;--line-card:#0b2b2a1a;--danger:#a86a00;--seg-on:#13b3a61f;color-scheme:light}
:root[data-theme=light] .sidebar{border-right-color:var(--line)}
:root[data-theme=light] .sb-item:hover,:root[data-theme=light] .sb-item[aria-current=true]{background:var(--tint-2)}
:root[data-theme=light] .sb-item[aria-current=true]>button:first-child{color:var(--ink)}
:root[data-theme=light] .sb-search input::placeholder,:root[data-theme=light] .composer textarea::placeholder{color:#0c171773}
:root[data-theme=light] .sb-new kbd{color:#e6fffc}
:root[data-theme=light] .sb-bar,:root[data-theme=light] .sb-delete:hover{background:var(--tint-2)}
:root[data-theme=light] .sb-account:hover,:root[data-theme=light] .icon-button:hover{background:var(--tint)}
:root[data-theme=light] .sb-avatar{color:#fff}
:root[data-theme=light] .model-pill,:root[data-theme=light] .suggestions button{background:var(--surface)}
:root[data-theme=light] .suggestions button:hover{background:var(--well);border-color:var(--line-strong)}
:root[data-theme=light] .glow{background:#13b3a61f}
:root[data-theme=light] .empty .composer{box-shadow:0 20px 60px #0b2b2a1a}
:root[data-theme=light] .msg-user .bubble,:root[data-theme=light] .md :not(pre)>code{background:var(--tint-2)}
:root[data-theme=light] .code-head{border-bottom-color:var(--line-soft)}
:root[data-theme=light] .toast{background:var(--surface);box-shadow:0 12px 40px #0b2b2a29}
:root[data-theme=light] .overlay{background:#0c171766}
:root[data-theme=light] .modal{border-color:var(--line);box-shadow:0 40px 100px #0b2b2a33}
:root[data-theme=light] .plan-card{border-color:var(--line)}
:root[data-theme=light] .plan-card[aria-pressed=true]{background:#e3f7f5;background-image:none;border-color:var(--accent)}
:root[data-theme=light] .plan-card[aria-pressed=true] .plan-price span,:root[data-theme=light] .plan-card[aria-pressed=true] p{color:var(--soft)}
:root[data-theme=light] .chat-top,:root[data-theme=light] .dock{border-color:var(--line-soft)}
:root[data-theme=light] .bot-mark{border-color:#0b8a8059}
:root[data-theme=light] .sb-plan-action{border-color:#0b8a8059}

/* ---- Layout ---- */
.settings-main{position:relative;flex:1;min-width:0;display:flex;flex-direction:column;gap:28px;padding:32px 48px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--tint-2) transparent;font-size:12px;line-height:16px}
.st-head{display:flex;flex-direction:column;gap:18px}
.st-title-row{display:flex;align-items:center;gap:8px}
.st-head h1{margin:0;font-size:30px;line-height:36px;font-weight:500;letter-spacing:-.03em}
.st-tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
.st-tabs::-webkit-scrollbar{display:none}
.st-tabs a{flex-shrink:0;padding:10px 14px;margin-bottom:-1px;border-bottom:2px solid transparent;color:var(--muted);font-size:14px;line-height:18px;text-decoration:none;white-space:nowrap}
.st-tabs a:hover{color:var(--ink)}
.st-tabs a[aria-current=page]{color:var(--ink);font-weight:500;border-bottom-color:var(--accent)}
.st-body{display:flex;flex-direction:column}
.st-panel{display:flex;gap:24px;align-items:flex-start}
.st-panel[hidden]{display:none}
.st-col{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:16px}
.st-side{flex-shrink:0;width:400px}
.st-stack{display:flex;flex-direction:column;gap:16px}
[data-panel=general] .st-side{width:440px}

/* ---- Cards, rows and controls ---- */
.st-card{display:flex;flex-direction:column;gap:18px;padding:22px;border:1px solid var(--line-card);border-radius:18px;background:var(--surface)}
.keys-code{align-items:flex-start;gap:14px;border-color:#22d3c54d}
.keys-code[hidden]{display:none}
.keys-code-text{display:flex;flex-direction:column;gap:4px;min-width:0}
.keys-code-text strong{font-size:15px;line-height:18px;font-weight:600}
.keys-code-text span{color:var(--muted);font-size:13px;line-height:18px}
.st-card-title{margin:0;font-size:15px;line-height:18px;font-weight:600;color:var(--ink)}
.st-card-head{display:flex;flex-direction:column;gap:4px}
.st-card-head p{margin:0;color:var(--muted);font-size:13px;line-height:19px}
.st-card-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:auto}
.st-list{gap:0;padding:6px 22px}
.st-list-title{padding:16px 0 10px}
.st-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-top:1px solid var(--line-soft)}
.st-row-text{display:flex;flex-direction:column;gap:3px;min-width:0}
.st-row-text strong{font-size:13px;line-height:16px;font-weight:400;color:var(--ink)}
.st-row-text span{color:var(--muted);font-size:12px;line-height:16px}
.st-row-actions{display:flex;gap:8px;flex-shrink:0}
.st-btn{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:8px 14px;border:1px solid var(--line-strong);border-radius:10px;color:var(--ink);font-size:13px;font-weight:500;line-height:16px;text-decoration:none;white-space:nowrap;transition:background .15s,border-color .15s}
.st-btn:hover:not(:disabled){background:var(--tint)}
.st-btn:disabled{opacity:.45;cursor:not-allowed}
.st-btn-accent{border-color:transparent;background:var(--accent);color:var(--on-accent);font-weight:600}
.st-btn-accent:hover:not(:disabled){background:var(--bright)}
.st-pill{border-radius:100px;padding:10px 18px;font-size:14px;line-height:18px}
.keys-head .st-pill{padding:8px 14px;font-size:13px;line-height:16px}
.st-btn-danger{border-color:#e8b44a66;color:var(--danger)}
.st-btn-danger:hover{background:#e8b44a14!important}
.link-btn{padding:0;color:var(--bright);font-size:13px;font-weight:500;line-height:16px;text-decoration:none;white-space:nowrap}
.link-btn:hover:not(:disabled){text-decoration:underline}
.link-btn.quiet{color:var(--muted);font-size:12px;font-weight:400}
.link-btn.quiet:hover{color:var(--ink)}
.muted-link{align-self:flex-start;margin-top:auto;color:var(--muted)}
.muted-link:hover{color:var(--ink)}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.mono-faint{color:var(--faint);font:11px/14px var(--mono)}
.faint{margin:0;color:var(--faint);font-size:12px;line-height:16px}
.body-muted{margin:0;color:var(--muted);font-size:13px;line-height:19px}
.body-muted a{color:var(--bright)}
.st-empty{margin:0;padding:16px;border:1px dashed var(--line-strong);border-radius:14px;color:var(--muted);font-size:13px;line-height:19px}
.st-input{width:100%;padding:11px 14px;border:1px solid var(--line-strong);border-radius:12px;background:var(--well);color:var(--ink);font-size:14px;line-height:18px;outline:0}
.st-input:focus{border-color:#5cefe080}
.field{display:flex;flex-direction:column;gap:8px}
.pw-form{display:flex;flex-direction:column;gap:12px}
.kl-box{display:flex;flex-direction:column;gap:12px;margin:16px 0 0;padding:16px 22px 4px;border-top:1px solid var(--line-soft)}
.kl-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.kl-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
@media (max-width:640px){.kl-grid{grid-template-columns:1fr}}
.pw-check{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:13px;line-height:18px}
.field>span{color:var(--muted);font-size:12px;font-weight:500;line-height:16px}
.field textarea{width:100%;min-height:84px;padding:14px;border:1px solid #ffffff1a;border-radius:12px;background:var(--well);color:var(--ink);font-size:13px;line-height:20px;resize:vertical;outline:0}
:root[data-theme=light] .field textarea{border-color:var(--line)}
.field textarea:focus{border-color:#5cefe080}
#ins-style{min-height:110px}
.seg{display:flex;flex-shrink:0;padding:3px;border:1px solid var(--line);border-radius:10px;background:var(--well)}
.seg button{padding:6px 12px;border-radius:7px;color:var(--muted);font-size:12px;line-height:16px;white-space:nowrap}
.seg button:hover{color:var(--ink)}
.seg button[aria-checked=true]{background:var(--seg-on);color:var(--bright);font-weight:500}
.chart-head .seg button{padding:5px 10px}
.switch{position:relative;flex-shrink:0;width:36px;height:20px;padding:2px;border-radius:10px;background:var(--tint-2);transition:background .15s}
.switch::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:8px;background:#ffffff8c;transition:transform .15s,background .15s}
:root[data-theme=light] .switch::after{background:#fff;box-shadow:0 1px 3px #0b2b2a40}
.switch[aria-checked=true]{background:var(--accent)}
.switch[aria-checked=true]::after{transform:translateX(16px);background:#04201e}
:root[data-theme=light] .switch[aria-checked=true]::after{background:#fff}
.st-banner{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border:1px solid #e8b44a4d;border-radius:14px;background:#e8b44a12}
.st-banner p{margin:0;color:var(--ink);font-size:13px;line-height:19px}
.st-banner[hidden]{display:none}

/* ---- General ---- */
.profile{display:flex;align-items:center;gap:14px}
.profile-avatar{display:flex;align-items:center;justify-content:center;width:52px;height:52px;flex-shrink:0;border-radius:26px;background:var(--avatar);color:#f2f5f5;font-size:20px;font-weight:600;line-height:24px}
.profile-text{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:3px}
.profile-text strong{font-size:14px;line-height:18px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-text strong.placeholder{color:var(--muted);font-weight:400}
.profile-text span{color:var(--muted);font-size:13px;line-height:16px;overflow-wrap:anywhere}
.profile-form{display:flex;gap:8px}
.profile-form[hidden]{display:none}
.signin{display:flex;flex-direction:column;gap:2px}
.signin:empty{display:none}
.signin-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid var(--line-soft);font-size:13px;line-height:16px}
.signin-on{color:var(--muted);font-size:12px}
.instructions{gap:16px}
.instructions .st-card-foot{margin-top:4px}

/* ---- API keys ---- */
[data-panel=api-keys] .keys-col{display:flex;flex-direction:column;gap:12px;width:420px;flex-shrink:0}
.keys-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.keys-head h2{margin:0;font-size:16px;line-height:20px;font-weight:500}
.key-list{display:flex;flex-direction:column;gap:12px}
.key-card{display:flex;flex-direction:column;gap:6px;padding:16px;border:1px solid var(--line-card);border-radius:14px;background:var(--surface);text-align:left;transition:border-color .15s}
.key-card:hover{border-color:var(--line-strong)}
.key-card[aria-pressed=true]{border-color:#5cefe080}
:root[data-theme=light] .key-card[aria-pressed=true]{border-color:var(--accent)}
.key-top{display:flex;justify-content:space-between;gap:12px}
.key-top strong{font-size:15px;line-height:18px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.key-tag{flex-shrink:0;color:var(--muted);font-size:12px;line-height:16px}
.key-prefix{color:var(--muted);font:13px/16px var(--mono)}
.key-meta{color:var(--faint);font-size:12px;line-height:16px}
.st-detail{flex:1 1 0;min-width:0;gap:0;padding:0}
.detail-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 22px;border-bottom:1px solid #ffffff12}
:root[data-theme=light] .detail-head{border-bottom-color:var(--line-soft)}
.detail-head h2{margin:0;font-size:16px;line-height:20px;font-weight:500;overflow-wrap:anywhere}
.detail-head p{margin:3px 0 0;color:var(--muted);font-size:13px;line-height:16px}
.gr-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 22px;border-bottom:1px solid #ffffff12}
:root[data-theme=light] .gr-row{border-bottom-color:var(--line-soft)}
.gr-row .st-row-text strong,.gr-policy .st-row-text strong{font-size:14px;line-height:18px;font-weight:500}
.gr-row .st-row-text span,.gr-policy .st-row-text span{font-size:13px}
.gr-policy{display:flex;flex-direction:column;gap:10px;padding:16px 22px}
.gr-policy-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.gr-policy-text{width:100%;min-height:96px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:#0000004d;color:var(--soft);font:13px/21px var(--mono);resize:vertical;outline:0}
:root[data-theme=light] .gr-policy-text{background:var(--well)}
.gr-policy-text:focus{border-color:#5cefe080}
.gr-policy-text[hidden]{display:none}
.gr-note{margin:0;padding:4px 22px 0;color:var(--faint);font-size:12px;line-height:17px}
.kd-empty{margin:22px}
.kd-empty[hidden],#kd-body[hidden]{display:none}
.switch-lg{width:40px;height:22px;border-radius:11px}
.switch-lg::after{top:3px;left:3px}
.switch-lg[aria-checked=true]::after{transform:translateX(18px)}
.key-tag.off{color:var(--bright)}
.detail-foot{display:flex;justify-content:flex-end;gap:10px;margin-top:auto;padding:14px 22px 20px}
.detail-foot #kd-revoke{font-weight:400}

/* ---- Billing ---- */
.plan-now{gap:16px}
.plan-now-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.plan-now-text{display:flex;flex-direction:column;gap:4px;min-width:0}
.plan-now-text .label{color:var(--muted);font-size:12px;line-height:16px}
.plan-now-text strong{font-size:22px;line-height:28px;font-weight:600}
.plan-now-text span:last-child{color:var(--muted);font-size:13px;line-height:16px}
.plan-now-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.credit{display:flex;flex-direction:column;gap:8px}
.credit-row{display:flex;justify-content:space-between;gap:12px;font-size:13px;line-height:16px}
.credit-bar{height:8px;border-radius:4px;background:var(--well);overflow:hidden}
.credit-bar span{display:block;width:0;height:8px;border-radius:4px;background:linear-gradient(in oklab 90deg,oklab(49.4% -.08 -.013) 0%,oklab(78.2% -.131 -.014) 100%);transition:width .3s}
.credit-note{color:var(--muted);font-size:12px;line-height:16px}
.plan-grid{display:flex;gap:12px}
.plan-card-st{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:10px;min-height:230px;padding:20px;border:1px solid var(--line-card);border-radius:18px;background:var(--surface)}
.plan-card-st.featured{border-color:#22d3c566;background-image:linear-gradient(in oklab 160deg,oklab(78.2% -.131 -.014/14%) 0%,oklab(19.1% -.014 -.006) 60%);background-origin:border-box}
:root[data-theme=light] .plan-card-st.featured{background:#eefaf9;border-color:var(--accent)}
.plan-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.plan-card-head strong{font-size:14px;line-height:18px;font-weight:600}
.plan-flag{color:var(--bright);font-size:11px;font-weight:500;line-height:14px}
.plan-price-st{font-size:24px;line-height:30px;font-weight:600}
.plan-desc{margin:0;color:var(--muted);font-size:12px;line-height:18px}
.plan-btn{display:flex;align-items:center;justify-content:center;height:36px;margin-top:auto;border:1px solid var(--line-strong);border-radius:10px;color:var(--ink);font-size:13px;font-weight:500;line-height:16px}
.plan-btn:hover:not(:disabled){background:var(--tint)}
.plan-btn.accent{border-color:transparent;background:var(--accent);color:var(--on-accent);font-weight:600}
.plan-btn.accent:hover:not(:disabled){background:var(--bright)}
.plan-btn:disabled{opacity:.5;cursor:not-allowed}
.plan-card-st.current .plan-btn{border-color:transparent;background:var(--tint);color:var(--muted);opacity:1}
.how{flex:1;gap:14px}
.how-list{margin:0;padding:0;list-style:none;counter-reset:how;display:flex;flex-direction:column;gap:14px}
.how-list li{counter-increment:how;display:flex;gap:12px;color:var(--muted);font-size:13px;line-height:19px}
.how-list li::before{content:counter(how,decimal-leading-zero);flex-shrink:0;width:20px;color:var(--bright);font:12px/19px var(--mono)}
.pay-method{gap:14px}
.card-row{display:flex;align-items:center;gap:12px}
.card-brand{display:flex;align-items:center;justify-content:center;width:44px;height:30px;flex-shrink:0;border:1px solid #ffffff1a;border-radius:6px;background:#1c2b2c;color:#f2f5f5;font-size:10px;font-weight:600;line-height:12px}
.card-text{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:2px;font-size:13px;line-height:16px}
.card-text span:last-child{color:var(--muted);font-size:12px}
.invoices{flex:1;gap:12px}
.invoice-list{display:flex;flex-direction:column}
.invoice-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line-soft);font-size:13px;line-height:16px}
.invoice-row:last-child{border-bottom:0}
.invoice-what{flex:1 1 0;min-width:0}
.invoice-link{width:56px;flex-shrink:0;color:var(--bright);text-align:right;text-decoration:none}
a.invoice-link:hover{text-decoration:underline}

/* ---- Usage ---- */
.stats{display:flex;gap:12px}
.stat{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:6px;padding:18px;border:1px solid var(--line-card);border-radius:16px;background:var(--surface)}
.stat span{color:var(--muted);font-size:12px;line-height:16px}
.stat strong{font-size:22px;line-height:28px;font-weight:500}
.chart-card{gap:16px}
.chart-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.chart{display:flex;align-items:flex-end;gap:var(--gap,40px);height:240px}
.chart .bar{flex:1 1 0;min-width:0;border-radius:4px 4px 0 0;background:var(--avatar)}
.chart .bar.peak{background:var(--accent)}
.chart-labels{display:flex;gap:var(--gap,40px)}
.chart-labels span{flex:1 1 0;min-width:0;color:var(--faint);font:11px/14px var(--mono);text-align:center;white-space:nowrap;overflow:visible}
.chart-labels span.peak{color:var(--bright)}
.where{display:flex;flex-direction:column;gap:14px}
.where-row{display:flex;flex-direction:column;gap:6px}
.where-top{display:flex;justify-content:space-between;gap:12px;font-size:13px;line-height:16px}
.where-top span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.where-track{height:5px;border-radius:3px;background:var(--well);overflow:hidden}
.where-track span{display:block;height:5px;border-radius:3px;background:var(--accent)}
.by-model{flex:1;gap:12px}
.model-row{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line-soft);font-size:13px;line-height:16px}
.model-row:last-child{border-bottom:0}
.model-row div{display:flex;flex-direction:column;gap:2px}
.model-row strong{font-weight:400}
.model-row div span{color:var(--muted);font-size:12px}
.forecast{margin:auto 0 0;padding:14px;border:1px solid #22d3c533;border-radius:12px;background:#22d3c514;color:var(--bright);font-size:12px;line-height:18px}
.forecast[hidden]{display:none}

/* ---- Privacy ---- */
.st-glow{gap:14px;border-color:#22d3c540;background-image:linear-gradient(in oklab 160deg,oklab(78.2% -.131 -.014/10%) 0%,oklab(19.1% -.014 -.006) 55%);background-origin:border-box}
:root[data-theme=light] .st-glow{background:#eefaf9;border-color:#13b3a64d}
.checks{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:14px}
.checks li{display:flex;gap:10px;font-size:13px;line-height:19px}
.checks li::before{content:'✓';flex-shrink:0;color:var(--bright);line-height:16px}
.devices{flex:1;gap:12px}
.devices-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.device-list{display:flex;flex-direction:column}
.device-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0}
.device-row div{display:flex;flex-direction:column;gap:2px;min-width:0}
.device-row strong{font-size:13px;line-height:16px;font-weight:400}
.device-row div span{color:var(--muted);font-size:12px;line-height:16px}
.device-current{flex-shrink:0;color:var(--bright);font-size:12px;line-height:16px}
.danger{flex-direction:row;align-items:center;justify-content:space-between;gap:16px;padding:20px 22px;border-color:#e8b44a40}
.danger .st-row-text strong{font-size:14px;line-height:18px;font-weight:500}

/* ---- Create API key dialog ---- */
.key-modal{gap:20px;width:min(620px,100%);padding:28px}
.km-head{display:flex;align-items:flex-start;gap:14px}
.km-head>div{flex:1 1 0;min-width:0}
.km-head h2{margin:0;font-size:22px;line-height:28px;font-weight:600;letter-spacing:-.02em}
.km-head p{margin:2px 0 0;color:var(--muted);font-size:14px;line-height:18px}
.km-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;flex-shrink:0;border:1px solid #5cefe059;border-radius:12px;background:#22d3c514;color:var(--bright);font:600 15px/18px var(--mono)}
.km-close{width:28px;height:28px;flex-shrink:0;border-radius:8px;color:var(--muted);font-size:20px;line-height:20px}
.km-close:hover{color:var(--ink);background:var(--tint)}
.km-form{display:flex;align-items:flex-end;gap:12px}
.km-form .field{flex:1 1 0;min-width:0}
.km-form .km-guard{flex:0 0 190px}
.km-guard select{appearance:auto;cursor:pointer}
.km-form[hidden],.km-result[hidden]{display:none}
.km-result{display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid #22d3c540;border-radius:14px;background:#22d3c50f}
.km-result-label{color:var(--bright);font-size:12px;font-weight:500;line-height:16px}
.km-key{display:flex;align-items:center;justify-content:space-between;gap:12px}
.km-key code{min-width:0;color:var(--ink);font:500 14px/20px var(--mono);overflow-wrap:anywhere;user-select:all}
.km-warn{color:var(--danger);font-size:12px;line-height:16px}
.km-foot{display:flex;align-items:center;justify-content:space-between;gap:12px}

/* ---- Narrower screens ---- */
@media (max-width:1240px){
  .settings-main{padding:28px 32px}
  .st-panel{flex-direction:column;align-items:stretch}
  .st-col{flex:none}
  .st-side,[data-panel=general] .st-side,[data-panel=api-keys] .keys-col{width:auto}
}
@media (max-width:820px){
  .settings-main{gap:20px;padding:6px 16px calc(28px + env(safe-area-inset-bottom))}
  .st-title-row{margin-left:-8px}
  .st-head{gap:12px}
  .st-head h1{font-size:24px;line-height:30px}
  .st-tabs{margin-inline:-16px;padding-inline:8px}
  .st-card{padding:18px;border-radius:16px}
  .st-list{padding:4px 18px}
  .plan-grid{flex-direction:column}
  .plan-card-st{flex:none}
  .stats{gap:8px}
  .stat{padding:12px 14px;border-radius:14px}
  .stat strong{font-size:17px;line-height:22px}
  .plan-card-st{min-height:0}
  .plan-btn{margin-top:6px}
  .plan-now-head{flex-direction:column}
  .plan-now-actions{justify-content:flex-start}
  .st-row{align-items:flex-start}
  .st-row .seg{align-self:center}
  .st-row:has(.st-row-actions){flex-direction:column;align-items:stretch}
  .profile-form{flex-wrap:wrap}
  .profile-form .st-input{flex-basis:100%}
  .chart{height:160px}
  .detail-head{flex-direction:column;align-items:flex-start}
  .detail-foot{flex-wrap:wrap}
  .km-form .km-guard{flex:none}
  .danger{flex-direction:column;align-items:flex-start}
  .km-form{flex-direction:column;align-items:stretch}
  .km-foot{flex-direction:column-reverse;align-items:stretch;text-align:center}
}

/* ---- App dialogs (Chat · Upgrade plan / Top up credits / Welcome / Download Ablitron Code) ---- */
.app-dialog{gap:0;width:min(620px,100%);padding:0;border-radius:22px;background:#0a1314}
.app-dialog.wide{width:min(780px,100%)}
:root[data-theme=light] .app-dialog{background:var(--surface)}
.ad-head{display:flex;align-items:flex-start;gap:14px;padding:28px 28px 0}
.ad-head>div{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:3px}
.ad-head h2{margin:0;font-size:22px;line-height:28px;font-weight:600;letter-spacing:-.02em}
.ad-text{margin:0;color:var(--muted);font-size:14px;line-height:18px}
.ad-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;flex-shrink:0;border:1px solid #22d3c573;border-radius:12px;background:#04201e;color:var(--bright);font:600 16px/20px var(--mono)}
:root[data-theme=light] .ad-icon{background:#e3f7f5}
.ad-close{width:28px;height:28px;flex-shrink:0;margin:-2px -6px 0 0;border-radius:8px;color:var(--faint);font-size:20px;line-height:24px}
.ad-close:hover{color:var(--ink);background:var(--tint)}
.ad-body{display:flex;flex-direction:column;gap:18px;padding:24px 28px 28px}
.ad-body+.ad-foot{padding:0 28px 24px}
.ad-primary,.ad-secondary{display:flex;align-items:center;justify-content:center;height:42px;border-radius:11px;font-size:14px;line-height:18px;text-decoration:none;transition:background .15s}
.ad-primary{background:var(--accent);color:var(--on-accent);font-weight:600}
.ad-primary:hover:not(:disabled){background:var(--bright)}
.ad-secondary{border:1px solid #ffffff24;color:var(--ink);font-weight:500}
:root[data-theme=light] .ad-secondary{border-color:var(--line-strong)}
.ad-secondary:hover:not(:disabled){background:var(--tint)}
.ad-primary:disabled,.ad-secondary:disabled{opacity:.45;cursor:not-allowed}
.ad-pill{height:auto;padding:11px 20px;border-radius:100px;white-space:nowrap}
.ad-small{height:auto;padding:9px 14px;border-radius:10px;font-size:13px;line-height:16px;flex-shrink:0}
.ad-block{height:46px;border-radius:100px;font-size:15px}
.ad-link{padding:0;color:var(--bright);font-size:13px;font-weight:500;line-height:16px;text-decoration:none;white-space:nowrap}
.ad-link:hover{text-decoration:underline}
.ad-foot{display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--muted);font-size:13px;line-height:16px}
.ad-foot.center{flex-direction:column;justify-content:center;gap:6px;font-size:12px;text-align:center}
.ad-method{color:var(--muted);font-size:13px;line-height:16px}
.ad-note,.ad-fine{margin:0;color:var(--faint);font-size:12px;line-height:16px}
.ad-fine{margin-top:8px}
/* Plans */
.ad-plans{display:flex;gap:14px}
.ad-plan{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:14px;padding:22px;border:1px solid #ffffff1a;border-radius:16px;background:var(--surface)}
:root[data-theme=light] .ad-plan{border-color:var(--line)}
.ad-plan.featured{border-color:#22d3c573;background-image:linear-gradient(in oklab 155deg,oklab(78.2% -.131 -.014/16%) 0%,oklab(19.1% -.014 -.006) 60%);background-origin:border-box}
:root[data-theme=light] .ad-plan.featured{background:#eefaf9;border-color:var(--accent)}
.ad-plan-top{display:flex;flex-direction:column;gap:4px}
.ad-plan-name{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ad-plan-name strong{font-size:15px;line-height:18px;font-weight:600}
.ad-badge{padding:3px 9px;border-radius:100px;background:#22d3c529;color:var(--bright);font-size:11px;font-weight:500;line-height:14px;white-space:nowrap}
.ad-plan-price{font-size:30px;line-height:36px;font-weight:600;letter-spacing:-.02em}
.ad-ticks{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px}
.ad-ticks li{display:flex;gap:6px;font-size:13px;line-height:16px}
.ad-ticks li::before{content:"\2713";color:var(--ink)}
.ad-plan .ad-primary,.ad-plan .ad-secondary{margin-top:auto}
/* Top up */
.ad-amounts{display:flex;gap:10px}
.ad-amount{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:14px 4px;border:1px solid #ffffff1a;border-radius:12px;background:var(--surface);transition:border-color .15s,background .15s}
:root[data-theme=light] .ad-amount{border-color:var(--line)}
.ad-amount:hover{border-color:#ffffff33}
.ad-amount strong{font-size:17px;line-height:22px;font-weight:600}
.ad-amount span{color:var(--muted);font-size:11px;line-height:14px}
.ad-amount[aria-pressed=true]{border-color:var(--accent);background:#22d3c51a}
.ad-amount[aria-pressed=true] span{color:var(--bright)}
.ad-amount-custom{border-style:dashed;border-color:#ffffff2e;cursor:text}
.ad-amount-custom:focus-within{border-style:solid;border-color:var(--accent)}
.ad-custom{width:100%;border:0;background:transparent;color:var(--ink);font-size:14px;line-height:22px;text-align:center;outline:0;-moz-appearance:textfield}
.ad-custom::-webkit-outer-spin-button,.ad-custom::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.ad-custom::placeholder{color:var(--muted)}
/* Welcome options */
.ad-body:has(.ad-options){gap:10px}
.ad-options{display:flex;flex-direction:column;gap:10px}
.ad-option{display:flex;align-items:center;gap:14px;padding:16px;border:1px solid var(--line-card);border-radius:14px;background:var(--surface)}
.ad-option.featured{border-color:#22d3c559;background-image:linear-gradient(in oklab 155deg,oklab(78.2% -.131 -.014/16%) 0%,oklab(19.1% -.014 -.006) 65%);background-origin:border-box}
:root[data-theme=light] .ad-option.featured{background:#eefaf9}
.ad-option>div{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:2px}
.ad-option strong{font-size:14px;line-height:18px;font-weight:500}
.ad-option.featured strong{font-weight:600}
.ad-option>div span{color:var(--muted);font-size:12px;line-height:16px}
.ad-option-mark{width:30px;flex-shrink:0;color:var(--muted);font:600 13px/16px var(--mono)}
.ad-option.featured .ad-option-mark{color:var(--bright)}
/* Download steps */
.ad-steps{margin:0;padding:0;list-style:none;counter-reset:step;display:flex;flex-direction:column;gap:18px}
.ad-steps li{counter-increment:step;position:relative;display:flex;flex-direction:column;gap:4px;padding-left:40px}
.ad-steps li::before{content:counter(step);position:absolute;left:0;top:-2px;display:flex;align-items:center;justify-content:center;width:26px;height:26px;border:1px solid #22d3c540;border-radius:13px;background:#22d3c514;color:var(--bright);font-size:13px;font-weight:600}
.ad-steps strong{font-size:15px;line-height:18px;font-weight:600}
.ad-steps span{color:var(--muted);font-size:13px;line-height:19px}

/* ---- Sidebar: Ablitron Code card (Chat · Ablitron Code card) ---- */
.sb-code{display:flex;flex-direction:column;gap:12px;padding:16px;border:1px solid #22d3c540;border-radius:14px;background:var(--surface)}
.sb-code[hidden]{display:none}
.sb-code-head{display:flex;align-items:center;gap:10px}
.sb-code-mark{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;border:1px solid #22d3c559;border-radius:7px;color:var(--bright);font:600 10px/12px var(--mono)}
.sb-code-head strong{flex:1;font-size:13px;line-height:16px;font-weight:600}
.sb-code-close{width:22px;height:22px;border-radius:6px;color:var(--faint);font-size:16px;line-height:16px}
.sb-code-close:hover{color:var(--ink);background:var(--tint)}
.sb-code p{margin:0;color:var(--muted);font-size:12px;line-height:18px}
.sb-code-action{padding:9px;border-radius:10px;background:var(--accent);color:var(--on-accent);font-size:13px;font-weight:600;line-height:16px}
.sb-code-action:hover{background:var(--bright)}

@media (max-width:820px){
  .ad-head{padding:22px 20px 0}
  .ad-body{padding:20px}
  .ad-body+.ad-foot{padding:0 20px 20px}
  .ad-plans{flex-direction:column}
  .ad-plan{flex:none;padding:18px}
  .ad-amounts{flex-wrap:wrap}
  .ad-amount{flex:1 1 40%}
  .ad-foot{flex-direction:column;align-items:stretch;text-align:center}
  .ad-option{flex-wrap:wrap}
}

/* ---- Plan usage meters (Settings · Billing, limit dialog) ---- */
.meters{display:flex;flex-direction:column;gap:14px}
.meters[hidden]{display:none}
.meter{display:flex;flex-direction:column;gap:8px}
.meter.full .credit-bar span{background:var(--danger)}
.meter.full .credit-row .mono{color:var(--danger)}
.credit.compact{padding-top:14px;border-top:1px solid var(--line-soft)}
.credit.compact .credit-bar{display:none}
.ad-meters{display:flex;flex-direction:column;gap:14px;padding:16px;border:1px solid var(--line-card);border-radius:14px;background:var(--surface)}
.ad-meter{display:flex;flex-direction:column;gap:6px}
.ad-meter-head{display:flex;justify-content:space-between;gap:12px;font-size:13px;line-height:16px}
.ad-meter-head span:last-child{color:var(--muted);font-variant-numeric:tabular-nums}
.ad-meter.full .ad-meter-head span:last-child{color:var(--danger)}
.ad-meter-bar{height:6px;border-radius:3px;background:var(--well);overflow:hidden}
.ad-meter-bar span{display:block;height:6px;border-radius:3px;background:var(--accent)}
.ad-meter.full .ad-meter-bar span{background:var(--danger)}
.st-signout{display:block;margin:32px auto 8px;padding:8px 14px;border-radius:8px;color:var(--muted);font-size:14px;line-height:18px}
.st-signout:hover{color:var(--ink);background:var(--soft)}
