:root {
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface-2: #f3ecdf;
  --ink: #2b2520;
  --muted: #6f655b;
  --line: #e4dacb;
  --yolk: #e8a317;
  --yolk-ink: #3a2700;
  --green: #3f6b3a;
  --green-soft: #e3eedf;
  --red: #a63d2f;
  --red-soft: #f7e2de;
  --blue-soft: #e2ebf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 4px 14px rgba(60, 40, 10, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17; --surface: #262320; --surface-2: #2f2b27; --ink: #f2ece3; --muted: #b3a899;
    --line: #3d3833; --yolk: #f0b23a; --green: #8fc485; --green-soft: #263524; --red: #f08a7a;
    --red-soft: #3c2522; --blue-soft: #232d38; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-family: var(--sans); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

header.site { padding: 36px 0 20px; }
header.site .egg { width: 44px; height: 54px; display: block; margin-bottom: 10px; }
.notice { background: var(--surface-2); border-left: 4px solid var(--yolk); padding: 12px 14px; border-radius: 8px; margin: 12px 0 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.product { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--line); }
.product:first-of-type { border-top: 0; }
.product .info { min-width: 0; }
.product .name { font-weight: 600; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.badge.low { background: #fdf0d2; color: #8a5a00; }
.badge.out { background: var(--red-soft); color: var(--red); }
.badge.reserved { background: var(--blue-soft); color: #2d5a8a; }
.badge.picked_up { background: var(--green-soft); color: var(--green); }
.badge.cancelled, .badge.expired { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.low { background: #3a2f17; color: #f0c56a; } .badge.reserved { color: #9cc2ea; } }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { width: 40px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--yolk); outline-offset: 1px; }
.field { margin-bottom: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; cursor: pointer; background: var(--yolk); color: var(--yolk-ink); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--surface); border-color: var(--red); color: var(--red); }
.btn.green { background: var(--green); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: .875rem; border-radius: 8px; }
.btn.block { width: 100%; padding: 14px; font-size: 1.05rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.ok { background: var(--green-soft); color: var(--green); }

.total { display: flex; justify-content: space-between; font-weight: 600; padding: 12px 0 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; letter-spacing: .12em; font-weight: 700; }
footer { padding: 30px 0 50px; text-align: center; }

/* admin */
nav.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
nav.tabs button { font: inherit; background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
nav.tabs button.active { color: var(--ink); border-bottom-color: var(--yolk); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.stat .n { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: .8rem; color: var(--muted); }
.stat.hl { background: var(--green-soft); }
.stat.hl .n { color: var(--green); }
.stat.warn { background: var(--red-soft); }
.stat.warn .n { color: var(--red); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.res { border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.res:first-child { border-top: 0; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; gap: 4px; align-items: center; font-weight: 400; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; }
.days input { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }
.hint { margin-top: -6px; }
.narrow { width: 110px; }
.narrow-date { width: 170px; }
.grow { flex: 1; min-width: 180px; width: auto; }
.row select { width: auto; }
.product-edit .grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stock-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
