/* Account pages. Rides on the tokens and buttons already defined in
   ../styles.css; everything here is specific to signing up and onboarding. */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}
@media (min-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr 1fr; }
}

.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 40px 22px; }
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; }

.auth-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 30px; text-decoration: none; }
.auth-brand img { height: 34px; width: auto; }
.auth-brand span { font: 700 1.12rem/1 var(--font, inherit); color: var(--fg); letter-spacing: -.01em; }

.auth-card h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 3.4vw, 2rem); line-height: 1.2; letter-spacing: -.02em; }
.auth-card .lede { margin: 0 0 26px; color: var(--fg-mute); font-size: .98rem; line-height: 1.6; }

.field { margin-bottom: 15px; }
.field label { display: block; margin-bottom: 6px; font-size: .84rem; font-weight: 600; color: var(--fg-mute); }
.field input, .field select {
  width: 100%;
  padding: .78em .9em;
  font: inherit;
  font-size: .95rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220, 141, 31, .18);
}
.field .hint { margin-top: 6px; font-size: .79rem; color: var(--fg-dim); }
.field.bad input { border-color: var(--red); }

.auth-actions { margin-top: 22px; }
.auth-actions .btn { width: 100%; justify-content: center; }

.auth-alt { margin-top: 20px; font-size: .9rem; color: var(--fg-mute); text-align: center; }

.notice {
  margin: 0 0 18px; padding: 11px 14px; border-radius: 10px;
  font-size: .89rem; line-height: 1.5;
  border: 1px solid var(--line-2); background: var(--surface);
}
.notice.err { border-color: rgba(220,100,100,.45); background: rgba(220,100,100,.09); color: #FFD3D3; }
.notice.ok  { border-color: rgba(90,190,110,.45); background: rgba(90,190,110,.09); color: #CFF3D6; }
.notice[hidden] { display: none; }

/* The panel beside the form: what they are actually signing up for. */
.auth-aside {
  display: none;
  padding: 48px 44px;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(220,141,31,.11), transparent 60%),
    var(--bg-2);
  border-left: 1px solid var(--line);
}
@media (min-width: 900px) { .auth-aside { display: flex; flex-direction: column; justify-content: center; } }
.auth-aside h2 { margin: 0 0 26px; font-size: 1.32rem; letter-spacing: -.02em; }

.sell { list-style: none; margin: 0; padding: 0; max-width: 430px; }
.sell li { position: relative; margin-bottom: 22px; padding-left: 30px; }
.sell li::before {
  content: ""; position: absolute; left: 4px; top: .45em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(220,141,31,.16);
}
.sell strong { display: block; margin-bottom: 3px; color: var(--fg); font-size: .97rem; }
.sell span { color: var(--fg-mute); font-size: .9rem; line-height: 1.6; }

.model-pair { display: grid; gap: 12px; margin-top: 30px; }
@media (min-width: 1100px) { .model-pair { grid-template-columns: 1fr 1fr; } }
.model-card { padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.model-card h3 { margin: 0 0 5px; font-size: .95rem; color: var(--fg); }
.model-card p { margin: 0; font-size: .85rem; line-height: 1.55; color: var(--fg-mute); }
.model-card .ctx { display: block; margin-top: 9px; font-size: .75rem; color: var(--accent); letter-spacing: .04em; }

/* Onboarding */
.choices { display: grid; gap: 10px; margin-bottom: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; padding: 13px 16px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: .93rem; color: var(--fg-mute); transition: border-color .15s, color .15s, background .15s;
}
.choice input:checked + span { border-color: var(--accent); color: var(--fg); background: rgba(220,141,31,.09); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(220,141,31,.22); }

.setup-steps { display: flex; gap: 7px; margin-bottom: 26px; }
.setup-steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); }
.setup-steps i.done { background: var(--accent); }

/* Dashboard */
.dash { max-width: 900px; margin: 0 auto; padding: 44px 22px 80px; }
.dash-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; justify-content: space-between; margin-bottom: 30px; }
.panel { padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 16px; }
.panel h2 { margin: 0 0 6px; font-size: 1.04rem; }
.panel p { margin: 0 0 14px; color: var(--fg-mute); font-size: .92rem; line-height: 1.65; }
.panel pre {
  margin: 0; padding: 13px 15px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; color: var(--fg);
}
.pending { display: inline-flex; align-items: center; gap: 7px; font-size: .83rem; color: var(--brand-amber); }

/* ---- Application shell (dashboard, profile) ---------------------------- */

.app-head { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 30; }
.app-head-in { display: flex; align-items: center; gap: 20px; max-width: 1100px; margin: 0 auto; padding: 14px 22px; }
.app-nav { display: flex; gap: 4px; margin-left: auto; }
.app-nav a {
  padding: 7px 13px; border-radius: 9px; font-size: .9rem; font-weight: 500;
  color: var(--fg-mute); text-decoration: none;
}
.app-nav a:hover { background: var(--surface); color: var(--fg); text-decoration: none; }
.app-nav a[aria-current="page"] { background: var(--surface); color: var(--fg); }

.app-body { max-width: 1100px; margin: 0 auto; padding: 38px 22px 90px; }
.app-title { margin: 0 0 4px; font-size: clamp(1.6rem, 3.4vw, 2.1rem); letter-spacing: -.024em; }
.app-sub { margin: 0 0 32px; color: var(--fg-mute); font-size: .97rem; }

.cards { display: grid; gap: 16px; }
@media (min-width: 860px) { .cards.two { grid-template-columns: 1fr 1fr; } }
.card {
  padding: 22px 24px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface);
}
.card > h2 {
  margin: 0 0 4px; font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--fg-dim);
}
.card .big { font-size: clamp(1.9rem, 5vw, 2.5rem); font-weight: 700; letter-spacing: -.03em; color: var(--fg); line-height: 1.1; }
.card .unit { font-size: .9rem; font-weight: 500; color: var(--fg-dim); margin-left: 6px; }
.card .sub { margin: 8px 0 0; font-size: .87rem; color: var(--fg-mute); line-height: 1.55; }

/* Usage meter */
.usage-meter { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 16px 0 9px; }
.usage-meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s ease; }
.usage-meter i.warn { background: var(--brand-amber); }
.usage-meter i.over { background: var(--red); }
.usage-meter-legend { display: flex; justify-content: space-between; font-size: .8rem; color: var(--fg-dim); }

/* A 14-day column chart. Bars are divs — no library, no canvas, and it
   stays legible at any width because the columns flex. */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 92px; margin: 18px 0 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.spark .col i {
  display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
  background: var(--line-2); transition: background .15s;
}
.spark .col.has i { background: var(--accent); opacity: .85; }
.spark .col:hover i { background: var(--accent-hi); opacity: 1; }
.spark-axis { display: flex; justify-content: space-between; font-size: .74rem; color: var(--fg-dim); }

/* Token */
.token-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
.token-val {
  flex: 1 1 260px; min-width: 0; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .83rem;
  color: var(--fg); overflow-x: auto; white-space: nowrap;
}
.token-val.fresh { border-color: var(--accent); color: var(--accent-hi); }

.copyable { position: relative; }
.copyable button.copy {
  position: absolute; top: 9px; right: 9px;
  padding: 4px 9px; font-size: .76rem; font-weight: 600;
  background: var(--surface-2); color: var(--fg-mute);
  border: 1px solid var(--line-2); border-radius: 7px; cursor: pointer;
}
.copyable button.copy:hover { color: var(--fg); border-color: var(--accent); }

.setup-steps-list { counter-reset: s; list-style: none; margin: 0; padding: 0; }
.setup-steps-list > li { position: relative; padding: 0 0 26px 40px; }
.setup-steps-list > li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 0; top: -2px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2);
  font-size: .8rem; font-weight: 700; color: var(--accent);
}
.setup-steps-list > li:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: 6px;
  width: 1px; background: var(--line-2);
}
.setup-steps-list h3 { margin: 2px 0 6px; font-size: 1rem; color: var(--fg); }
.setup-steps-list p { margin: 0 0 11px; font-size: .91rem; line-height: 1.6; color: var(--fg-mute); }
.setup-steps-list pre {
  margin: 0; padding: 12px 14px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
}
.setup-steps-list pre code {
  display: block; white-space: pre; background: none; border: 0; padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem;
  color: var(--fg); line-height: 1.6;
}

.rows { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rows > div { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 14px 18px; background: var(--surface); }
.rows dt { font-size: .88rem; color: var(--fg-mute); margin: 0; }
.rows dd { margin: 0; font-size: .88rem; color: var(--fg); font-weight: 500; }

/* ---- Plans and billing -------------------------------------------------- */

.plan-grid { display: grid; gap: 14px; margin: 4px 0 26px; }
@media (min-width: 820px) { .plan-grid { grid-template-columns: repeat(3, 1fr); } }

.plan {
  display: flex; flex-direction: column;
  padding: 22px 22px 20px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); position: relative;
}
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan .tag {
  position: absolute; top: -9px; left: 22px; padding: 2px 9px;
  border-radius: 99px; background: var(--accent); color: #0A0A0B;
  font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
}
.plan h3 { margin: 0 0 3px; font-size: 1.02rem; }
.plan .cost { display: flex; align-items: baseline; gap: 5px; margin: 10px 0 4px; }
.plan .cost b { font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; color: var(--fg); }
.plan .cost span { font-size: .84rem; color: var(--fg-dim); }
.plan .blurb { margin: 0 0 14px; font-size: .86rem; line-height: 1.5; color: var(--fg-mute); }
.plan ul { list-style: none; margin: 0 0 18px; padding: 0; flex: 1; }
.plan li { position: relative; padding-left: 20px; margin-bottom: 7px; font-size: .86rem; line-height: 1.5; color: var(--fg-mute); }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.plan .btn { width: 100%; justify-content: center; }

.topups { display: grid; gap: 10px; margin-bottom: 8px; }
@media (min-width: 700px) { .topups { grid-template-columns: repeat(3, 1fr); } }
.topup {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--surface); cursor: pointer; font-size: .9rem; color: var(--fg);
  transition: border-color .15s;
}
.topup:hover { border-color: var(--accent); }
.topup b { color: var(--accent-hi); }

.pay-log { width: 100%; border-collapse: collapse; font-size: .86rem; }
.pay-log th, .pay-log td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.pay-log th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); font-weight: 700; }
.pay-log td { color: var(--fg-mute); }
.pay-log .st-paid { color: var(--green); }
.pay-log .st-pending { color: var(--brand-amber); }
.pay-log .st-failed { color: var(--red); }
