/* ── reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── design tokens (WAG corporate theme) ──────────────────── */
:root {
  --primary:         #4B6BFB;
  --primary-hover:   #3657f0;
  --primary-content: #eef0ff;
  --neutral:         #1d2433;
  --neutral-content: #ffffff;
  --base-100:        #ffffff;
  --base-200:        #f2f2f2;
  --base-300:        #e5e6e6;
  --base-content:    #1f2937;
  --base-muted:      #6b7280;
  --error:           #ef4444;
  --error-bg:        #fef2f2;
  --error-border:    #fca5a5;
  --success:         #16a34a;
  --success-bg:      #f0fdf4;
  --success-border:  #86efac;
  --shadow:          0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:       0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --radius:          0.5rem;
  --font:            ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:            ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
}

/* ── base ─────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: #e8eaed;
  color: var(--base-content);
  min-height: 100vh;
}

/* ── header ──────────────────────────────────────────────── */
header {
  background: var(--neutral);
  color: var(--neutral-content);
  height: 3.75rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--neutral-content);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.logo-dot { color: var(--primary); }

.header-sep {
  width: 1px;
  height: 1.25rem;
  background: rgba(255,255,255,.2);
}

.header-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,.5);
  font-weight: 400;
}

.header-spacer { flex: 1; }

.header-user {
  font-size: 0.8rem;
  color: rgba(255,255,255,.6);
  font-family: var(--mono);
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── layout ──────────────────────────────────────────────── */
main {
  max-width: 680px;
  margin: 2rem auto 3rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--base-content);
  line-height: 1.2;
}
.page-title-sub {
  font-size: 0.875rem;
  color: var(--base-muted);
  margin-top: 0.2rem;
}

/* ── card ────────────────────────────────────────────────── */
.card {
  background: var(--base-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  padding: 0.75rem 1.25rem 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--base-muted);
}

.card-body {
  padding: 0.875rem 1.25rem 1.25rem;
}

/* ── identity table ──────────────────────────────────────── */
.id-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.id-table tr + tr td { border-top: 1px solid var(--base-300); }
.id-table td { padding: 0.55rem 0; vertical-align: top; line-height: 1.5; }
.id-table td:first-child {
  width: 9.5rem;
  font-weight: 600;
  color: var(--base-muted);
  padding-right: 1rem;
}
.id-table td:last-child { word-break: break-all; }

.badge {
  display: inline-block;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.78rem;
  margin: 0.1rem 0.15rem 0.1rem 0;
  color: var(--base-content);
}

/* ── actions ─────────────────────────────────────────────── */
.card-desc {
  font-size: 0.875rem;
  color: var(--base-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.actions { display: flex; flex-direction: column; gap: 0.625rem; }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-content);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(75,107,251,.4);
}
.btn-ghost {
  background: transparent;
  color: var(--base-muted);
  border: 1px solid var(--base-300);
}
.btn-ghost:hover {
  background: var(--base-200);
  color: var(--base-content);
}

/* ── alerts ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.05rem; }
.alert-error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: #7f1d1d;
}
.alert-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #14532d;
}

/* ── token result ────────────────────────────────────────── */
.token-row + .token-row { margin-top: 1rem; }

.token-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--base-muted);
  margin-bottom: 0.3rem;
}

.token-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: calc(var(--radius) * 0.75);
  padding: 0.5rem 0.75rem;
  word-break: break-all;
  line-height: 1.6;
  color: var(--base-content);
}

.token-link {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: calc(var(--radius) * 0.75);
  padding: 0.5rem 0.75rem;
  word-break: break-all;
  color: var(--primary);
  text-decoration: none;
  line-height: 1.6;
  transition: background 0.15s;
}
.token-link:hover { background: var(--base-300); text-decoration: underline; }

.token-note {
  font-size: 0.78rem;
  color: var(--base-muted);
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--base-300);
  line-height: 1.5;
}

/* ── divider ─────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--base-300); margin: 0; }

/* ── login page ──────────────────────────────────────────── */
.login-card { max-width: 400px; margin: 3rem auto 0; text-align: center; }
.btn-login  { width: 100%; font-size: 1rem; padding: 0.75rem 1.5rem; }

/* ── quota bar ───────────────────────────────────────────── */
.quota-bar-wrap {
  height: 8px;
  background: var(--base-300);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.quota-bar {
  height: 100%;
  width: var(--quota-pct, 0%);
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.quota-bar-wrap:has(.quota-bar[style*="--quota-pct: 100%"]) .quota-bar {
  background: var(--error);
}
.quota-text {
  font-size: 0.85rem;
  color: var(--base-muted);
}
.quota-full { color: var(--error); }

/* ── disabled generate button ────────────────────────────── */
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
