/* Styles shared by the console pages under /app/console/. Linked before /nav.css. */
  :root {
    --paper: #FFFFFF; --canvas: #FDFBFA; --mist: #F8F5F3; --blush: #FDECEE; --line: #EDE7E5; --edge: #DFD7D4;
    --ink: #16110F; --body: #57504D; --mute: #6F6663;
    --red: #E10E32; --red-d: #C40C2A; --btn: #D60D2C; --flame: #FF2D46; --green: #0B7A54;
    --display: "Fraunces", Georgia, serif; --sans: "Inter", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --shell: 1440px; --pad: clamp(20px, 4.5vw, 60px);
    --sh-1: 0 1px 2px rgba(22,17,15,.04), 0 2px 8px rgba(22,17,15,.03);
    --sh-2: 0 1px 2px rgba(22,17,15,.05), 0 6px 16px rgba(22,17,15,.05), 0 16px 40px rgba(22,17,15,.04);
    --sh-3: 0 2px 6px rgba(22,17,15,.06), 0 14px 32px rgba(22,17,15,.07), 0 32px 72px rgba(22,17,15,.06);
    --sh-red: 0 4px 14px rgba(214,13,44,.22), 0 12px 32px rgba(214,13,44,.16);
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100vh; display: flex; flex-direction: column; background: var(--canvas); color: var(--body); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
  a { color: var(--red); text-underline-offset: 3px; text-decoration-thickness: 1px; }
  a:hover { color: var(--red-d); }
  :focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
  h1, h2, h3 { color: var(--ink); font-weight: 600; line-height: 1.16; letter-spacing: -.012em; }
  .display { font-family: var(--display); font-weight: 600; font-variation-settings: "opsz" 24, "SOFT" 0, "WONK" 0; letter-spacing: .002em; line-height: 1.1; }
  .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .mark { width: 22px; height: 22px; flex: none; color: var(--red); display: block; }
  [hidden] { display: none !important; }

  .nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--line); }

  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: -.01em; padding: 10px 18px; border-radius: 10px; text-decoration: none; border: 1px solid transparent; white-space: nowrap; cursor: pointer; transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms cubic-bezier(.34,1.3,.5,1), box-shadow 220ms ease; }
  .btn-primary { background: var(--btn); color: #fff; box-shadow: var(--sh-red); }
  .btn-primary:hover { background: var(--red-d); transform: translateY(-1px); }
  .btn-ghost { background: var(--paper); border-color: var(--edge); color: var(--ink); box-shadow: var(--sh-1); }
  .btn-ghost:hover { border-color: var(--red); color: var(--red); }
  .btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
  .btn:active { transform: translateY(0); }
  .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
  .btn-danger { color: var(--red-d); }
  .btn-danger:hover { background: var(--blush); border-color: #F3B4BE; }

  /* Console shell: section nav on the left, the page on the right. */
  .console { flex: 1; width: 100%; max-width: 1280px; margin-inline: auto; padding: clamp(24px, 4vh, 44px) var(--pad) 72px; display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 40px; align-items: start; }
  .cnav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
  .cnav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--body); text-decoration: none; transition: background 140ms ease, color 140ms ease; }
  .cnav a:hover { background: var(--mist); color: var(--ink); }
  .cnav a[aria-current=page] { background: var(--blush); color: var(--red-d); }
  .cnav .who { margin-top: 18px; padding: 0 12px; font-family: var(--mono); font-size: 11.5px; color: var(--mute); word-break: break-all; }
  .cbody { min-width: 0; }
  @media (max-width: 860px) {
    .console { grid-template-columns: 1fr; gap: 18px; }
    .cnav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
    .cnav a { white-space: nowrap; padding: 7px 11px; }
    .cnav .who { display: none; }
  }
  .card + .card { margin-top: 20px; }
  .page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
  .page-head h1 { font-size: clamp(30px, 4vw, 40px); }
  .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; }
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
  @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
  .card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-2); padding: 24px; }
  .card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .card h2 small { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .06em; color: var(--mute); text-transform: uppercase; }

  .stat { display: flex; flex-direction: column; gap: 2px; }
  .stat .n { font-family: var(--display); font-weight: 600; font-variation-settings: "opsz" 24; font-size: clamp(34px, 5vw, 46px); line-height: 1; color: var(--ink); letter-spacing: -.01em; }
  .stat .l { font-size: 13px; color: var(--mute); }
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
  .topups { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .topups .btn { min-width: 64px; }
  .custom { display: inline-flex; align-items: center; gap: 6px; }
  .custom input { width: 96px; }
  .fine { font-size: 12.5px; color: var(--mute); margin-top: 12px; }
  .terms { font-size: 12.5px; margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: #F3F7F1; color: #2F5A2A; }
  .terms b { font-weight: 600; }
  .terms code { font-size: 12px; }
  .terms.limit { background: #FFF7E6; color: #7A4D00; }
  .terms.limit a { color: inherit; }
  .topup-form .presets { display: flex; gap: 6px; margin-bottom: 10px; }
  .topup-form .row .field { flex: 1 1 180px; }
  .fx { font-family: var(--mono); font-size: 13px; color: var(--body); margin-top: 8px; min-height: 1.4em; }
  .fx small { font-family: var(--sans); font-size: 12px; color: var(--mute); margin-left: 6px; }
  .fx.err { color: var(--red-d); }

  .field { display: block; }
  .field span { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink); margin-bottom: 5px; }
  input, select { font: inherit; padding: 9px 12px; border: 1px solid var(--edge); border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%; }
  input:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(225,14,50,.12); }
  .row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
  .row .field { flex: 1 1 160px; }
  .row .btn { flex: none; }
  .prefix { position: relative; }
  .prefix::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mute); font-family: var(--mono); font-size: 13px; }
  .prefix input { padding-left: 24px; font-family: var(--mono); }

  .notice { margin: 0 0 18px; padding: 11px 14px; border-radius: 10px; font-size: 14px; border: 1px solid var(--line); background: var(--mist); color: var(--body); display: flex; justify-content: space-between; gap: 12px; align-items: start; }
  .notice-err { border-color: #F3B4BE; background: var(--blush); color: var(--red-d); }
  .notice-ok { border-color: #B9DECF; background: #EAF6F0; color: var(--green); }
  .notice-warn { border-color: #F2D9A6; background: #FFF7E6; color: #7A4D00; }
  .notice button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; opacity: .7; }

  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 500; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
  td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  tr:last-child td { border-bottom: 0; }
  td.num { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
  tr.total td { font-weight: 600; background: #FAFAFA; border-bottom: 2px solid var(--line); }
  .saved { color: #2F5A2A; font-weight: 400; }
  .khead { color: var(--mute); font-size: 11.5px; margin-left: 4px; }
  td.label b { color: var(--ink); font-weight: 600; }
  td.label .k { font-family: var(--mono); font-size: 12px; color: var(--mute); display: block; margin-top: 2px; }
  td .bar { height: 4px; border-radius: 3px; background: var(--mist); margin-top: 6px; overflow: hidden; min-width: 90px; }
  td .bar i { display: block; height: 100%; background: var(--red); border-radius: 3px; }
  tr.exhausted td { background: #FFF5F6; }
  tr.exhausted .bar i { background: var(--red-d); }
  .band { margin-top: 6px; font-size: 12.5px; color: var(--red-d); font-weight: 500; }
  /* A key being deleted: the API side is draining its in-flight requests. Greyed, no actions. */
  tr.waiting td { color: var(--mute); background: #FAFAFA; }
  tr.waiting .bar i { background: #C9C9C9; }
  tr.waiting .band { color: var(--mute); font-weight: 400; }
  tr.waiting .actions { font-size: 12.5px; letter-spacing: .02em; }
  td.actions { white-space: nowrap; text-align: right; }
  td.actions .btn { margin-left: 6px; }
  .tablewrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
  .empty { padding: 26px 0 8px; color: var(--mute); font-size: 14px; text-align: center; }
  .inline-form { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
  .inline-form input { width: 92px; padding: 5px 8px 5px 22px; font-size: 13px; }

  .chart { width: 100%; height: 160px; display: block; }
  .chart .area { fill: var(--red); opacity: .10; }
  .chart .line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
  .chart .pt { fill: #fff; stroke: var(--red); stroke-width: 1.5; }
  .chart .pt.hot { fill: var(--red); }
  .chart .guide { stroke: var(--line); stroke-width: 1; }
  .chart .hover { stroke: var(--mute); stroke-width: 1; stroke-dasharray: 3 3; }
  .chartwrap { position: relative; }
  .ctip { position: absolute; pointer-events: none; z-index: 2; transform: translate(-50%, calc(-100% - 8px)); background: #1A1A1A; color: #fff; font-family: var(--mono); font-size: 12px; line-height: 1.4; padding: 6px 9px; border-radius: 6px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
  .ctip b { font-weight: 600; }
  .chart text { font-family: var(--mono); font-size: 10px; fill: var(--mute); }

  .modal-bg { position: fixed; inset: 0; background: rgba(22,17,15,.45); z-index: 90; display: grid; place-items: center; padding: 20px; }
  .modal { background: var(--paper); border-radius: 18px; box-shadow: var(--sh-3); max-width: 640px; width: 100%; padding: 28px; }
  .modal h2 { font-size: 20px; margin-bottom: 8px; }
  .keybox { display: flex; gap: 8px; align-items: stretch; margin: 14px 0 6px; }
  .keybox code { flex: 1; font-family: var(--mono); font-size: 13px; word-break: break-all; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 10px; background: var(--mist); color: var(--ink); }
  .warn { font-size: 13.5px; color: var(--red-d); font-weight: 500; margin-bottom: 16px; }
  pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--mist); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; color: var(--ink); margin: 8px 0 14px; }
  .modal .btn-primary { width: 100%; margin-top: 8px; }
  .snip-h { font-size: 12.5px; color: var(--mute); margin-top: 10px; }
  /* Models page: one expandable row per model. */
  .mrow { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--paper); }
  .mrow summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 16px; }
  .mrow summary::-webkit-details-marker { display: none; }
  .mrow summary::before { content: "▸"; color: var(--mute); font-size: 12px; width: 10px; }
  .mrow[open] summary::before { content: "▾"; }
  .mrow .mname { font-weight: 600; color: var(--ink); }
  .mrow .mid { font-family: var(--mono); font-size: 12.5px; color: var(--mute); }
  .mrow .mprice { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--body); }
  .mrow .mbody { padding: 0 16px 16px 40px; }
  .mrow .mbody p { font-size: 13px; color: var(--body); margin: 0 0 10px; }
  .mrow.off .mname, .mrow.off .mid { opacity: .55; }
  .mtags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
  .mtag { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--mist); color: var(--body); border: 1px solid var(--edge); }
  .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
  .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .badge-active { background: #EDF7EC; color: #2F6B2A; border-color: #CFE8CB; }
  .badge-down { background: #FDECEC; color: #A61B2B; border-color: #F5C2C7; }
  .badge-unknown, .badge-off { background: var(--mist); color: var(--mute); border-color: var(--edge); }
  .howto { display: grid; gap: 4px; }
  .howto .snip { position: relative; margin-bottom: 8px; }
  .howto pre { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; padding: 12px 84px 12px 14px; background: var(--mist); border: 1px solid var(--edge); border-radius: 10px; white-space: pre-wrap; word-break: break-all; color: var(--ink); }
  .howto .snip .btn { position: absolute; top: 8px; right: 8px; }
  .wallet-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
  .wallet-cta .fine { flex: 1 1 220px; margin: 0; }

  .footer { border-top: 1px solid var(--line); padding: 28px 0 36px; background: var(--mist); }
  .footer-inner { max-width: var(--shell); margin-inline: auto; padding-inline: var(--pad); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
  .footer .mono { font-size: 11px; letter-spacing: .1em; color: var(--mute); }
  .footer-legal { max-width: var(--shell); margin: 18px auto 0; padding-inline: var(--pad); font-size: 12.5px; color: var(--mute); line-height: 1.6; }
  .footer-legal a { color: var(--body); text-decoration: none; }
  .footer-legal a:hover { color: var(--red); text-decoration: underline; }
  .footer-links { margin-top: 6px; }
