:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #1c1a16;
  --muted: #6b665c;
  --accent: #1f5c3a;
  --accent-dark: #163f29;
  --accent-soft: #e4efe7;
  --gold: #b8892b;
  --gold-soft: #f6ead0;
  --danger: #a33a2a;
  --danger-soft: #f8e3df;
  --line: #d8d0c0;
  --shadow: 0 10px 30px rgba(28, 26, 22, 0.08);
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted);
}
[hidden] { display: none !important; }

/* ---- top navigation --------------------------------------------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1140px; margin: 0 auto; padding: 0.7rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--accent); text-decoration: none; letter-spacing: 0.02em; }
.brand small { display: block; font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-left: auto; }
.nav a {
  text-decoration: none; color: var(--ink); padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.92rem;
}
.nav a:hover { background: var(--accent-soft); }
.nav a.active { background: var(--accent); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--muted); }
.user-chip strong { color: var(--ink); font-weight: 600; }

/* ---- layout ----------------------------------------------------------- */
.page { flex: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin-top: 0.35rem; color: var(--muted); max-width: 48rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: 0 2px 8px rgba(28,26,22,0.04);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.9rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .btn, .card-head .badge { white-space: nowrap; flex-shrink: 0; }
.stat { display: flex; flex-direction: column; gap: 0.2rem; }
.stat .value { font-family: var(--serif); font-size: 2rem; color: var(--accent); line-height: 1; }
.stat .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.stat .hint { font-size: 0.85rem; color: var(--muted); }
footer.site-footer { border-top: 1px solid var(--line); padding: 1.25rem; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* ---- buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--accent); color: #fff; border: 1px solid var(--accent); cursor: pointer;
  padding: 0.65rem 1.3rem; border-radius: 999px; font-family: var(--sans); font-size: 0.92rem;
  letter-spacing: 0.03em; text-decoration: none; transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover, .btn:focus-visible { background: var(--accent-dark); border-color: var(--accent-dark); outline: none; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f1ebdf; }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.gold:hover { background: #9a7222; border-color: #9a7222; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ---- forms ------------------------------------------------------------ */
label.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
label.field span.lbl { font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea, input.plain {
  font: inherit; font-size: 0.95rem; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 0.6rem 0.75rem; width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem; margin: 0 0 1.25rem; background: var(--surface); }
legend { font-family: var(--serif); font-size: 1.1rem; padding: 0 0.4rem; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.92rem; cursor: pointer; }
.check input { margin-top: 0.25rem; }
.radio-cards { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.radio-card { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.85rem; cursor: pointer; background: #fff; display: flex; gap: 0.5rem; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card strong { display: block; font-size: 0.92rem; }
.radio-card span { font-size: 0.78rem; color: var(--muted); }
.error { color: var(--danger); font-size: 0.88rem; }
.notice { background: var(--gold-soft); border: 1px solid #e6cf9d; border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.88rem; }
.notice.green { background: var(--accent-soft); border-color: #bcd6c4; }

/* ---- badges / tables --------------------------------------------------- */
.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.badge.submitted { background: #e9e4f7; color: #4d3c8a; }
.badge.confirmed { background: #dfe9f7; color: #22497a; }
.badge.out_for_delivery { background: var(--gold-soft); color: #7a5a14; }
.badge.delivered { background: var(--accent-soft); color: var(--accent-dark); }
.badge.cancelled { background: #eee; color: #666; }
.badge.unpaid { background: var(--danger-soft); color: var(--danger); }
.badge.sent { background: var(--gold-soft); color: #7a5a14; }
.badge.paid { background: var(--accent-soft); color: var(--accent-dark); }
.badge.premium { background: var(--gold); color: #fff; }
.badge.auto { background: #e4e7ef; color: #3b4660; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8f4ec; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---- product catalog --------------------------------------------------- */
.product-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform 0.15s ease, box-shadow 0.15s ease; text-align: left; padding: 0; cursor: pointer; font: inherit; color: inherit;
}
.product:hover, .product:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); outline: none; }
.product-img { background: #fff; aspect-ratio: 1; display: grid; place-items: center; padding: 1rem; border-bottom: 1px solid var(--line); }
.product-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.product-body .sku { font-size: 0.72rem; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.product-body h3 { font-size: 1.15rem; }
.product-body .sub { color: var(--muted); font-size: 0.9rem; }
.product-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.pill { background: var(--accent-soft); color: var(--accent-dark); font-size: 0.76rem; padding: 0.2rem 0.6rem; border-radius: 999px; }
.product-cta { margin-top: auto; padding-top: 0.8rem; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.category-head { margin: 1.5rem 0 1rem; display: flex; align-items: baseline; gap: 0.75rem; }
.category-head p { color: var(--muted); }

/* ---- modal ------------------------------------------------------------ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(28,26,22,0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal { background: var(--surface); border-radius: 18px; max-width: 880px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); position: relative; }
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; background: #fff; border: 1px solid var(--line); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; z-index: 2; }
.modal-product { display: grid; grid-template-columns: 1fr 1.25fr; }
.modal-product .visual { background: #fff; padding: 2rem; display: grid; place-items: center; border-right: 1px solid var(--line); }
.modal-product .visual img { max-width: 100%; }
.modal-product .details { padding: 2rem 2rem 1.75rem; display: flex; flex-direction: column; gap: 0.9rem; }
.spec-list { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.9rem; margin: 0; }
.spec-list dt { color: var(--muted); }
.spec-list dd { margin: 0; font-weight: 600; }
.modal-form { padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-form h2 { font-size: 1.5rem; }
.qty-row { display: flex; align-items: center; gap: 0.75rem; }
.qty-row input { width: 110px; text-align: center; }
.qty-row .btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.qty-summary { font-size: 0.9rem; color: var(--muted); }
@media (max-width: 720px) {
  .modal-product { grid-template-columns: 1fr; }
  .modal-product .visual { border-right: 0; border-bottom: 1px solid var(--line); padding: 1.25rem; }
  .modal-product .details, .modal-form { padding: 1.25rem; }
}

/* ---- toast ------------------------------------------------------------ */
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px; font-size: 0.9rem; z-index: 60; box-shadow: var(--shadow); }

/* ---- charts ----------------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 0.5rem; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar .fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: 0.85; }
.bar .fill.gold { background: var(--gold); }
.bar .lbl { font-size: 0.65rem; color: var(--muted); white-space: nowrap; }
.bar .val { font-size: 0.7rem; color: var(--ink); }
.season-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.season { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem; text-align: center; }
.season.peak { border-color: var(--gold); background: var(--gold-soft); }
.season .n { font-family: var(--serif); font-size: 1.4rem; }
.season .s { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ---- order tracker ---------------------------------------------------- */
.tracker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; margin: 0.5rem 0; }
.step { text-align: center; font-size: 0.72rem; color: var(--muted); position: relative; padding-top: 18px; }
.step::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.step::after { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: -1; }
.step:first-child::after { display: none; }
.step.done { color: var(--accent-dark); font-weight: 600; }
.step.done::before, .step.done::after { background: var(--accent); }
.step.cancelled::before { background: var(--danger); }

/* ---- lists ------------------------------------------------------------ */
.list { display: flex; flex-direction: column; gap: 0.6rem; }
.list-item .btn { white-space: nowrap; flex-shrink: 0; }
.list-item { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 0.9rem; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

/* ---- auth pages -------------------------------------------------------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2.25rem 2rem; box-shadow: var(--shadow); }
.auth-card .brand { font-size: 2rem; display: block; margin-bottom: 0.25rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }

@media (max-width: 600px) {
  .page { padding: 1.25rem 1rem 2.5rem; }
  .topbar-inner { gap: 0.5rem 1rem; }
  .nav { margin-left: 0; width: 100%; }
  .user-chip { margin-left: auto; }
  .user-chip span { display: none; }
  .season-row { grid-template-columns: repeat(2, 1fr); }
  .nav a { padding: 0.4rem 0.65rem; font-size: 0.85rem; }
}
