/* API keys page: several keys, each with a backup routing switch and its own spending cap. Load after refresh.css/noir.css. */
.key-count{font-size:12px;color:var(--muted);align-self:center;white-space:nowrap}
.key-card.key-multi{flex-wrap:wrap;align-items:flex-start}
.key-card.key-multi .key-info{flex:1 1 280px;min-width:0}
.key-card.key-multi .key-info h3{flex-wrap:wrap;row-gap:6px}
.key-card.key-multi .key-info code{overflow:hidden;text-overflow:ellipsis}
.key-card.key-multi .key-actions{flex-wrap:wrap;justify-content:flex-end;max-width:none}
.key-pill,.key-main{font-size:10px;font-weight:500;color:var(--text);white-space:nowrap}
.key-more{flex:1 1 100%;display:grid;gap:0;border-top:1px solid var(--line);margin-top:2px}
.key-backup{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:14px 0;border-bottom:1px solid var(--line)}
.key-backup strong{font-size:13px;font-weight:600}
.key-backup p{margin:4px 0 0;font-size:12px;line-height:1.55;color:var(--muted);max-width:60ch}
.key-switch{position:relative;flex:none;width:44px;height:26px;padding:0;border:1px solid var(--line-2,var(--line));border-radius:999px;background:var(--code,#151513);cursor:pointer;transition:background .18s,border-color .18s}
.key-switch span{position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:var(--muted);transition:transform .18s,background .18s}
.key-switch[aria-checked=true]{background:rgba(255,85,0,.22);border-color:var(--orange,#ff5500)}
.key-switch[aria-checked=true] span{transform:translateX(18px);background:var(--orange,#ff5500)}
.key-switch:focus-visible{outline:2px solid var(--orange,#ff5500);outline-offset:2px}
.key-switch:disabled{opacity:.6;cursor:progress}
.key-cap summary{display:flex;align-items:center;gap:10px;padding:14px 0;cursor:pointer;list-style:none;font-size:13px;font-weight:600}
.key-cap summary::-webkit-details-marker{display:none}
.key-cap summary svg{width:16px;height:16px;color:var(--muted)}
.key-cap summary em{margin-left:auto;font-style:normal;font-weight:400;font-size:12px;color:var(--muted);text-align:right}
.key-cap[open] summary{padding-bottom:6px}
.key-cap form{max-width:540px;padding:4px 0 10px}
/* 2026-10-27 cleanup: one meta line per key, secondary info folded away */
.key-card.key-multi .key-info p.key-meta{margin-top:2px;font-size:12px;color:var(--muted)}
.key-card.key-multi .key-info h3 .key-main{font-size:10px}
.keys-more{margin-top:32px;border-top:1px solid var(--line)}
.keys-fold{border-bottom:1px solid var(--line)}
.keys-fold.account-check{display:block}
.keys-fold>summary{display:flex;align-items:center;gap:10px;padding:18px 2px;cursor:pointer;list-style:none;font-size:14px;font-weight:600;color:var(--text)}
.keys-fold>summary::-webkit-details-marker{display:none}
.keys-fold>summary::after{content:"";margin-left:auto;width:7px;height:7px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-2px) rotate(45deg);transition:transform .18s}
.keys-fold[open]>summary::after{transform:translateY(2px) rotate(-135deg)}
.keys-fold>summary:hover::after{border-color:var(--text)}
.keys-fold>summary:focus-visible{outline:2px solid var(--orange,#ff5500);outline-offset:2px}
.keys-fold-count{font-size:12px;font-weight:500;color:var(--muted)}
.keys-fold-body{display:grid;gap:12px;padding:0 2px 22px;max-width:76ch}
.keys-fold-body p{margin:0;font-size:13px;line-height:1.65;color:var(--muted)}
.keys-fold-body .account-check-call{justify-self:start;max-width:100%}
.keys-fold .table-wrap{margin-bottom:22px}
.limits-panel .section-head p{font-size:13px}
@media(max-width:767px){
  .keys-fold-body .account-check-call{justify-self:stretch}
  .key-backup{align-items:flex-start}
  .key-card.key-multi .key-actions{justify-content:flex-start}
  .key-cap summary{flex-wrap:wrap}
  .key-cap summary em{margin-left:26px;text-align:left;flex-basis:100%}
}



.key-models{min-width:0;max-width:100%;grid-column:1/-1}
.key-model-summary{font-size:12px;font-weight:400;color:var(--muted);margin-left:8px}
.key-model-form{display:grid;gap:24px;min-width:0;padding-block:4px}
.key-model-section{border:0;padding:0;margin:0;min-width:0}
.key-model-section>legend{font-size:14px;font-weight:600;margin-bottom:12px}
.key-model-mode{display:flex;gap:18px;flex-wrap:wrap;margin-bottom:12px}
.key-model-mode label{display:flex;align-items:center;gap:7px;font-size:12px}
.key-model-form input[type=checkbox],.key-model-form input[type=radio]{width:15px;height:15px;min-height:15px;padding:0;flex:none;accent-color:var(--orange,#ff5500)}
.key-model-picker{display:grid;gap:12px;justify-items:start}
.key-chips{display:flex;flex-wrap:wrap;gap:8px;max-width:100%}
.key-chip{display:inline-flex;align-items:center;flex-wrap:wrap;gap:7px;padding:5px 7px 5px 10px;border:1px solid var(--line);border-radius:8px;max-width:100%;font-size:12px;line-height:1.6}
.key-chip>strong{font-weight:500;overflow-wrap:anywhere}
.key-chip-count,.key-chip-route{color:var(--muted);font-size:11px}
.key-chip-route{position:relative}
.key-chip-route select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.key-chip-route:has(select:focus-visible){outline:2px solid var(--orange,#ff5500);outline-offset:4px}
.key-chip-remove,.key-dialog-close{border:0;background:none;color:var(--muted);cursor:pointer;font:inherit;font-size:20px;width:28px;height:32px;flex:none}
.key-model-help,.key-usage-note{font-size:12px;line-height:1.65;color:var(--muted);margin:10px 0}
.key-order-intro{margin:0 0 12px!important;color:var(--muted);font-size:13px}
.key-order{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:0;list-style:none;margin:0 0 18px}
.key-order li{display:flex;gap:8px;align-items:flex-start;min-width:0;font-size:11px;line-height:1.5;padding:12px 8px;border:1px solid var(--line);border-radius:8px}
.key-order li>span{display:grid;place-items:center;border:1px solid var(--line);border-radius:50%;width:21px;height:21px;flex:none;color:var(--orange,#ff5500)}
.key-order strong{font-size:11px;font-weight:500;min-width:0}
.key-order small{display:block;color:var(--muted);font-weight:400;font-size:10px;margin-top:3px}
.key-reroute-off{display:block;color:var(--muted);font-size:10px;font-style:normal;margin-top:5px}
.key-reroute-row{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:12px 0 18px;border-bottom:1px solid var(--line)}
.key-reroute-row strong{font-size:13px;font-weight:500}
.key-reroute-row p{font-size:12px!important;color:var(--muted);margin:6px 0 0!important}
.key-reroute-toggle{position:relative;flex:none;width:44px;height:26px;padding:0;border:1px solid var(--line);border-radius:999px;background:var(--code,#151513);cursor:pointer}
.key-reroute-toggle span{position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:var(--muted)}
.key-reroute-toggle[aria-checked=true]{background:color-mix(in srgb,var(--orange,#ff5500) 20%,transparent);border-color:var(--orange,#ff5500)}
.key-reroute-toggle[aria-checked=true] span{transform:translateX(18px);background:var(--orange,#ff5500)}
.key-rules-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:18px 0 12px;font-size:13px}
.key-rule-count{font-size:11px;color:var(--muted);white-space:nowrap}
.key-rules{display:grid;gap:12px;min-width:0}
.key-rule{display:flex;gap:8px;align-items:flex-start;border:1px solid var(--line);border-radius:10px;padding:12px;min-width:0}
.key-rule-content{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;flex:1}
.key-rule-word{font-size:12px;color:var(--muted)}
.key-model-pill{display:grid;gap:4px;padding:8px 10px;min-height:44px;min-width:0;max-width:280px;border:1px solid var(--line);border-radius:8px;background:var(--code,var(--bg));color:var(--text);text-align:left;cursor:pointer}
.key-model-label{display:grid;gap:3px;min-width:0;text-align:left}
.key-model-label strong{font-size:12px;font-weight:500;line-height:1.5;overflow-wrap:anywhere;white-space:normal}
.key-model-label code{font-size:10px;line-height:1.45;color:var(--muted);white-space:normal;overflow-wrap:anywhere}
.key-reroute-mark{font-size:15px;color:var(--muted);white-space:nowrap}
.key-rule-chain{display:inline-flex;flex-wrap:wrap;gap:8px;align-items:center;min-width:0}
.key-rule-arrow{color:var(--muted);font-size:14px}
.key-price-difference{font-size:11px;line-height:1.5;color:var(--muted);white-space:normal;overflow-wrap:anywhere}
.key-price-difference.is-more{color:var(--warning,var(--orange,#ff5500))}
.key-rule-trash{width:32px;height:36px;border:0;background:transparent;color:var(--muted);display:grid;place-items:center;cursor:pointer;flex:none}
.key-rule-trash svg{width:15px;height:15px}
.key-then{font-size:11px!important;padding:7px!important}
.key-empty-rules{padding:18px 0}
.key-empty-rules strong{font-size:13px;font-weight:500}
.key-empty-rules p{font-size:12px!important;color:var(--muted);margin-top:6px!important}
.key-suggestions{display:grid;gap:10px;margin:14px 0}
.key-suggestion{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;border:1px dashed var(--line);border-radius:9px;padding:12px}
.key-suggestion p{font-size:12px!important;line-height:1.65!important;color:var(--muted);flex:1 1 250px;margin:0!important}
.key-suggestion strong{color:var(--text);font-weight:500}
.key-suggestion button{font-size:11px!important}
.key-used-warning{display:grid;gap:7px}
.key-used-warning p{font-size:12px!important;line-height:1.6!important;color:var(--muted);border-left:2px solid var(--orange,#ff5500);padding:8px 12px;margin:8px 0!important}
.key-used-warning button{font-size:12px}
.key-dormant:empty{display:none}.key-dormant summary{font-size:12px;cursor:pointer}.key-dormant code{white-space:normal;overflow-wrap:anywhere;font-size:11px}
.key-model-notice,.key-model-error{font-size:12px!important;line-height:1.6!important;padding:10px 12px;margin:0!important;border-left:2px solid var(--orange,#ff5500);color:var(--muted)}
.key-model-error{color:var(--bad,var(--orange,#ff5500))}
.key-edit-toast{position:sticky;bottom:90px;z-index:31;justify-self:center;display:flex;align-items:center;gap:18px;border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:12px 18px;box-shadow:0 7px 26px color-mix(in srgb,var(--text) 12%,transparent);font-size:13px}
.key-edit-toast button{font-size:13px}
.key-savebar{position:sticky;bottom:14px;z-index:30;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:var(--bg);border:1px solid var(--orange,#ff5500);border-radius:9px;padding:12px;box-shadow:0 8px 30px color-mix(in srgb,var(--text) 10%,transparent)}
.key-savebar>span{font-size:12px;margin-right:auto}
.key-model-form [hidden]{display:none!important}
dialog.key-chooser{width:min(620px,calc(100vw - 40px));max-width:calc(100vw - 40px);max-height:84dvh;padding:0;border:1px solid var(--line);border-radius:12px;background:var(--bg);color:var(--text);margin:7vh auto;box-shadow:0 20px 70px color-mix(in srgb,var(--text) 20%,transparent);overflow:hidden}
dialog.key-chooser::backdrop{background:color-mix(in srgb,var(--bg) 68%,transparent)}
.key-chooser-shell{display:flex;flex-direction:column;min-height:0;max-height:84dvh;padding:18px}
.key-chooser-head{display:flex;align-items:flex-start;gap:15px;justify-content:space-between;margin-bottom:14px}
.key-chooser-head h3{margin:3px 0!important;font-size:18px!important;line-height:1.45;font-weight:600;overflow-wrap:anywhere}
.key-chooser-search{display:block;margin-bottom:12px}
.key-chooser-search input{width:100%;min-width:0;font-size:13px;min-height:42px;padding:10px 12px}
.key-choice-results{overflow:auto;min-height:0;overscroll-behavior:contain;padding:2px}
.key-choice-group{margin:0 0 16px}
.key-choice-group h4{color:var(--muted);font-size:11px;font-weight:600;margin:12px 6px 7px}
.key-choice{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;min-width:0;min-height:62px;padding:11px 8px;text-align:left;background:transparent;color:var(--text);border:0;border-bottom:1px solid var(--line);cursor:pointer;border-radius:5px}
.key-choice:hover,.key-choice:focus-visible{background:var(--code,var(--bg))}
.key-choice-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px;max-width:205px;min-width:0}
.key-choice-meta>small{font-size:10px;line-height:1.5;color:var(--muted)}
.key-stable-badge{font-size:10px;border:1px solid var(--line);padding:1px 5px;border-radius:4px;color:var(--muted)}
.key-add-label{font-size:11px;color:var(--orange,#ff5500)}
.key-status{display:flex;align-items:center;gap:5px;font-size:10px;line-height:1.4;color:var(--muted)}
.key-status-dot{width:6px;height:6px;border-radius:50%;background:var(--muted);flex:none}
.key-status-dot.is-healthy,.key-status-dot.is-online{background:var(--good,#55a879)}.key-status-dot.is-down,.key-status-dot.is-offline,.key-status-dot.is-paused{background:var(--bad,#cd6755)}.key-status-dot.is-degraded{background:var(--orange,#ff5500)}
.key-family-option{border-bottom:1px solid var(--line);padding-bottom:3px}
.key-family-option>summary{display:flex;justify-content:space-between;align-items:center;gap:8px;list-style:none;cursor:pointer;font-size:13px;min-height:44px}
.key-family-option>summary::-webkit-details-marker{display:none}
.key-family-option summary label{display:flex;align-items:center;gap:9px;flex:1;cursor:pointer;min-width:0}
.key-family-option summary strong{font-weight:500;font-size:13px}
.key-family-option summary small{font-size:11px;color:var(--muted);margin:0 0 0 auto;white-space:nowrap}
.key-single-model{display:flex;align-items:flex-start;gap:10px;padding:12px 5px 12px 22px;cursor:pointer;min-width:0}
.key-single-model input{margin-top:3px}
.key-single-model>.key-model-label{flex:1;min-width:0}
.key-single-model>small{font-size:10px;line-height:1.55;color:var(--muted);max-width:130px}
.key-picker-done{margin-top:12px;align-self:flex-end}
.key-remove-target{padding:10px 0;align-self:flex-start;font-size:12px}
.key-confirm-buttons{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}
.key-model-form button:focus-visible,.key-chooser button:focus-visible,.key-model-form input:focus-visible{outline:2px solid var(--orange,#ff5500);outline-offset:3px}
.key-model-form button:disabled{opacity:.5;cursor:default}
@media(max-width:768px){.key-models>summary{flex-wrap:wrap;gap:6px 10px}.key-model-summary{flex-basis:100%;order:1;margin:0}.key-order{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:500px){
 .key-order{grid-template-columns:minmax(0,1fr);gap:6px}.key-order li{align-items:center;padding:9px 10px}.key-order strong{font-size:12px}.key-order small{display:inline;margin-left:5px}
 .key-rule{padding:10px;position:relative}.key-rule-content{display:grid;grid-template-columns:minmax(0,1fr);gap:7px;width:100%;padding-right:26px}.key-rule-trash{position:absolute;right:5px;top:7px}
 .key-model-pill{width:100%;max-width:none}.key-rule-chain{display:flex;flex-direction:column;align-items:stretch}.key-rule-arrow{align-self:center;transform:rotate(90deg)}
 .key-then{justify-self:start}.key-savebar>span{flex-basis:100%;margin:0}.key-savebar{bottom:9px}.key-suggestion button{width:100%}
 dialog.key-chooser{inset:auto 0 0;width:100vw;max-width:100vw;max-height:88dvh;margin:0;border-radius:14px 14px 0 0;border-bottom:0}
 .key-chooser-shell{max-height:88dvh;padding:16px 12px 20px}.key-chooser-head h3{font-size:17px!important}
 .key-choice{grid-template-columns:minmax(0,1fr);gap:7px;padding:12px 8px}.key-choice-meta{align-items:flex-start;max-width:none;flex-direction:row;flex-wrap:wrap;gap:6px 10px}
 .key-single-model{padding-left:7px;flex-wrap:wrap}.key-single-model>.key-model-label{flex-basis:calc(100% - 28px)}.key-single-model>small{margin-left:26px;max-width:none}
 .key-family-option summary strong{font-size:12px}.key-family-option summary small{font-size:10px}
}

html:has(.key-models[open]){scroll-behavior:auto}
.key-model-form button{scroll-margin-block:110px 150px}
