/* Astro Dashboard brand: deep-space ink, nebula pink → violet → cyan, starfield background */
:root {
  --bg: #05040f;
  --bg-2: #0a0820;
  --panel: rgba(22, 17, 52, .6);
  --panel-solid: #120e2c;
  --panel-2: rgba(36, 27, 82, .55);
  --line: rgba(190, 160, 255, .13);
  --line-2: rgba(190, 160, 255, .26);
  --blue: #8b5cf6;
  --blue-2: #a78bfa;
  --cyan: #67e8f9;
  --violet: #c084fc;
  --text: #f1ecff;
  --text-2: #c4bce6;
  --muted: #8d84b5;
  --grad: linear-gradient(120deg, #f472b6 0%, #8b5cf6 50%, #22d3ee 110%);
  --glow: 0 0 0 1px rgba(139, 92, 246, .4), 0 8px 30px -8px rgba(244, 114, 182, .5);
}
body { background: var(--bg); }

/* starfield + nebula, fixed behind everything */
.astro-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent 60%), radial-gradient(1px 1px at 72% 12%, #fff9, transparent 60%),
    radial-gradient(1.5px 1.5px at 38% 62%, #fff7, transparent 60%), radial-gradient(1px 1px at 86% 48%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 22% 84%, #fff6, transparent 60%), radial-gradient(1.5px 1.5px at 58% 30%, #fffa, transparent 60%),
    radial-gradient(1px 1px at 92% 82%, #fff7, transparent 60%), radial-gradient(1px 1px at 48% 92%, #fff6, transparent 60%),
    radial-gradient(60% 50% at 85% 0%, rgba(139, 92, 246, .28), transparent 70%),
    radial-gradient(45% 40% at 30% 10%, rgba(244, 114, 182, .14), transparent 70%),
    radial-gradient(50% 45% at 60% 100%, rgba(34, 211, 238, .1), transparent 70%);
}
.sidebar { background: linear-gradient(180deg, rgba(12, 9, 32, .88), rgba(6, 5, 18, .92)); }
.nav a.active { background: linear-gradient(90deg, rgba(139, 92, 246, .26), rgba(139, 92, 246, .03)); box-shadow: inset 2px 0 0 #f472b6; }
.nav a:hover { background: rgba(139, 92, 246, .1); }

/* brand mark: planet with a tilted orbit */
.astro-brand { gap: 12px; }
.astro-mark { position: relative; width: 38px; height: 38px; flex: none; }
.astro-mark::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 22px rgba(244, 114, 182, .55); }
.astro-mark::after { content: ''; position: absolute; inset: 13px -1px; border-radius: 50%; border: 1.6px solid rgba(196, 181, 253, .85); transform: rotate(-25deg); }
.brand-text small { color: #f9a8d4; letter-spacing: .32em; }

.st-eyebrow { color: #f9a8d4; }
.st-composer { box-shadow: 0 30px 80px -30px rgba(139, 92, 246, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  background: linear-gradient(180deg, rgba(26, 20, 62, .8), rgba(10, 8, 28, .9)) padding-box,
    conic-gradient(from var(--st-a), rgba(244, 114, 182, .75), rgba(139, 92, 246, .15), rgba(34, 211, 238, .7), rgba(139, 92, 246, .15), rgba(244, 114, 182, .75)) border-box; }
.st-go { box-shadow: 0 10px 30px -8px rgba(244, 114, 182, .6); }
.st-seg button.on { background: rgba(139, 92, 246, .26); box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .45); }

/* characters grid */
.ast-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 18px; }
.ast-char { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; padding: 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); }
.ast-char.ok { border-color: rgba(52, 211, 153, .35); }
.ast-char-art { position: relative; border-radius: 14px; overflow: hidden; background: #0a0820; align-self: start; }
.ast-char-art img { display: block; width: 100%; aspect-ratio: 9/16; object-fit: cover; }
.ast-char-empty { aspect-ratio: 9/16; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); font-size: 12px; border: 1px dashed var(--line-2); border-radius: 14px; }
.ast-char-empty svg { width: 28px; height: 28px; color: var(--blue-2); }
.ast-ok { color: var(--mint); }
.ast-char-body { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ast-char-body .lbl-sm { margin-top: 6px; }
.ast-vers button { padding: 5px 10px; font-size: 12px; }
.ast-char-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.ast-char-actions .input { flex: 1; min-width: 160px; height: 34px; }
@media (max-width: 640px) { .ast-char { grid-template-columns: 1fr; } .ast-char-art { max-width: 220px; } }

/* ---------- result card actions ---------- */
.st-adds { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.st-add { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(139, 92, 246, .1); color: var(--text-2); font-size: 12px; cursor: pointer; transition: .15s; }
.st-add svg { width: 13px; height: 13px; }
.st-add:hover:not(:disabled) { color: #fff; border-color: #f472b6; background: rgba(244, 114, 182, .14); }
.st-add:disabled { color: var(--mint); border-color: rgba(52, 211, 153, .35); cursor: default; }
.st-static { gap: 8px; padding-right: 14px; color: var(--text); }
.st-static svg { width: 14px; height: 14px; color: #f9a8d4; }
.st-seg a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.st-seg a svg, .st-seg button > svg { width: 15px; height: 15px; }
.st-seg a.on { background: rgba(139, 92, 246, .26); color: #fff; box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .45); }
.st-tile figcaption small svg { width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; }
.st-imp { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 56vh; overflow: auto; }
.st-imp button { display: grid; gap: 2px; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(20, 15, 50, .6); color: var(--text); cursor: pointer; }
.st-imp button small { color: var(--muted); font-size: 11.5px; }
.st-imp button.on { border-color: #f472b6; box-shadow: 0 0 0 3px rgba(244, 114, 182, .2); }
.st-imp button:disabled { opacity: .45; cursor: default; }

/* ---------- signed-in user + sign-in screen ---------- */
.sidebar { display: flex; flex-direction: column; }
.sidebar-foot { margin-top: auto; }
.ast-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(20, 15, 50, .5); }
.ast-me div { flex: 1; min-width: 0; display: grid; }
.ast-me b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.ast-me small { color: var(--muted); font-size: 11px; }
.st-orb.sm { width: 30px; height: 30px; font-size: 13px; box-shadow: none; }
body.signed-out .sidebar { display: none; }
body.signed-out .shell { grid-template-columns: 1fr; }
.ast-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.ast-login { width: min(400px, 100%); display: grid; gap: 14px; padding: 34px 30px; border-radius: 26px; text-align: left;
  background: linear-gradient(180deg, rgba(26, 20, 62, .82), rgba(10, 8, 28, .92)); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -30px rgba(139, 92, 246, .6); backdrop-filter: blur(18px); }
.ast-login h1 { margin: 6px 0 0; font: 700 30px var(--display); letter-spacing: -.02em; }
.ast-login > p { margin: -8px 0 6px; color: var(--text-2); }
.ast-login .st-go { justify-content: center; margin-top: 4px; }
.astro-mark.big { width: 56px; height: 56px; }
.astro-mark.big::before { inset: 13px; }
.astro-mark.big::after { inset: 19px -2px; border-width: 2px; }
.ast-err { margin: 0; min-height: 1em; color: var(--rose); font-size: 13px; }

/* ---------- admin ---------- */
.ast-panel { padding: 20px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 18px; }
.ast-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ast-panel-head h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 600 18px var(--display); }
.ast-panel-head h2 svg { width: 17px; height: 17px; color: #f9a8d4; }
.ast-table { display: grid; }
.ast-tr { display: grid; grid-template-columns: minmax(150px, 1.4fr) 120px 100px 110px minmax(250px, auto); gap: 12px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); }
.ast-tr.th { border-top: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ast-who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.ast-who b { overflow: hidden; text-overflow: ellipsis; }
.ast-mini { background: rgba(20, 15, 50, .7); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; }
.ast-acts { display: flex; justify-content: flex-end; gap: 4px; }
.ast-usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.ast-u { padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(8, 6, 22, .45); display: grid; gap: 12px; }
.ast-u-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; }
.ast-bar { height: 6px; border-radius: 6px; background: rgba(139, 92, 246, .14); overflow: hidden; }
.ast-bar i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }
.ast-nums { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.ast-nums b { display: block; font: 600 17px var(--display); }
.ast-nums small { color: var(--muted); font-size: 10.5px; }
.ast-models { display: flex; flex-wrap: wrap; gap: 6px; }
.ast-models-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.ast-model { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(8, 6, 22, .45); cursor: pointer; opacity: .6; transition: .15s; }
.ast-model.on { opacity: 1; border-color: rgba(196, 181, 253, .35); }
.ast-model div { display: grid; min-width: 0; }
.ast-model small { color: var(--muted); font-size: 11.5px; }
.ast-switch { appearance: none; flex: none; width: 42px; height: 24px; border-radius: 999px; background: rgba(141, 132, 181, .35); position: relative; cursor: pointer; transition: .2s; margin: 0; }
.ast-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.ast-switch:checked { background: var(--grad); }
.ast-switch:checked::after { left: 21px; }
.ast-switch:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.ast-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 18px; }
.ast-key p { margin: 0 0 14px; font-size: 13px; }
.ast-key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.ast-key-row .input { flex: 1; min-width: 200px; }
.ast-note { grid-column: 1 / -1; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.ast-note svg { width: 15px; height: 15px; color: var(--amber); flex: none; }
/* the table and usage cards adapt to their own width, not the window's */
.ast-table, .ast-u { container-type: inline-size; }
@container (max-width: 820px) {
  .ast-tr { grid-template-columns: 1fr auto auto; }
  .ast-tr.th { display: none; }
  .ast-tr > span:nth-child(4) { display: none; }
  .ast-acts { grid-column: 1 / -1; justify-content: flex-start; }
}
@container (max-width: 480px) { .ast-nums { grid-template-columns: repeat(4, 1fr) !important; } }
.st-tip { margin: 10px 4px 0; font-size: 12.5px; color: var(--muted); }
.ast-nums { grid-template-columns: repeat(8, 1fr); }

/* wallet + costs */
.sidebar-foot { display: grid; gap: 10px; }
.ast-wallet { display: grid; gap: 6px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(139, 92, 246, .16), rgba(20, 15, 50, .5)); }
.ast-w-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.ast-w-row span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ast-w-row svg { width: 13px; height: 13px; color: #f9a8d4; }
.ast-w-row b { font: 600 13px var(--display); }
.ast-w-row small, .ast-w-usd { color: var(--muted); font-size: 11px; font-weight: 400; }
.ast-w-usd { margin-top: -4px; text-align: right; }
.st-est { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.st-est b { font: 600 14px var(--display); color: #fff; }
.st-est small { color: var(--muted); margin-left: 4px; }
.st-cost { color: #f9a8d4; font-weight: 600; }
.ast-nums { grid-template-columns: repeat(9, 1fr); }

/* live progress on running cards */
.st-progress { width: min(82%, 260px); display: grid; gap: 6px; justify-items: center; margin-top: 4px; }
.st-pct { font: 700 26px var(--display); letter-spacing: -.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.st-pbar { width: 100%; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.st-pbar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--grad); transition: width .9s linear; }
.st-left { color: var(--text-2); font-size: 11.5px; }

/* references vs frames, character picker */
.st-mode { margin: 4px 0 10px; }
.st-mode button { padding: 6px 12px; font-size: 13px; }
.st-refs { align-items: center; }
.st-frame { width: 72px; height: 72px; }
.st-frame em { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px; font: 600 10px var(--font); font-style: normal; background: rgba(5, 4, 15, .75); }
.st-frame-add { height: 72px; }
.st-arrow { color: var(--muted); display: inline-flex; }
.st-arrow svg { width: 16px; height: 16px; }
.st-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.st-picker-head h3 { margin: 0; }
.st-pick-grid button span { display: inline-flex; align-items: center; gap: 4px; }
.st-pick-grid button span svg { width: 11px; height: 11px; }
.st-pick-grid button.char { aspect-ratio: 9/16; }
.st-extend { border-color: rgba(103, 232, 249, .35); }
.st-extend:hover:not(:disabled) { border-color: var(--cyan); background: rgba(34, 211, 238, .12); }
