/* API keys */

/* Stat cards (values are the console's 24/30 .stat .v) */
.keys-stats{gap:16px}
.keys-stat .s{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.keys-stat .v.keys-money{font-variant-numeric:tabular-nums}
.keys-stat .v .sk{margin:2px 0}

/* Table: the console table; only the column widths and the 8px cell sides are the page's own */
.keys-tcard{overflow:hidden}
.keys-tbl{table-layout:fixed}
.keys-tbl col.w-chk{width:40px}
.keys-tbl col.w-key{width:188px}
.keys-tbl col.w-lim{width:186px}
.keys-tbl col.w-rpm{width:112px}
.keys-tbl col.w-date{width:116px}
.keys-tbl col.w-st{width:112px}
.keys-tbl col.w-act{width:64px}
.keys-tbl th,.keys-tbl td{padding-left:8px;padding-right:8px}
.keys-tbl td{font-size:12px;color:var(--text-2)}
.keys-tbl th:first-child,.keys-tbl td:first-child{padding-right:0}
.keys-tbl tbody tr{cursor:default}
.keys-tbl .namecell{gap:10px}
.keys-tbl .namecell b{font-size:14px;font-weight:500}
.keys-kic{width:30px;height:30px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center;flex:0 0 30px;color:var(--text-2)}
.keys-kic .i{width:14px;height:14px}
.keys-tbl tr.off .namecell b,.keys-tbl tr.off .keymask code,.keys-tbl tr.off .keys-kic,.keys-tbl tr.off .keys-c-rpm{color:var(--text-3)}
.keys-tbl .keymask{gap:6px}
.keys-tbl .keymask code{padding:5px 9px;font-size:12px}
.keys-tbl .keys-c-exp.warn{color:var(--warn)}
.keys-lim{display:flex;flex-direction:column;gap:6px;min-width:0}
.keys-num{font-family:var(--font-code);font-variant-numeric:tabular-nums;font-size:12px;color:var(--text-2);line-height:16px}
.keys-num em{font-style:normal;color:var(--text-3)}
.keys-lim .track{width:100%}
.keys-acts{display:flex;align-items:center;justify-content:flex-end;gap:6px}
.keys-more[aria-expanded=true]{background:var(--surface-hover);color:var(--text)}
.keys-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Checkboxes */
.keys-chk{appearance:none;-webkit-appearance:none;width:16px;height:16px;margin:0;border:1.5px solid var(--line-control);border-radius:4px;background:var(--surface);display:inline-grid;place-items:center;cursor:pointer;vertical-align:middle;transition:background-color var(--dur-1) var(--ease-std),border-color var(--dur-1) var(--ease-std)}
.keys-chk:hover{border-color:var(--text-2)}
.keys-chk:checked,.keys-chk:indeterminate{background:var(--accent);border-color:var(--accent)}
.keys-chk:checked::after{content:"";width:10px;height:10px;background:var(--on-accent);-webkit-mask:var(--chk) center/contain no-repeat;mask:var(--chk) center/contain no-repeat}
.keys-chk:indeterminate::after{content:"";width:8px;height:2px;border-radius:1px;background:var(--on-accent)}
.keys-chk:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* Bulk bar: fades in when it appears; later selection changes update it in place (p-keys.js) */
.keys-bulk{display:flex;align-items:center;gap:10px;padding:10px 22px;border-bottom:1px solid var(--line);background:var(--surface);flex-wrap:wrap;animation:cx-pop var(--dur-2) var(--ease-out)}
.keys-bulk b{font-size:13px;font-weight:500;margin-right:6px}
.keys-clear{color:var(--text-2);font-size:12px}
.keys-clear:hover{color:var(--text)}

/* Row menu (fixed, so the table's scroll box never clips it) */
.menu.keys-menu{position:fixed;min-width:196px;z-index:75}

/* Use your key + spend limits note */
.keys-r3{align-items:stretch}
.keys-use{flex:1 1 auto;display:flex;flex-direction:column;gap:12px}
.keys-use-r{display:flex;align-items:center;gap:12px}
.keys-use-r .link-btn{color:var(--accent);font-size:13px}
.keys-use-r .link-btn .i{width:13px;height:13px}
.keys-code{padding:14px 44px 14px 16px;line-height:23px}
.keys-code.sm{font-size:12px;line-height:20px;padding:12px 44px 12px 14px}
.keys-note{flex:0 0 380px;width:380px;padding:22px;display:flex;flex-direction:column;gap:10px;border-radius:16px}
.keys-note-h{display:flex;align-items:center;gap:8px}
.keys-note-h .i{color:var(--accent);width:16px;height:16px}
.keys-note h2{font-size:16px;font-weight:500;line-height:20px}
.keys-note p{font-size:13px;line-height:20px;color:var(--text-2)}

/* Loading */
.keys-skel{padding:6px 0}
.keys-skrow{display:flex;align-items:center;gap:24px;padding:16px 22px;border-bottom:1px solid var(--line)}
.keys-skrow:last-child{border-bottom:0}
.keys-skrow .sk:first-child{border-radius:8px;flex:0 0 30px}

/* Card list (tablet and phone) */
.keys-list,.keys-msum,.keys-topnew{display:none}
.keys-item{display:flex;flex-direction:column;gap:8px;padding:14px;min-width:0}
.keys-i1{display:flex;align-items:center;gap:8px}
.keys-i1 b{flex:1;font-family:var(--font-code);font-size:14px;font-weight:500}
.keys-i2{display:flex;align-items:center;gap:8px}
.keys-i2 code{flex:1;font-size:12px;color:var(--text-3)}
.keys-item .track{background:var(--surface-2)}
.keys-i4{font-size:12px;color:var(--text-2)}
.keys-item.off .keys-i1 b,.keys-item.off code{color:var(--text-3)}

/* Side sheet (create / edit / secret): full height on the right, left border, fade only. The
   header, fields, inputs, buttons and footer are the console dialog's own. */
.scrim:has(> .keys-sheet){justify-content:flex-end;align-items:stretch;padding:0}
.modal.keys-sheet{width:min(460px,100%);height:100%;max-height:none;border:0;border-left:1px solid var(--line-strong);border-radius:0;display:flex;flex-direction:column;overflow:hidden;box-shadow:var(--sh-sheet)}
.keys-sheet .modal-h{padding:20px 24px;border-bottom:1px solid var(--line);flex:0 0 auto}
.keys-sheet .modal-b{flex:1 1 auto;overflow:auto;padding:24px;gap:22px}
.keys-sheet .modal-f{flex:0 0 auto}
.keys-sheet .fld{gap:7px}
.keys-sheet .fld-e:empty,.keys-dlg .fld-e:empty{display:none}
.keys-sheet .fld-h{font-size:12px;color:var(--text-2);line-height:17px}
.keys-rpmu{flex:0 0 auto;font-size:11px;color:var(--text-3);padding-left:8px}
.keys-sheet input[type=date]{color-scheme:light}
[data-theme=dark] .keys-sheet input[type=date]{color-scheme:dark}
.keys-limrow{display:flex;gap:8px;align-items:stretch}
.keys-limrow .c-in{flex:1 1 auto}
.keys-per{flex:0 0 auto}
.keys-per > button{padding:0 10px}
.keys-done{display:flex;align-items:center;gap:12px}
.keys-done-ic{width:40px;height:40px;border-radius:50%;background:var(--ok-soft);color:var(--ok);display:grid;place-items:center;flex:0 0 40px}
.keys-done-ic .i{width:18px;height:18px}
.keys-done > div{display:flex;flex-direction:column;gap:2px;min-width:0}
.keys-done b{font-size:14px;font-weight:500}
.keys-done span{font-size:12px;color:var(--text-2)}
.keys-secret{color:var(--code-str)}
.keys-secret .c-btn{flex:0 0 auto}

/* Centered dialogs (rotate / disable / delete) */
.modal.keys-dlg{width:min(480px,100%)}
/* Status icon left, the dialog's standard close (32px, no border) right */
.keys-dlg-h{display:flex;justify-content:space-between;align-items:flex-start}
.keys-dlg-h .icon-btn{width:32px;height:32px;margin:-4px -6px 0 0}
.keys-dlg-h .icon-btn .i{width:16px;height:16px}
.keys-dlg-ic{width:40px;height:40px;border-radius:50%;display:grid;place-items:center}
.keys-dlg-ic .i{width:18px;height:18px}
.keys-dlg-ic.warn{background:var(--warn-soft);color:var(--warn)}
.keys-dlg-ic.err{background:var(--err-soft);color:var(--err)}
.keys-dlg-t{font-size:18px;font-weight:500;letter-spacing:-.3px;line-height:24px}
.keys-dlg-p{font-size:13px;line-height:19px;color:var(--text-2);margin-top:4px}
/* Inset panel */
.keys-kv{background:var(--bg-alt);border:1px solid var(--line);border-radius:10px;padding:0 14px;gap:0}
.keys-kv > div{padding:11px 0;border-bottom:1px solid var(--line)}
.keys-kv > div:last-child{border-bottom:0}
.keys-kv > div > span:last-child{font-size:13px}
.keys-dlg-note{display:flex;gap:10px;font-size:12px;line-height:17px;color:var(--text-2)}
.keys-dlg-note .i{width:14px;height:14px;flex:0 0 14px;color:var(--text-2);margin-top:1px}
.keys-typel{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.keys-typel code{background:var(--tint-2);border-radius:6px;padding:2px 7px;font-size:12px;font-weight:400}
.keys-match{color:var(--ok);display:inline-grid}
.keys-match .i{color:var(--ok)}
.keys-blist{list-style:none;display:flex;flex-direction:column;border:1px solid var(--line);border-radius:10px;overflow:hidden;max-height:260px;overflow-y:auto}
.keys-blist li{display:flex;justify-content:space-between;gap:12px;padding:9px 14px;font-size:13px;border-bottom:1px solid var(--line)}
.keys-blist li:last-child{border-bottom:0}
.keys-blist .mono{font-size:12px}
.keys-blist.keys-bfail li{flex-direction:column;gap:2px}
.keys-blist.keys-bfail li span:last-child{color:var(--err);font-size:12px}

/* ---------- Responsive ---------- */
@media (max-width:1360px){
  .keys-tbl .keys-c-created{display:none}
}
@media (max-width:1240px){
  .keys-tbl .keys-c-rpm{display:none}
  .keys-note{flex-basis:320px;width:320px}
}
@media (max-width:1100px){
  .keys-tbl .keys-c-exp{display:none}
}
@media (max-width:1180px){
  .keys-stats{grid-template-columns:repeat(4,minmax(0,1fr))}
}
/* Tablet: cards in a grid, no table */
@media (max-width:900px){
  .keys-tcard{display:none}
  .keys-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .keys-item{background:var(--surface);border-radius:16px;box-shadow:var(--sh-card);padding:16px}
  .keys-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .keys-r3{flex-direction:column}
  .keys-r3 > *{width:auto!important;flex:1 1 auto!important}
}
/* Phone: one list card, summary line, "New key" in the top bar; sheets come up from the bottom */
@media (max-width:720px){
  .keys-head,.keys-stats{display:none}
  .keys-topnew{display:inline-flex}
  .keys-msum{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:13px;color:var(--text-2)}
  .keys-msum .mono{font-size:12px;white-space:nowrap}
  .keys-list{grid-template-columns:1fr;gap:0;background:var(--surface);border-radius:16px;box-shadow:var(--sh-card);overflow:hidden}
  .keys-item{background:none;border-radius:0;box-shadow:none;padding:14px;border-bottom:1px solid var(--line)}
  .keys-item:last-child{border-bottom:0}
  .keys-code{white-space:pre-wrap;word-break:break-all;font-size:12px;line-height:20px;padding:12px 44px 12px 14px}
  .keys-use .card-h{align-items:flex-start}
  .scrim:has(> .keys-sheet){align-items:flex-end}
  .modal.keys-sheet{width:100%;height:auto;max-height:92dvh;border:1px solid var(--line-strong);border-bottom:0;border-radius:16px 16px 0 0}
  .keys-sheet .modal-b{padding:20px 16px}
  .keys-sheet .modal-h,.keys-sheet .modal-f{padding-left:16px;padding-right:16px}
  .keys-sheet .modal-f{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  .keys-limrow{flex-direction:column}
  .keys-per{display:flex}
  .keys-per > button{flex:1}
  .keys-dlg .modal-f .c-btn{flex:1}
}
@media (max-width:420px){
  .keys-expseg > button{padding:0 6px}
}
/* Search box (r128.9): filters the key list by name or prefix. */
.keys-search{max-width:360px;margin:0 0 12px}
.keys-search input{flex:1;min-width:0;border:0;background:none;color:inherit;font:inherit}
.keys-nomatch{padding:18px 16px;color:var(--text-3);text-align:center}
