:root {
  color-scheme: light;
  --page-bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #172033;
  --strong: #101827;
  --muted: #55627d;
  --border: #e1e7f3;
  --accent: #4d5bd7;
  --accent-dark: #303aa4;
  --gold: #a9822d;
  --shadow: 0 18px 45px rgba(22, 32, 55, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page-bg: #0d1320;
    --surface: #151e31;
    --surface-soft: #111a2c;
    --text: #ecf2ff;
    --strong: #f8fbff;
    --muted: #aebbd3;
    --border: #283651;
    --accent: #8097ff;
    --accent-dark: #a8b7ff;
    --gold: #e0bd71;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(77, 91, 215, 0.13), transparent 32%), var(--page-bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-shell,
.site-footer,
.hero,
.section,
.page-hero,
.faq-list {
  width: min(1120px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 850;
  color: var(--strong);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--gold));
  color: #fff;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--strong);
}

.nav-signup {
  color: var(--strong);
}

.nav-logout {
  margin: 0;
}

.nav-logout button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nav-logout button:hover {
  color: var(--strong);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: center;
  padding: 76px 0 42px;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  color: var(--strong);
}

.hero-text,
.page-hero p,
.section p,
.faq-item p {
  color: var(--muted);
  font-size: 17px;
}

.hero-text {
  max-width: 710px;
  margin: 20px 0 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 850;
}

.hero-actions,
.faq-teaser {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid var(--border);
}

.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: var(--surface);
  color: var(--strong);
}

.preview-card,
.info-card,
.note-card,
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.preview-card {
  padding: 24px;
}

.preview-label {
  display: inline-block;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-card h2 {
  margin: 18px 0 8px;
  color: var(--strong);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.preview-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 14px;
  background: var(--surface-soft);
  border-radius: 16px;
}

.preview-grid span {
  color: var(--muted);
}

.preview-grid strong {
  color: var(--strong);
}

.section {
  padding: 34px 0;
}

.three-grid,
.split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.split {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.section h2,
.faq-teaser h2 {
  margin: 0;
  color: var(--strong);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.info-card,
.note-card,
.faq-item {
  padding: 22px;
}

.info-card h2,
.note-card h3,
.faq-item h2 {
  margin: 0 0 8px;
  color: var(--strong);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.faq-teaser {
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.page-hero {
  padding: 72px 0 24px;
}

.page-hero.narrow {
  max-width: 820px;
}

.faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px 0 56px;
}

.auth-page {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  padding: 70px 0 42px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 520px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-card::before {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  border-radius: 999px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.auth-card h1 {
  margin: 0;
  color: var(--strong);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.auth-intro,
.auth-switch,
.field-help {
  color: var(--muted);
}

.auth-intro {
  margin: 14px 0 22px;
  font-size: 16px;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-google {
  width: 100%;
  margin: 4px 0 0;
}

.auth-google.disabled {
  display: block;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  font-weight: 800;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  color: var(--strong);
  font-weight: 800;
}

.form-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
}

.form-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--accent);
}

.field-help {
  margin: 0;
  font-size: 13px;
}

.form-errors,
.field-errors {
  color: #9f1d1d;
  background: #fff5f5;
  border: 1px solid #f0c7c7;
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  .form-errors,
  .field-errors {
    color: #ffd6d6;
    background: #2b171b;
    border-color: #6f3039;
  }
}

.form-errors ul,
.field-errors ul {
  margin: 0 0 0 18px;
  padding: 0;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  margin: 18px 0 0;
}

.auth-switch a {
  color: var(--strong);
  font-weight: 800;
}

.debug-token {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-card h2 {
  margin: 10px 0 8px;
  color: var(--strong);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.history-preview {
  color: var(--muted);
  margin: 0 0 12px;
}

.history-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-badge {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--strong);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.history-badge.neutral {
  background: #f1f5ff;
  border-color: #d8e0fb;
}

.section.narrow {
  max-width: 820px;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

.site-messages {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.site-message {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--strong);
  font-weight: 700;
  font-size: 14px;
}

.dashboard-hero-actions {
  flex-wrap: wrap;
  align-items: center;
}

.dashboard-cta {
  min-width: 200px;
  text-align: center;
}

.button.ghost-quiet {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  box-shadow: none;
}

.button.ghost-quiet:hover {
  color: var(--strong);
  border-color: var(--muted);
  background: var(--surface-soft);
}

.dashboard-empty {
  display: grid;
  gap: 18px;
  align-items: center;
}

@media (min-width: 640px) {
  .dashboard-empty {
    grid-template-columns: 1fr auto;
  }
}

.muted-lead {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.55;
}

.history-card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

@media (max-width: 560px) {
  .history-card-top {
    grid-template-columns: 1fr;
  }
}

.history-card-main {
  text-decoration: none;
  color: inherit;
  display: block;
}

.history-card-main:hover h2 {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.history-delete-form {
  margin: 0;
}

.history-card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.text-link {
  font-weight: 800;
  color: var(--strong);
  text-decoration: none;
  font-size: 14px;
}

.text-link:hover {
  text-decoration: underline;
}

.button.danger {
  background: #b91c1c;
  border: none;
}

.button.danger:hover {
  background: #991b1b;
}

.button.danger-quiet {
  background: #fff7f7;
  color: #991b1b;
  border: 1px solid #fecdd3;
  box-shadow: none;
}

.button.danger-quiet:hover {
  background: #ffe4e6;
}

.inline-form {
  display: inline;
  margin: 0;
}

.hero-actions .inline-form button {
  margin-top: 0;
}

.history-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.history-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-detail-verdict {
  margin: 0 0 18px;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.02em;
  color: var(--strong);
}

.history-detail-block {
  margin-top: 14px;
}

.history-detail-block h3 {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.history-detail-dilemma {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--strong);
}

.history-detail-block.subtle {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.history-detail-actions {
  margin-top: 18px;
}

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.settings-readonly {
  display: grid;
  gap: 14px;
  margin: 0 0 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--border);
}

.settings-readonly dt {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.settings-readonly dd {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--strong);
}

.settings-form {
  margin-top: 8px;
}

.subtle-copy {
  color: var(--muted);
  font-size: 14px;
}

.page-hero.narrow .eyebrow a {
  color: inherit;
  text-decoration: none;
}

.page-hero.narrow .eyebrow a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 42px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.site-footer strong {
  color: var(--strong);
}

@media (max-width: 820px) {
  .nav-shell {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero,
  .three-grid,
  .split,
  .faq-list {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 48px;
  }
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  width: 100%;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 20px 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.pricing-card h2,
.pricing-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--strong);
}

.pricing-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-dark);
  margin: 0 0 10px;
}

.pricing-card-disabled {
  opacity: 0.58;
}

.section-title {
  margin: 0 0 14px;
  font-size: 22px;
  color: var(--strong);
}

.dashboard-usage {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.billing-usage-card {
  max-width: 640px;
}

@media (max-width: 520px) {
  .nav-shell,
  .site-footer,
  .hero,
  .section,
  .page-hero,
  .faq-list {
    width: min(100% - 24px, 1120px);
  }

  .nav-links {
    gap: 10px;
    font-size: 13px;
  }

  .hero h1,
  .page-hero h1 {
    font-size: 42px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .auth-page {
    width: min(100% - 24px, 1120px);
    padding-top: 42px;
  }

  .auth-card {
    padding: 22px;
    border-radius: 22px;
  }
}
