:root {
  --bg: #161311;
  --surface: #221e1a;
  --surface-2: #2c261f;
  --cream: #f6f1e8;
  --text: var(--cream);
  --primary: #c4894f;
  --primary-hover: #d19a62;
  --on-primary: #1c140c;
  --secondary: #d7b48a;
  --accent: #e4c7a2;
  --brass: var(--primary);
  --brass-hover: var(--primary-hover);
  --muted: #b7aea3;
  --border: #3a342c;
  --danger: #c45c4a;
  --ok: #8aa876;
  --shadow: 0 16px 40px rgba(22, 19, 17, 0.35);
  --sans: "DM Sans", "Segoe UI", sans-serif;
  --serif: var(--sans);
  --radius: 8px;
  --radius-card: 12px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 5rem;
  --container: 1180px;
  --cal-open: var(--surface);
  --cal-open-hover: var(--surface-2);
  --cal-open-border: var(--primary);
  --cal-open-ink: var(--cream);
  --cal-closed: #1c1916;
  --cal-closed-border: var(--border);
  --cal-closed-ink: #c4beb4;
  --cal-closed-meta: #b8b2a8;
  --cal-legend-closed: #2a261f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--cream); font-family: var(--sans); }
body { min-height: 100vh; letter-spacing: 0.01em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, .display { font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
p { color: var(--muted); line-height: 1.6; }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 96px; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; font-family: var(--sans); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--cream); }
.brand-mark { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.brand-tail { color: var(--brass); }
button.theme-toggle { appearance: none; border: 1px solid var(--border); background: transparent; background-color: transparent; color: var(--muted); border-radius: 999px; padding: 0.35rem 0.85rem; font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; line-height: 1.2; }
button.theme-toggle:hover { color: var(--cream); border-color: var(--brass); }
button.theme-toggle .theme-to-dark { display: none; }
html[data-theme="light"] button.theme-toggle .theme-to-light { display: none; }
html[data-theme="light"] button.theme-toggle .theme-to-dark { display: inline; }
.nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.92rem; }
.nav a:hover, .nav a.active { color: var(--cream); }
.nav a.active { box-shadow: inset 0 -2px 0 var(--brass); }
.nav-logout { margin: 0; display: inline; }
.nav-logout button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--muted);
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
}
.nav-logout button:hover { color: var(--cream); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; padding: 0.7rem 1.15rem; border-radius: var(--radius); cursor: pointer; font-family: var(--sans); letter-spacing: 0.01em; font-size: 0.95rem; transition: background 160ms ease, border-color 160ms ease, color 160ms ease; }
.btn:hover { background: var(--brass-hover); }
.btn:disabled,
a.btn[aria-disabled="true"] { cursor: not-allowed; pointer-events: none; opacity: 0.72; }
.btn.is-busy { cursor: wait; pointer-events: none; opacity: 0.72; }
.actions.is-locked .btn:not(.is-busy),
.row.is-locked .btn:not(.is-busy) { cursor: not-allowed; pointer-events: none; opacity: 0.72; }
.btn-spinner { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: none; animation: btn-spin 0.7s linear infinite; }
.btn.is-busy .btn-spinner { display: inline-block; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-secondary { background: transparent; color: var(--cream); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--brass); color: var(--brass); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.hero { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.hero-media { position: absolute; inset: 0; background:
  linear-gradient(180deg, color-mix(in srgb, var(--bg) 8%, transparent), color-mix(in srgb, var(--bg) 72%, transparent)),
  var(--surface-2); }
.hero-content { position: relative; text-align: left; width: min(100% - 2rem, var(--container)); padding: 3.25rem 0 3.5rem; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 600; margin-bottom: 0.75rem; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); line-height: 1.12; max-width: 18ch; font-weight: 600; }
.hero p { max-width: 38rem; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.section { padding: var(--space-8) 0; }
.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 2rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; transition: transform 160ms ease, border-color 160ms ease; }
.card:hover { transform: translateY(-2px); border-color: var(--primary); }
.card-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.55)),
    linear-gradient(45deg, #2b241c, #12100e);
  position: relative;
  overflow: hidden;
}
.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.card-media-detail {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
}
.form-preview {
  width: min(100%, 240px);
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #101010;
}
.table-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: #101010; }
.card-body { padding: 1.1rem 1.15rem 1.25rem; }
.card h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.meta { color: var(--brass); font-size: 0.86rem; }
.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip { border: 1px solid var(--border); color: var(--muted); padding: 0.4rem 0.75rem; border-radius: var(--radius); background: transparent; cursor: pointer; font-family: var(--sans); }
.chip.active { border-color: var(--brass); color: var(--cream); }
.form { display: grid; gap: 0.9rem; }
label { font-size: 0.8rem; color: var(--muted); display: grid; gap: 0.35rem; }
.check-list { display: grid; gap: 0.55rem; }
.check { display: flex; align-items: center; gap: 0.65rem; }
.check input[type="checkbox"] { width: auto; margin: 0; }
.assign-row { display: grid; grid-template-columns: auto 1fr 7.5rem; align-items: center; gap: 0.75rem; }
.assign-row .price-override { width: 100%; padding: 0.45rem 0.55rem; }
input, select, textarea { background: var(--bg); border: 1px solid var(--border); color: var(--cream); padding: 0.75rem 0.8rem; border-radius: var(--radius); font-family: var(--sans); font-size: 1rem; }
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 2.8rem; }
.password-eye {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.password-eye:hover { color: var(--cream); }
.password-eye svg { width: 1.15rem; height: 1.15rem; display: block; }
.password-eye .eye-off { display: none; }
.password-eye.is-open .eye-on { display: none; }
.password-eye.is-open .eye-off { display: block; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert { border: 1px solid var(--danger); color: var(--danger); padding: 0.75rem 1rem; border-radius: var(--radius); }
.success { border-color: var(--ok); color: var(--ok); }
.site-dialog {
  border: 0;
  padding: 0;
  margin: auto;
  max-width: min(22rem, calc(100vw - 2rem));
  background: transparent;
  color: inherit;
}
.site-dialog::backdrop {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(4px);
}
.site-dialog-card {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem 1.2rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 40px color-mix(in srgb, #000 28%, transparent);
}
.site-dialog-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.site-dialog-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.site-dialog-card .btn { width: 100%; }
.steps { display: flex; gap: 0.35rem 1.1rem; margin: 1.25rem 0 1.75rem; flex-wrap: wrap; counter-reset: book-step; }
.step { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); padding: 0.2rem 0; font-size: 0.95rem; letter-spacing: 0; text-transform: none; }
.step::before { counter-increment: book-step; content: counter(book-step); width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid var(--border); display: inline-grid; place-items: center; font-size: 0.75rem; font-weight: 600; }
.step.active { color: var(--cream); font-weight: 600; }
.step.active::before { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.slot { border: 1px solid var(--border); padding: 0.7rem; text-align: center; cursor: pointer; background: transparent; color: var(--cream); }
.slot.selected { border-color: var(--brass); color: var(--brass); }
.badge { display: inline-block; border: 1px solid var(--border); padding: 0.15rem 0.5rem; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.badge.pending { color: var(--brass); border-color: var(--brass); }
.badge.confirmed, .badge.accepted, .badge.collected, .badge.preparing { color: var(--ok); border-color: var(--ok); }
.badge.readyforcollection { color: var(--brass); border-color: var(--brass); }
.badge.cancelled, .badge.expired { color: var(--danger); border-color: var(--danger); }
.order-total { margin: 1.25rem 0; font-size: 1.15rem; }
.order-collect { margin-top: 1.75rem; }
.order-collect h2 { margin-bottom: 0.5rem; }
.qty-input { width: 4.5rem; text-align: right; padding: 0.45rem 0.5rem; }
.product-detail { grid-template-columns: 1.1fr 1fr; gap: 2rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 0.8rem 0.6rem; text-align: left; font-size: 0.92rem; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.table td.actions form { display: inline; }
.table td.actions .btn { margin-left: 0.35rem; padding: 0.45rem 0.75rem; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.panel { min-width: 0; }
.panel .form { margin-bottom: 1.25rem; }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); padding: 1.15rem 0.85rem 1rem; }
.side-nav { display: flex; flex-direction: column; }
.nav-section { display: flex; flex-direction: column; margin-top: 0.95rem; }
.nav-group { margin: 0 0.7rem 0.2rem; color: var(--muted); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-section:has(a.active) .nav-group { color: var(--primary); }
.sidebar-tools { margin: 0 0.35rem 0.85rem; }
.login-tools { display: flex; justify-content: flex-end; margin-bottom: 0.85rem; }
.login-brand { display: flex; align-items: center; margin-bottom: 1.25rem; }
.login-brand .brand-mark { width: 104px; height: 104px; }
.sidebar a { display: block; color: var(--muted); padding: 0.48rem 0.7rem; border-radius: var(--radius); }
.sidebar .nav-section a { padding-left: 0.95rem; }
.sidebar a.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--cream); margin-bottom: 0.35rem; padding: 0.15rem 0.35rem 0.7rem; border-radius: 0; }
.sidebar .brand-mark { width: 64px; height: 64px; }
.account-menu { position: relative; }
.account-menu > summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--cream);
  cursor: pointer;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu svg { width: 1.25rem; height: 1.25rem; display: block; }
.image-picker { display: grid; gap: 0.6rem; justify-items: start; }
.image-picker-frame {
  width: 160px;
  height: 160px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.image-picker-preview { width: 100%; height: 100%; object-fit: contain; }
.image-picker-empty {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}
.image-picker-empty svg { width: 1.8rem; height: 1.8rem; }
.image-picker [hidden] { display: none !important; }
.image-picker-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sidebar a:hover { color: var(--cream); background: var(--surface-2); }
.sidebar a.brand:hover { background: transparent; }
.sidebar a.active { color: var(--cream); background: color-mix(in srgb, var(--primary) 16%, var(--surface)); box-shadow: none; font-weight: 600; }
.sidebar .nav-logout { margin-top: auto; padding-top: 0.85rem; }
.sidebar .nav-logout button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.48rem 0.7rem;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
}
.sidebar .nav-logout button:hover { color: var(--cream); background: var(--surface-2); }
.admin-main { padding: 1.5rem 2rem 2.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.form-page { max-width: 640px; }
.form-page .alert { margin-bottom: 1.25rem; }
.section-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.section-toolbar h2 { margin: 0; font-size: 1.45rem; }
.admin-section { margin-top: 2.5rem; }
.admin-section:first-of-type { margin-top: 2.5rem; }
.admin-section h2 { margin: 0 0 1rem; font-size: 1.45rem; }
.table td.empty { color: var(--muted); text-align: center; padding: 1.4rem 0.6rem; }
.order-lines { display: grid; gap: 0.25rem; }
.order-lines .muted { margin-left: 0.25rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem; }
.stat strong { display: block; font-family: var(--sans); font-size: 1.75rem; letter-spacing: -0.03em; }
.footer { border-top: 1px solid var(--border); padding: 2.5rem 0; color: var(--muted); }
.muted { color: var(--muted); }
.stack { display: grid; gap: 0.75rem; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
#blazor-error-ui { display: none; }

@media (max-width: 900px) {
  .grid-3, .grid-4, .stat-grid, .panel-grid { grid-template-columns: 1fr 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .hero { min-height: 70vh; }
  .card-media-detail { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .grid-3, .grid-4, .stat-grid, .panel-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: nowrap; padding: 0; }
  .product-detail { grid-template-columns: 1fr; gap: 1.25rem; }
  .card-media { aspect-ratio: 16 / 10; }
  .card-media-detail { aspect-ratio: 16 / 10; }
}

html[data-theme="light"] {
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --surface-2: #efe6d8;
  --cream: #2a241c;
  --text: var(--cream);
  --primary: #8a5a2b;
  --primary-hover: #734b24;
  --on-primary: #fffaf3;
  --secondary: #a67c52;
  --accent: #8a5a2b;
  --muted: #6f655b;
  --border: #e2d6c6;
  --danger: #a33b32;
  --ok: #3f6b4e;
  --shadow: 0 16px 40px rgba(42, 36, 28, 0.08);
  --cal-open: #fffdf8;
  --cal-open-hover: #efe6d8;
  --cal-open-border: var(--primary);
  --cal-open-ink: #2a241c;
  --cal-closed: #efe6d8;
  --cal-closed-border: #e2d6c6;
  --cal-closed-ink: #6f655b;
  --cal-closed-meta: #6f655b;
  --cal-legend-closed: #efe6d8;
  color-scheme: light;
}
html[data-theme="light"] .site-header { background-color: rgba(255, 253, 248, 0.94); }
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: #fffdf8; }
html[data-theme="light"] .form-preview,
html[data-theme="light"] .table-thumb { background: #efe6d8; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
