:root {
  --bg: #fafBFB;
  --surface: #ffffff;
  --surface-alt: #f3f7f7;
  --well: #ebf1f2;
  --border: #d4dfe2;
  --border-strong: #b8c8cc;
  --ink: #0e1a1c;
  --muted: #495c60;
  --accent: #0f766e;
  --btn-ink: #ffffff;
  --brass: #b45309;
  --brass-soft: rgba(180, 83, 9, 0.12);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.11);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --err: #b91c1c;
  --err-soft: rgba(185, 28, 28, 0.11);
  --shop-wall: #f7f4ee;
  --shop-wall-side: #e4ded3;
  --shop-trim: #1e2d30;
  --shop-plinth: #d7dfe1;
  --shop-plinth-edge: #aebcc0;
  --shop-glass: linear-gradient(155deg, rgba(255, 247, 232, 0.94) 0%, rgba(251, 229, 192, 0.85) 60%, rgba(210, 234, 233, 0.72) 100%);
  --kraft: #c89d6c;
  --kraft-side: #a67c4e;
  --kraft-top: #dcb688;
  --radius: 14px;
  --shadow-stage: 0 22px 46px -22px rgba(14, 26, 28, 0.22);
}

html[data-mode="dark"] {
  --bg: #0c1315;
  --surface: #131d20;
  --surface-alt: #172327;
  --well: #1b2a2f;
  --border: #26383e;
  --border-strong: #344d55;
  --ink: #edf3f4;
  --muted: #9db3b8;
  --brass: #f59e0b;
  --brass-soft: rgba(245, 158, 11, 0.16);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.15);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --err: #ef4444;
  --err-soft: rgba(239, 68, 68, 0.16);
  --shop-wall: #1f2b2e;
  --shop-wall-side: #151f22;
  --shop-trim: #0b1113;
  --shop-plinth: #243338;
  --shop-plinth-edge: #172226;
  --shop-glass: linear-gradient(155deg, rgba(254, 240, 199, 0.92) 0%, rgba(245, 194, 107, 0.75) 62%, rgba(45, 110, 108, 0.65) 100%);
  --kraft: #b88a58;
  --kraft-side: #8c653b;
  --kraft-top: #cfa472;
  --shadow-stage: 0 24px 52px -18px rgba(0, 0, 0, 0.55);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

.display-font {
  font-family: 'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.025em;
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
}

button, input, select, textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 120;
  background: var(--accent);
  color: var(--btn-ink);
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

/* Top Navigation Bar (solid grounded surface, zero blur overload per R-10) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--btn-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 20px 84px;
}

/* ==========================================================================
   HERO ATELIER + 3D BOUTIQUE & PARCEL PAVILION
   ========================================================================== */
.hero-atelier {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 26px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.dispatch-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.dispatch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.hero-title {
  margin: 10px 0 8px;
  font-size: clamp(25px, 3.2vw, 37px);
  font-weight: 800;
  line-height: 1.12;
}

.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.58;
  max-width: 54ch;
}

.store-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.store-facts strong {
  color: var(--ink);
  font-weight: 700;
}

.resi-inline {
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px 16px;
}

.resi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.resi-head-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.resi-form-row {
  display: flex;
  gap: 8px;
}

/* Announcement Banner (Optional from Admin Settings) */
.announcement-bar {
  background: var(--accent);
  color: var(--btn-ink);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  padding: 8px 16px;
}

/* Studio 3D WebGL Showcase Container */
.studio3d-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-stage);
  position: relative;
}

.stage-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
}

.stage-cam-bar {
  display: inline-flex;
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}

.stage-cam-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  min-height: 32px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.stage-cam-btn.active {
  background: var(--accent);
  color: var(--btn-ink);
}

.studio3d-viewport {
  position: relative;
  width: 100%;
  height: 350px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 34%, var(--accent-soft) 0%, var(--well) 74%);
  border: 1px solid var(--border);
  overflow: hidden;
}

.studio3d-canvas-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.studio3d-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

.studio3d-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.studio3d-rot-btns {
  display: inline-flex;
  gap: 5px;
}

.studio3d-rot-btn {
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--ink);
  border-radius: 7px;
  padding: 4px 9px;
  min-height: 30px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   CATALOG TOOLBAR & PRODUCTS
   ========================================================================== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 280px;
  justify-content: flex-end;
}

.chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.chip-btn {
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 13px;
  min-height: 38px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.chip-btn:hover {
  border-color: var(--border-strong);
}

.chip-btn.active {
  background: var(--accent);
  color: var(--btn-ink);
  border-color: var(--accent);
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.44fr) minmax(320px, 400px);
  gap: 22px;
  align-items: start;
}

.catalog-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

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

.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.prod-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 12px 26px -18px rgba(14, 26, 28, 0.25);
}

.prod-card.out {
  opacity: 0.72;
}

.prod-visual-plate {
  position: relative;
  height: 112px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.prod-sku-num {
  position: absolute;
  left: 10px;
  top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.prod-stock-badge {
  position: absolute;
  right: 8px;
  top: 8px;
}

.prod-svg-art {
  width: 80px;
  height: 80px;
  color: var(--accent);
}

.prod-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--well);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.badge-err {
  background: var(--err-soft);
  color: var(--err);
  border-color: transparent;
}

.prod-name {
  margin: 7px 0 5px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.prod-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.48;
}

.variant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.var-btn {
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--ink);
  border-radius: 7px;
  padding: 5px 10px;
  min-height: 32px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.var-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.prod-foot {
  border-top: 1px dashed var(--border);
  padding-top: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.price-tag {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.card-sticky {
  position: sticky;
  top: 76px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-ink);
  border-color: var(--accent);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  min-height: 40px;
}

.textarea {
  min-height: 74px;
  resize: vertical;
}

.field {
  margin-bottom: 11px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.cart-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.calc-box {
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.calc-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--accent);
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.alert-err {
  background: var(--err-soft);
  color: var(--err);
}

.alert-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.cart-feedback {
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--ok-soft);
  color: var(--ok);
  margin-bottom: 10px;
  display: none;
}

.cart-feedback.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* Modal & 4-Step Live Resi Timeline */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 14, 16, 0.74);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.resi-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.resi-step {
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 6px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.resi-step strong {
  display: block;
  font-size: 11px;
  color: var(--ink);
  margin-top: 2px;
}

.resi-step.is-done {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}

.resi-step.is-done strong {
  color: var(--ok);
}

.resi-step.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.resi-step.is-active strong {
  color: var(--accent);
}

.qr-frame {
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  padding: 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 10px auto;
  border: 1px solid #cbd5e1;
}

.qr-frame canvas, .qr-frame img {
  max-width: 240px;
  height: auto;
  display: block;
}

/* Minimal Honest Storefront Footer */
.shop-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px;
}

.shop-footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

/* Mobile Floating Cart Bar */
.mobile-cart-bar {
  display: none;
}

/* Admin Tables & Helpers (preserved cleanly for admin/index.php) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--well);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.metrics-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.metric-card .mk {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.metric-card .mv {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Tablet <= 1040px, Mobile <= 760px)
   ========================================================================== */
@media (max-width: 1040px) {
  .hero-atelier {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .shop-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-sticky {
    position: static;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 16px 14px 88px;
  }

  .hero-copy-panel {
    padding: 18px 16px;
  }

  .resi-form-row {
    flex-direction: column;
  }

  .studio3d-viewport {
    height: 260px;
  }

  .toolbar {
    padding: 12px;
  }

  .toolbar-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .toolbar-controls .input,
  .toolbar-controls .select {
    max-width: 100% !important;
    width: 100%;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .resi-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn, .chip-btn, .stage-cam-btn, .var-btn, .studio3d-rot-btn {
    min-height: 44px;
  }

  .qty-btn {
    width: 38px;
    height: 38px;
  }

  .mobile-cart-bar.is-visible {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 45;
    background: var(--accent);
    color: var(--btn-ink);
    border-radius: 12px;
    padding: 12px 16px;
    min-height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 13.5px;
    border: 0;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    cursor: pointer;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prod-card,
  .chip-btn,
  .btn {
    transition: none !important;
  }
}

@media print {
  .topbar, .hero-atelier, .toolbar, .shop-layout, .mobile-cart-bar, .shop-footer, .no-print {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #0f172a;
  }
  .modal-backdrop.open {
    position: static;
    display: block;
    background: #ffffff;
    padding: 0;
  }
  .modal-box {
    max-width: 100%;
    max-height: none;
    border: 1px solid #94a3b8;
    background: #ffffff;
    color: #0f172a;
  }
}
