:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --accent: #b45309;
  --accent-hover: #92400e;
  --gold: #d4a574;
  --border: #e7e5e4;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(28, 25, 23, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand span {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav a.nav-active {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.nav .btn-nav.nav-active {
  background: var(--accent-hover);
}

.nav .btn-nav {
  background: var(--accent);
  color: #fff !important;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.nav .btn-nav:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.cart-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  vertical-align: middle;
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.cta-card {
  display: block;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cta-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 28px rgba(180, 83, 9, 0.08);
  text-decoration: none;
}

.cta-card p {
  margin: 0.35rem 0 0;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero {
  padding: 2.5rem 0 2rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0 auto;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.section {
  margin-top: 2.5rem;
}

.section__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.section__lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 12rem;
  max-width: 24rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}

.toolbar .badge {
  font-size: 0.85rem;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.product-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 28px rgba(180, 83, 9, 0.08);
}

.product-card__cat {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.product-card__name {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  line-height: 1.35;
}

.product-card__code {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.product-card__meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.5rem;
}

.product-card__price {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}

.product-card button {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.55rem;
  border: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.product-card button:hover {
  background: var(--accent);
}

.product-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.product-card__actions button {
  flex: 1;
  min-width: 7rem;
  margin-top: 0;
}

.product-card__actions button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
}

.product-card__actions button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #fffaf5;
}

.empty-state,
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.checkout-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.checkout-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.checkout-panel .hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.form-grid label {
  display: block;
  margin-top: 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.form-grid button[type="submit"] {
  margin-top: 1.15rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.form-grid button[type="submit"]:hover {
  background: var(--accent-hover);
}

#selectedProduct {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  min-height: 1.25rem;
}

.result-box {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #f5f5f4;
  border-radius: 8px;
  font-size: 0.85rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-footer {
  margin-top: 3rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.site-footer .footer-doc-links {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  line-height: 1.5;
}

.site-footer .footer-doc-links a {
  color: var(--muted);
}

.site-footer .footer-doc-links a:hover {
  color: var(--accent);
}

.subhead {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.auth-logged {
  max-width: 32rem;
}

.oauth-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-fb,
.btn-gg {
  flex: 1;
  min-width: 8rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  color: #fff;
}

.btn-fb {
  background: #1877f2;
}

.btn-fb:hover {
  background: #0d65d9;
}

.btn-gg {
  background: #1a73e8;
}

.btn-gg:hover {
  background: #1557b0;
}

.form-msg {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: #b91c1c;
  margin: 0.5rem 0 0;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cart-table th,
.cart-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}

.cart-table th {
  background: #f5f5f4;
  font-weight: 600;
}

.cart-table input {
  width: 100%;
  max-width: 7rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font: inherit;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.my-orders {
  margin: 1rem 0;
}

.order-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.order-list li {
  margin: 0.25rem 0;
}

.cart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.checkout-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.flow-steps {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.flow-steps a {
  font-weight: 500;
}

.fieldset-muted {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.25rem;
  margin: 0.5rem 0 0;
}

.fieldset-muted legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.fieldset-muted.fieldset-disabled {
  opacity: 0.65;
  pointer-events: none;
}

.checkout-form-title {
  margin-top: 2rem;
}

.doc-page {
  max-width: 48rem;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.doc-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: #f5f5f4;
  color: var(--ink);
}

.doc-nav a:hover {
  background: #e7e5e4;
  text-decoration: none;
}

.doc-nav a.doc-nav-active {
  background: var(--accent);
  color: #fff;
}

.doc-page h1 {
  font-size: 1.65rem;
  margin: 0 0 0.5rem;
}

.doc-page h2 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

.doc-page ul {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}

.doc-page .lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 1rem;
}

.doc-figure {
  margin: 1.25rem 0;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.doc-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.doc-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.doc-callout {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.index-doc-links {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.index-doc-links h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.index-doc-links ul {
  margin: 0;
  padding-left: 1.2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 520px) {
  .hero {
    padding-top: 1.5rem;
  }
}
