/* qooob-paas prototype — full design system compiled from qooob-design
   (tokens.md + components.md) over the live public/styles.css, with the
   deliberate upgrades: solid-teal primary, gradient demoted to logo +
   .btn.signature only, quiet user chat bubbles, Geist + Geist Mono,
   ALL numerals/IDs/meters in mono. Tokens are law; never hard-code a
   value that lives in :root. */

:root {
  /* ---- Surfaces (deep navy console) ---- */
  --bg:        #0b0e14;
  --panel:     #131720;
  --panel-2:   #171c26;
  --raised:    #1c2230;
  --line:        rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.13);

  /* ---- Text ---- */
  --text:  #f5f2f0;
  --muted: #7b879d;
  --faint: #5f6b7e;

  /* ---- Accents ---- */
  --accent:    #00d6c1;   /* TEAL, the one interactive accent */
  --accent-2:  #ff5a1f;   /* ORANGE, brand energy only */
  --grad: linear-gradient(135deg, #00d6c1 0%, #ff5a1f 100%);  /* the signature */

  /* ---- Semantic ---- */
  --ok:   #4ade80;
  --deny: #ef4343;
  --warn: #fbbf24;

  /* ---- Radius (one system) ---- */
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  18px;
  --r-pill: 999px;

  /* ---- Elevation ---- */
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.4);
  --ring:   0 0 0 3px rgba(0,214,193,.18);
  --ring-err: 0 0 0 3px rgba(239,67,67,.18);

  /* ---- Type ---- */
  --font-ui:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:"Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-micro: 11px;
  --fs-small: 12px;
  --fs-sub:   13px;
  --fs-body:  14.5px;
  --fs-h2:    18px;
  --fs-h1:    22px;
  --lh: 1.55;

  /* ---- Spacing (4px base) ---- */
  --s1: 4px;  --s2: 8px;  --s3: 12px;  --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;  --s8: 64px;

  /* ---- Motion ---- */
  --t-fast: .12s; --t: .15s; --t-slow: .25s;
  --ease: cubic-bezier(.2,.6,.2,1);

  /* ---- Ambient (used once, on the app body) ---- */
  --ambient:
    radial-gradient(900px 500px at 100% -10%, rgba(0,214,193,0.10), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(255,90,31,0.08), transparent 55%);

  /* demo ribbon height, overlays offset by this so the ribbon always shows */
  --ribbon-h: 30px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body); line-height: var(--lh);
  background: var(--ambient), var(--bg);
  color: var(--text);
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
h1 { font-size: var(--fs-h1); font-weight: 650; letter-spacing: -0.01em; margin: 14px 0 4px; }
h2 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* numbers, anywhere they carry meaning, are mono + tabular */
.num, .credits, .meter, .ucard-val, .utbl td, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- demo ribbon (AC-2): token color, never a control, always on top ---- */
.demo-ribbon {
  position: sticky; top: 0; z-index: 60;
  height: var(--ribbon-h); line-height: var(--ribbon-h);
  text-align: center; font-size: var(--fs-small); letter-spacing: .02em;
  color: var(--muted); background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* ---- logo (the gradient lives here, always) ---- */
.logo {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: var(--grad); color: #0a0b0e; font-weight: 800; font-size: 16px;
  box-shadow: 0 2px 10px rgba(0,214,193,.3);
}
.logo-lg { width: 44px; height: 44px; border-radius: var(--r); font-size: 26px; }

/* ---- topbar ---- */
.topbar {
  position: sticky; top: var(--ribbon-h); z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: rgba(10,11,14,0.7); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -0.01em; }
.who { color: var(--muted); font-size: var(--fs-sub); }
/* mobile-only menu button; opens the sidebar drawer under 600px */
.nav-toggle { display: none; flex: none; width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  place-items: center; cursor: pointer; transition: var(--t) var(--ease); margin-right: 4px; }
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

/* top-right account menu (Profile / Settings / Usage & billing / Sign out) */
.account { position: relative; }
.account-btn { display: inline-flex; align-items: center; gap: var(--s2); background: transparent;
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 4px 8px 4px 10px; cursor: pointer;
  color: var(--text); font: inherit; transition: var(--t) var(--ease); }
.account-btn:hover { border-color: var(--line-strong); background: var(--raised); }
.account-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.account-btn .who { color: var(--muted); font-size: var(--fs-sub); max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { flex: none; width: 28px; height: 28px; border-radius: var(--r-pill); background: var(--raised);
  border: 1px solid var(--line-strong); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sub); color: var(--text); }
.account-chev { color: var(--faint); transition: transform var(--t) var(--ease); }
.account-btn[aria-expanded="true"] .account-chev { transform: rotate(180deg); }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 248px; padding: 6px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow); }
.account-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-email { display: block; font-size: var(--fs-sub); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-plan { font-size: var(--fs-small); color: var(--muted); }
.account-item { display: block; width: 100%; text-align: left; background: transparent; border: none;
  border-radius: var(--r-sm); padding: 9px 10px; font: inherit; font-size: var(--fs-sub); color: var(--text); cursor: pointer; transition: var(--t-fast); }
.account-item:hover { background: var(--raised); }
.account-item:focus-visible { outline: none; box-shadow: var(--ring); }
.account-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.account-item-quiet { color: var(--muted); }
.account-item-quiet:hover { color: var(--text); }
@media (max-width: 600px) { .account-btn .who { display: none; } .account-btn { padding: 4px; } }

/* ---- buttons ---- */
.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--r-sm);
  padding: 9px 15px; border: 1px solid transparent; transition: var(--t) var(--ease); }
.btn.primary { background: var(--accent); color: #04201d; }
.btn.primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); filter: brightness(.97); }
.btn.signature { background: var(--grad); color: #0a0b0e; }
.btn.signature:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn.signature:active { transform: translateY(0); filter: brightness(.97); }
.btn.ghost { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.link { background: none; border: none; color: var(--muted); padding: 6px; text-decoration: none; }
.btn.link:hover { color: var(--text); }
.btn.danger { background: transparent; color: var(--deny); border-color: rgba(239,67,67,.35); }
.btn.danger:hover { background: rgba(239,67,67,.10); }
.btn.block { width: 100%; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: default; transform: none; filter: none; }

/* ---- auth ---- */
.auth { flex: 1; display: grid; place-items: center; padding: var(--s5); }
.card {
  width: 380px; max-width: 100%; padding: var(--s6);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.card .muted { margin: 0 0 18px; }
.enter-demo { margin-bottom: 6px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: var(--fs-small); margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.field { display: block; margin-bottom: var(--s3); }
.field span { display: block; font-size: var(--fs-small); color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font: inherit;
  background: #0c0e13; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  color: var(--text); transition: var(--t) var(--ease); resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field :is(input,select,textarea):focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.field.error :is(input,textarea,select) { border-color: var(--deny); box-shadow: var(--ring-err); }
.field .hint { font-size: var(--fs-small); color: var(--faint); margin-top: 4px; }
.field .hint.err { color: var(--deny); }
.row { display: flex; gap: 9px; margin-top: 6px; }
.row .btn { flex: 1; }
.msg { margin-top: var(--s3); min-height: 18px; font-size: var(--fs-sub); color: var(--muted); }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--deny); }

/* ---- app shell ---- */
.app { flex: 1; display: grid; grid-template-columns: 264px 1fr; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); padding: var(--s4); display: flex;
  flex-direction: column; gap: var(--s4); overflow: auto; background: rgba(18,20,25,0.4); }
.plan-card { padding: var(--s4); border-radius: var(--r);
  background: linear-gradient(180deg, var(--raised), var(--panel)); border: 1px solid var(--line-strong);
  text-align: left; cursor: pointer; transition: var(--t) var(--ease); font: inherit; color: var(--text); }
.plan-card:hover { border-color: var(--accent); }
.plan-card:focus-visible { outline: none; box-shadow: var(--ring); }
.plan-name { font-weight: 700; font-size: 15px; }
.plan-name::after { content: " plan"; color: var(--faint); font-weight: 500; }
.credits { margin-top: 6px; color: var(--accent); font-weight: 600; font-size: var(--fs-sub);
  display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.coin { color: var(--accent-2); }
.section-label { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.section-label-row { display: flex; align-items: center; justify-content: space-between; }
.section-link { padding: 0; font-size: var(--fs-micro); text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { background: #0e1016; border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 9px; font-size: var(--fs-small); color: var(--muted); }
.skills .chip { color: var(--text); }
/* studio chips in the sidebar are interactive */
#studios .chip { cursor: pointer; transition: var(--t) var(--ease); color: var(--text); }
#studios .chip:hover { border-color: var(--accent); }
#studios .chip:focus-visible { outline: none; box-shadow: var(--ring); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s2); }

/* status pill */
.pill { font-size: var(--fs-micro); padding: 1px 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); color: var(--muted); display: inline-block; }
.pill.ok { color: var(--ok); border-color: rgba(74,222,128,.3); }
.pill.deny { color: var(--deny); border-color: rgba(248,113,113,.35); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,.3); }
.pill.accent { color: var(--accent); border-color: rgba(0,214,193,.35); }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; min-height: 0; }
.log { flex: 1; overflow: auto; padding: 26px 24px; display: flex; flex-direction: column; gap: 18px; }

.empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 8px 0 14px; }
.examples { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; max-width: 520px; }
.ex { font: inherit; font-size: var(--fs-sub); cursor: pointer; color: var(--text); background: var(--raised);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 7px 14px; transition: var(--t) var(--ease); }
.ex:hover { border-color: var(--accent); transform: translateY(-1px); }
.ex:focus-visible { outline: none; box-shadow: var(--ring); }

.msg-row { display: flex; gap: var(--s3); max-width: 760px; width: 100%; margin: 0 auto; }
.msg-row.user { flex-direction: row-reverse; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sub); }
.avatar.a { background: var(--accent); color: #04201d; }            /* assistant: solid teal */
.avatar.u { background: #232733; color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
.msg-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.msg-row.user .msg-body { align-items: flex-end; }
.msg-name { font-size: var(--fs-micro); color: var(--faint); font-weight: 600; }
.bubble { white-space: pre-wrap; word-wrap: break-word; padding: 11px 15px; border-radius: 14px; }
.msg-row.assistant .bubble { background: var(--panel-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg-row.user .bubble { background: var(--raised); border: 1px solid var(--line-strong);
  color: var(--text); font-weight: 500; border-top-right-radius: 4px; }   /* quiet raised fill, not gradient */

.tool-row { display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; width: 100%; margin: -8px auto 0; padding-left: 42px; }
.toolchip { font-size: var(--fs-micro); padding: 2px 9px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--muted); background: #0e1016; font-family: var(--font-mono); }
.toolchip.ok { color: var(--ok); border-color: rgba(74,222,128,.3); }
.toolchip.deny { color: var(--deny); border-color: rgba(248,113,113,.35); }

.dots { display: inline-flex; gap: 4px; padding: 13px 15px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 14px; border-top-left-radius: 4px; width: fit-content; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { opacity: .3; transform: translateY(0);} 30% { opacity: 1; transform: translateY(-3px);} }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: .6; } }

/* ---- composer ---- */
.composer-wrap { border-top: 1px solid var(--line); padding: 14px 24px 10px; background: rgba(10,11,14,0.5); }
.deep { display: inline-flex; align-items: center; gap: var(--s2); margin: 0 auto 10px; max-width: 760px; width: 100%;
  font-size: 12.5px; color: var(--muted); cursor: pointer; }
.deep input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 32px; height: 18px; border-radius: var(--r-pill); background: #2a2e3a; position: relative; transition: var(--t); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: var(--t); }
.deep input:checked + .switch { background: var(--accent); }
.deep input:checked + .switch::after { transform: translateX(14px); }
.deep input:focus-visible + .switch { box-shadow: var(--ring); }
.composer { display: flex; gap: var(--s3); align-items: flex-end; max-width: 760px; width: 100%; margin: 0 auto;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 16px; padding: 8px 8px 8px 14px; transition: var(--t) var(--ease); }
.composer:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.composer textarea { flex: 1; resize: none; border: none; background: none; color: var(--text); font: inherit; padding: 6px 0; max-height: 160px; outline: none; }
.send { flex: none; width: 36px; height: 36px; border-radius: 11px; border: none; background: var(--accent);
  color: #04201d; display: grid; place-items: center; cursor: pointer; transition: var(--t); }
.send:hover { filter: brightness(1.08); }
.send:focus-visible { outline: none; box-shadow: var(--ring); }
.send:disabled { opacity: .5; }
.meter { max-width: 760px; width: 100%; margin: 8px auto 0; color: var(--faint); font-size: 11.5px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; min-height: 14px; }

/* ---- banner ---- */
.banner { padding: 10px 16px; text-align: center; font-size: 13.5px; }
.banner.warn { background: #2a2410; color: var(--warn); border-bottom: 1px solid #463b16; }
.banner.info { background: var(--panel); color: var(--muted); }
.banner.ok { background: rgba(74,222,128,.10); color: var(--ok); border-bottom: 1px solid rgba(74,222,128,.25); }

@media (max-width: 600px) {
  .nav-toggle { display: grid; }
  .app { grid-template-columns: 1fr; }
  /* the sidebar becomes a slide-in drawer toggled by the topbar menu */
  .sidebar { position: fixed; top: calc(var(--ribbon-h) + 53px); left: 0; bottom: 0; width: 264px;
    max-width: 84%; z-index: 25; background: var(--panel); border-right: 1px solid var(--line-strong);
    transform: translateX(-100%); transition: transform var(--t-slow) var(--ease); }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  .app.nav-open::before { content: ""; position: fixed; inset: 0; z-index: 24; background: rgba(5,6,9,.55); }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ---- overlays (usage/billing pattern + router host). Start BELOW the ribbon (AC-2). ---- */
.overlay { position: fixed; inset: var(--ribbon-h) 0 0 0; z-index: 30; background: var(--bg); overflow: auto; }
.overlay-inner { max-width: 1160px; margin: 0 auto; padding: 26px 32px 64px; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.overlay-head .head-titles { display: flex; flex-direction: column; gap: 4px; }
.overlay-head .head-sub { color: var(--muted); font-size: var(--fs-sub); }

.usage-h3 { font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 28px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.ucard { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.ucard-label { font-size: var(--fs-small); color: var(--muted); }
.ucard-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ucard-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.utbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sub); }
.utbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-micro);
  text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.utbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--text); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.utbl tr:last-child td { border-bottom: none; }
.utbl td.neg { color: var(--deny); }
.utbl td.pos { color: var(--ok); }
.utbl tr.totals td { font-weight: 700; background: var(--panel); }
@media (max-width: 600px) { .cards { grid-template-columns: repeat(2, 1fr); } }

/* ---- file ingest ---- */
.attachments { display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; width: 100%; margin: 0 auto 8px; }
.filechip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); background: var(--raised);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 4px 6px 4px 11px; color: var(--text); }
.filechip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.filechip button:hover { color: var(--deny); }
.attach { flex: none; width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: var(--t) var(--ease); }
.attach:hover { color: var(--accent); border-color: var(--accent); }
.attach:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---- onboarding form ---- */
.card-wide { width: 560px; max-height: 84vh; overflow: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- sessions list ---- */
.sessions { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.session { text-align: left; font: inherit; font-size: 12.5px; color: var(--muted); background: transparent;
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 7px 9px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: var(--t-fast); }
.session:hover { background: var(--raised); color: var(--text); }
.session:focus-visible { outline: none; box-shadow: var(--ring); }
.session.active { background: var(--raised); color: var(--text); border-color: var(--line-strong); }

/* ---- billing ---- */
.billing { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; padding: var(--s4); margin-bottom: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.billing-now { min-width: 140px; }
.billing-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-left: auto; align-items: center; }

/* ---- connectors ---- */
.connectors { display: flex; flex-direction: column; gap: var(--s2); }
.crow { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; background: var(--panel); }
.crow-head { display: flex; align-items: center; gap: var(--s2); }
.cstatus { font-size: var(--fs-micro); padding: 1px 8px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--muted); }
.cstatus.ok { color: var(--ok); border-color: rgba(74,222,128,.3); }
.crow-action { display: flex; gap: var(--s2); margin-top: 9px; align-items: center; }
.cinput { flex: 1; padding: 8px 11px; font: inherit; font-size: var(--fs-sub); background: #0c0e13;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--text); transition: var(--t) var(--ease); }
.cinput:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ============================================================
   Shared scaffolding the to-build screens (screens/*.js) need.
   Screens prefer these; one-offs get namespaced scr-<name>-*.
   ============================================================ */

/* panel sections */
.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); }
.panel + .panel { margin-top: var(--s4); }
.panel-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.panel-sub { color: var(--muted); font-size: var(--fs-sub); margin: 0 0 var(--s4); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.panel-head .panel-sub { margin: 0; }

/* read-weight definition rows (profile/settings view state) */
.deflist { display: flex; flex-direction: column; gap: var(--s3); }
.defrow { display: grid; grid-template-columns: 160px 1fr; gap: var(--s4); align-items: start; }
.defrow dt { color: var(--muted); font-size: var(--fs-sub); }
.defrow dd { margin: 0; color: var(--text); }
.defrow dd.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .defrow { grid-template-columns: 1fr; gap: 2px; } }

/* generic toggle (settings notifications), tokens.md / components.md pattern */
.toggle { display: inline-flex; align-items: center; gap: var(--s2); font-size: 12.5px; color: var(--muted); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(14px); }
.toggle input:focus-visible + .switch { box-shadow: var(--ring); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tr-label { font-size: var(--fs-sub); color: var(--text); }
.toggle-row .tr-sub { font-size: var(--fs-small); color: var(--faint); margin-top: 2px; }

/* studios grid (studios-index) */
.studios-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
@media (max-width: 720px) { .studios-grid { grid-template-columns: 1fr; } }
.studio-card { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4);
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--r); text-align: left; cursor: pointer; transition: var(--t) var(--ease); color: var(--text); font: inherit; }
.studio-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.studio-card:focus-visible { outline: none; box-shadow: var(--ring); }
.studio-card.locked { cursor: default; opacity: .72; }
.studio-card.locked:hover { border-color: var(--line); transform: none; }
.studio-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.studio-card-name { font-weight: 600; font-size: 15px; }
.studio-card-purpose { color: var(--muted); font-size: var(--fs-sub); }
.studio-card .chips { margin-top: 4px; }

/* three-column plan comparison (plan-upgrade) */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); align-items: stretch; }
@media (max-width: 820px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-col { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5) var(--s4);
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); }
.plan-col.recommended { border-color: rgba(0,214,193,.35); box-shadow: 0 0 0 1px rgba(0,214,193,.12); }
.plan-col-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.plan-col-name { font-weight: 700; font-size: 16px; }
.plan-price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.plan-price-note { color: var(--faint); font-size: var(--fs-small); }
.plan-credits { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; font-size: var(--fs-sub); }
.plan-credits .coin { color: var(--accent-2); }
.plan-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.plan-features li { font-size: var(--fs-sub); color: var(--text); padding-left: 20px; position: relative; line-height: 1.45; }
.plan-features li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }
.plan-col .btn { margin-top: auto; }

/* the one acceptable modal in the whole prototype: delete-account confirm (settings) */
.scr-modal-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5,6,9,.62); display: grid; place-items: center; padding: var(--s4); }
.scr-modal { width: 420px; max-width: 100%; padding: var(--s5); background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.scr-modal h2 { margin-bottom: 6px; }
.scr-modal .modal-actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s4); }

/* skeletons (loading) */
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%; border-radius: var(--r-sm); animation: shimmer 1.4s infinite; }
.sk-line { height: 12px; margin: 8px 0; }
.sk-line.w-60 { width: 60%; } .sk-line.w-80 { width: 80%; } .sk-line.w-40 { width: 40%; }
.sk-card { height: 76px; border-radius: var(--r); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ============================================================
   Phone optimization (<= 600px). Tighter gutters, stacked
   layouts, no clipped controls or dead space.
   ============================================================ */
@media (max-width: 600px) {
  /* reclaim horizontal space: 16px gutters instead of 32 */
  .overlay-inner { padding: 20px 16px 56px; }
  .overlay-head { margin-bottom: var(--s4); gap: var(--s3); }
  .overlay-head h2, .overlay-head .head-titles { min-width: 0; }
  .usage-h3 { margin: 22px 0 10px; }

  /* chat: more room for bubbles, lighter padding */
  .log { padding: 18px 14px; gap: 14px; }
  .composer-wrap { padding: 12px 14px 8px; }
  .msg-row { gap: var(--s2); }

  /* billing block: stack cleanly, full-width actions, no dead space */
  .billing { flex-direction: column; align-items: stretch; gap: var(--s3); padding: var(--s3); }
  .billing-actions { margin-left: 0; flex-direction: column; align-items: stretch; gap: var(--s2); }
  .billing-actions .btn { width: 100%; }

  /* connector action row: wrap so Connect/Replace/Remove never clip off-screen */
  .crow-action { flex-wrap: wrap; }
  .crow-action .cinput { flex: 1 1 100%; }

  /* plan comparison: cards hug their content (no stretched dead space) */
  .plan-grid { align-items: start; }
  .plan-col { padding: var(--s4); gap: var(--s2); }
  .plan-col .btn { margin-top: var(--s3); }

  /* settings section tabs read as a scrollable row, not a tall stacked list */
  .scr-settings-grid > :first-child { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 4px; }
}
