/* Agent One brand: shared design tokens and base components.
 *
 * The Claude Design system the Telegram Mini App was rebuilt with (2026-10):
 * ink header band, lilac ground, white cards with a soft border and a 16px
 * radius, violet primary buttons (#5B47C4), violet caps labels, saffron
 * highlight, and a five-item bottom nav. Bricolage Grotesque (display),
 * Instrument Sans (body) and Spline Sans Mono (code), each falling back to
 * the system font.
 *
 * The ONE token file for the Mini App, the web chat (/account/chat), the
 * account pages and the pay/success/404 pages. It defines --ao-* custom
 * properties and .ao-* classes only, so a page that loads it is unchanged
 * until it opts in.
 *
 * Dark mode, two ways:
 *   - html[data-theme="dark"]: the Mini App sets it from
 *     Telegram.WebApp.colorScheme;
 *   - html.ao-dark: the website pages (web chat, account pages) are light by
 *     default, whatever the OS setting (founder decision 2026-11-09); the
 *     visitor's theme toggle (/js/ao-theme.js) adds this class, and an inline
 *     <head> script restores a saved choice before first paint. The values
 *     are the approved web chat dark design (2026-11-09).
 *
 * Usage rules (brand review 2026-11-09): one primary button colour
 * (--ao-btn #5B47C4, AA with white text); #7C6AEF (--ao-violet) is decorative
 * only (logo tile, progress, focus on ink); saffron is a highlight, never a pay
 * button; radii 10 (inputs, chips) / 14 (buttons) / 20 (cards) / pill. */
:root {
  --ao-ink: #17123B;
  --ao-ink-2: #2A2263;
  --ao-ground: #F4F2FC;
  --ao-card: #FFFFFF;
  --ao-border: #E7E4F4;
  --ao-divider: #F0EEF8;
  --ao-field: #FBFAFF;
  --ao-field-border: #D9D4F0;
  --ao-text: #17123B;
  --ao-muted: #4A4470;
  --ao-on-ink-muted: #C9C3EC;
  --ao-accent: #5B47C4;
  --ao-accent-2: #7C6AEF;
  --ao-btn: #5B47C4;
  --ao-accent-soft: #EDEAF9;
  --ao-saffron: #FFB454;
  --ao-head: #17123B;
  --ao-head-tile: #2A2263;
  --ao-nav: #FFFFFF;
  --ao-danger: #C2362B;
  --ao-success: #1E6B3A;
  --ao-success-soft: #E4F5EA;
  --ao-warn-soft: #FDEBDD;
  --ao-warn: #8A4A12;
  --ao-radius: 16px;
  --ao-radius-sm: 12px;
  /* Website set (web chat, account pages): the proposed brand tokens. */
  /* --ao-card under a neutral name, for files that must not contain the word. */
  --ao-surface: var(--ao-card);
  --ao-ink-raise: #1E1849;
  --ao-ink-3: #2A2263;
  --ao-on-ink: #FFFFFF;
  --ao-on-ink-2: #C9C3EC;
  --ao-line: #E7E4F4;
  --ao-line-2: #F0EEF8;
  --ao-text-2: #4A4470;
  --ao-btn-hover: #4E3BB0;
  --ao-link: #5B47C4;
  --ao-violet: #7C6AEF;
  --ao-lilac: #EDEAF9;
  --ao-field-line: #C9C3EC;
  --ao-warn-bg: #FFF4E5;
  --ao-telegram: #2AABEE;
  --ao-discord: #5865F2;
  --ao-r-sm: 10px;
  --ao-r-btn: 14px;
  --ao-r-card: 20px;
  --ao-r-pill: 999px;
  --font-display: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ao-ground: #0F0C24;
  --ao-card: #1D1840;
  --ao-border: #2E2860;
  --ao-divider: #2A2456;
  --ao-field: #161233;
  --ao-field-border: #3A3373;
  --ao-text: #F4F2FC;
  --ao-muted: #B5AEDC;
  --ao-accent: #A99BFF;
  --ao-accent-2: #7C6AEF;
  --ao-btn: #7C6AEF;
  --ao-accent-soft: #2E2860;
  --ao-head: #07051A;
  --ao-head-tile: #1D1840;
  --ao-nav: #1D1840;
  --ao-danger: #FF8A80;
  --ao-success: #7EDC9E;
  --ao-success-soft: #173B26;
  --ao-warn-soft: #3D2A14;
  --ao-warn: #FFC98A;
  color-scheme: dark;
}

/* The website pages with dark mode switched on by the visitor (<html class="ao-dark">,
 * set by the theme toggle): the approved web chat dark values. Light is the
 * default; the OS dark setting does not apply. The ink header band and
 * sidebar stay ink. */
html.ao-dark {
  --ao-ground: #100C2A;
  --ao-card: #17123B;
  --ao-border: #2A2263;
  --ao-divider: #221B4D;
  --ao-field: #17123B;
  --ao-field-border: #3A3373;
  --ao-text: #F4F2FC;
  --ao-muted: #C9C3EC;
  --ao-accent-soft: #1E1849;
  --ao-line: #2A2263;
  --ao-line-2: #221B4D;
  --ao-text-2: #C9C3EC;
  --ao-link: #B4A8FF;
  --ao-lilac: #1E1849;
  --ao-field-line: #3A3373;
  --ao-warn-bg: #3D2A14;
  --ao-warn: #FFC98A;
  --ao-success: #7EDC9E;
  --ao-success-soft: #173B26;
  --ao-danger: #FF8A80;
  color-scheme: dark;
}

/* Website header band: the A1 mark + "Agent One" on ink, on every signed-in
 * and payment page (account, pay-by-card, success, 404). */
.ao-site-head {
  background: #17123B;
  color: #FFFFFF;
}

.ao-site-head-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.ao-site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
}

.ao-site-brand:hover { color: #FFFFFF; }

.ao-site-brand:focus-visible { outline: 3px solid var(--ao-saffron); outline-offset: 3px; border-radius: 6px; }

@media (max-width: 520px) {
  .ao-site-head-inner { padding: 12px 16px; }
}


/* Header band: the ink strip every screen starts with. */
.ao-head {
  background: var(--ao-head);
  color: #FFFFFF;
  padding: 16px 18px 20px;
}

.ao-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

/* Card: white, soft border, 16px radius. */
.ao-card {
  background: var(--ao-card);
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  padding: 16px;
}

/* Primary button. */
.ao-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--ao-btn);
  border: 0;
  border-radius: 14px;
  text-decoration: none;
  cursor: pointer;
}

.ao-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Label: small violet caps above a value or a field. */
.ao-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ao-accent);
}

/* Bottom navigation: five equal items, 48px+ targets, active in violet. */
.ao-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 4px 14px;
  background: var(--ao-nav);
  border-top: 1px solid var(--ao-border);
}

.ao-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--ao-muted);
  background: none;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}

.ao-nav-item[aria-current="page"] {
  color: var(--ao-accent);
  font-weight: 700;
}

/* Website theme toggle (web chat sidebar, account header): a 44px icon button
 * on ink. Shows a moon in light mode and a sun in dark mode. */
.ao-theme-toggle {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ao-on-ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ao-theme-toggle:hover { background: var(--ao-ink-3); color: #FFFFFF; }
.ao-theme-toggle:focus-visible { outline: 3px solid var(--ao-saffron); outline-offset: 2px; }
.ao-theme-toggle .ao-theme-sun { display: none; }
html.ao-dark .ao-theme-toggle .ao-theme-sun { display: block; }
html.ao-dark .ao-theme-toggle .ao-theme-moon { display: none; }
