:root {
  --bg: #f4efe5;
  --bg-top: #fbf7f0;
  --bg-strong: #efe5d4;
  --surface: #fffdf8;
  --surface-alt: #f8f1e6;
  --ink: #1f1a14;
  --muted: #6b6257;
  --line: #d6c7b2;
  --accent: #0f766e;
  --accent-strong: #0a4f53;
  --accent-ink: #ffffff;
  --warm: #c96b3b;
  --success: #0f766e;
  --warning: #a85616;
  --danger: #8f2d2d;
  --shadow: 0 20px 50px rgba(31, 26, 20, 0.08);
}

:root[data-theme='dark'] {
  --bg: #14181f;
  --bg-top: #1b2430;
  --bg-strong: #222b36;
  --surface: #1e2632;
  --surface-alt: #273140;
  --ink: #e8edf4;
  --muted: #a9b5c6;
  --line: #364252;
  --accent: #2da397;
  --accent-strong: #6ac2bb;
  --accent-ink: #071512;
  --warm: #d98d62;
  --success: #6ee7b7;
  --warning: #fbbf24;
  --danger: #f07b7b;
  --shadow: 0 22px 56px rgba(2, 5, 10, 0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 107, 59, 0.16), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.page-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.site-header { padding: 1.25rem 0 1rem; }
.brand-row, .section-header, .summary-line, .card-meta, .site-footer, .cta-row, .hero-panel, .detail-grid, .dashboard-grid, .checkout-grid, .metric-grid { display: grid; gap: 1rem; }
.brand-row { grid-template-columns: 1fr auto; align-items: center; }
.nav-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.brand-mark { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.03em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.theme-toggle { min-width: 8.5rem; }
.hero-ribbon { margin-top: 1rem; padding: 0.85rem 1rem; background: var(--bg-strong); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.site-main { padding: 1rem 0 4rem; }
.site-footer { padding: 2rem 0 3rem; color: var(--muted); }
.hero-panel, .detail-grid, .checkout-grid, .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hero-panel { align-items: start; padding: 2rem; background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(201, 107, 59, 0.12)); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.hero-card, .stack-card, .summary-card, .purchase-card, .auth-card, .metric-card, .product-card, .detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.hero-card, .stack-card, .summary-card, .purchase-card, .auth-card, .detail-card { padding: 1.5rem; }
.product-card, .metric-card { padding: 1.25rem; }
.product-card-media {
  display: block;
  margin: -0.25rem -0.25rem 0.95rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}
.product-card-media img {
  display: block;
  width: 100%;
  height: clamp(150px, 28vw, 240px);
  object-fit: cover;
}
.card-grid, .stack-list { display: grid; gap: 1rem; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.mini-card { padding: 1rem; background: var(--surface-alt); border-radius: 18px; border: 1px solid var(--line); }
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1rem; }
.metric-card span { display: block; color: var(--muted); margin-bottom: 0.25rem; }
.metric-card strong { font-size: 1.8rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
}
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.ghost { background: transparent; }
.button.small { padding: 0.45rem 0.7rem; font-size: 0.86rem; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.pill, .eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--warm); }
.lead { font-size: 1.1rem; color: var(--muted); }
.flash-stack { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.flash { padding: 0.85rem 1rem; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.flash.error { border-color: rgba(143, 45, 45, 0.35); color: var(--danger); }
.flash.success { border-color: rgba(15, 118, 110, 0.35); }
.text-muted { color: var(--muted); }
.warning-text { color: var(--warning); font-weight: 600; }
.text-success { color: var(--success); }
.text-error { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem 1rem; }
.compact-grid p { margin: 0; }
input, select, textarea {
  width: 100%; padding: 0.75rem 0.9rem; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; margin-top: 0.35rem;
}
.checkbox-row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.75rem; }
.checkbox-row input { width: auto; margin: 0; }
.summary-line { grid-template-columns: 1fr auto; }
.summary-line.total { padding-top: 0.75rem; border-top: 1px solid var(--line); }
.cart-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.empty-state { text-align: center; padding: 3rem 1rem; }
.errorlist, .error-list { color: var(--danger); }
.auth-card { max-width: 540px; margin: 0 auto; }
.prose p { line-height: 1.7; }
.dashboard-form { display: grid; gap: 1.25rem; }
.dashboard-form h2 { margin-top: 0; }
.dashboard-sections { margin-top: 1rem; }
.form-action-dock {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  margin-top: 0.5rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
}
.compact-header { grid-template-columns: 1fr auto; align-items: center; margin-bottom: 1rem; }
.field-block { display: grid; gap: 0.25rem; }
.field-block small, .checkbox-row + small { color: var(--muted); font-size: 0.85rem; }
.form-help, .summary-line small { display: block; color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 0; }
.field-block textarea { min-height: 8rem; resize: vertical; }
select[multiple] { min-height: 12rem; }

@media (max-width: 720px) {
  .brand-row { grid-template-columns: 1fr; }
  .nav-actions { justify-content: flex-start; }
  .site-nav { justify-content: flex-start; }
  .form-action-dock {
    position: static;
    backdrop-filter: none;
  }
}

/* ---- information pages (about, policies, status, changelog) ---- */
.prose { max-width: 52rem; margin: 0 auto; line-height: 1.6; }
.prose h1 { margin: 0.2rem 0 0.6rem; }
.prose h2 { margin: 1.5rem 0 0.4rem; font-size: 1.05rem; }
.prose p { margin: 0.55rem 0; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0.4rem 0; }
.prose li { margin: 0.28rem 0; }
.policy-meta { margin: 0.2rem 0 1.2rem; font-size: 0.9rem; }
.statusline { margin: 0.4rem 0 1rem; }
.status-pill { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; }
.status-pill.ok { background: #124b3c; color: #b8ffe9; }
.status-pill.bad { background: #5a1f2a; color: #ffd0d6; }
.changelog section { margin: 1.5rem 0; }
.changelog section h2 { border-bottom: 1px solid currentColor; padding-bottom: 0.3rem; opacity: 0.95; }
.footlinks { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-bottom: 0.5rem; }
.footlinks a { text-decoration: none; opacity: 0.85; }
.footlinks a:hover { text-decoration: underline; opacity: 1; }
