:root {
  --cocoa-950: #2E1710;
  --cocoa-900: #3D2013;
  --cocoa-700: #7A4A2E;
  --cocoa-500: #A9744C;
  --cocoa-200: #F3E1D2;
  --cream-50:  #FFFBFA;
  --cream-100: #FBEAF1;
  --strawberry-600: #C24C82;
  --strawberry-500: #D97AA6;
  --strawberry-100: #F8DCE9;
  --gold-500: #4FA893;
  --gold-100: #DFF2EC;
  --success-600: #4C7A3D;
  --success-100: #E4EEDD;
  --danger-600: #A82318;
  --danger-100: #F7DAD5;
  --radius-card: 18px;
  --radius-pill: 999px;
  --shadow-soft: 0 1px 2px rgba(43,24,16,.06), 0 8px 24px -12px rgba(43,24,16,.18);
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream-50);
  color: var(--cocoa-900);
  font-family: 'Outfit', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .display { font-family: 'Fraunces', serif; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--cocoa-200); border-radius: 8px; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Landing / Login ---------- */
#landing { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 860px) { #landing { grid-template-columns: 1fr 1fr; } }
.brand-pane {
  background: radial-gradient(60% 50% at 85% 10%, rgba(217,122,166,.30), transparent 60%), linear-gradient(165deg, #2A1220, var(--cocoa-950) 55%, var(--cocoa-700));
  color: var(--cream-100);
  padding: 48px 40px;
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 320px; overflow: hidden;
}
.drip {
  position: absolute; inset: auto -10% -30% -10%; height: 260px;
  background: radial-gradient(ellipse at 20% 0%, var(--strawberry-600) 0 12%, transparent 13%),
              radial-gradient(ellipse at 45% 0%, var(--gold-500) 0 9%, transparent 10%),
              radial-gradient(ellipse at 68% 0%, var(--strawberry-500) 0 14%, transparent 15%),
              radial-gradient(ellipse at 88% 0%, var(--gold-500) 0 8%, transparent 9%);
  background-size: 100% 100%; opacity: .35; filter: blur(1px);
}
.brand-top { position: relative; z-index: 1; }
.brand-mark { display: flex; align-items: center; gap: 12px; }
.brand-glyph {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--strawberry-500), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; color: var(--cocoa-950);
  flex-shrink: 0;
}
.brand-logo-tile { background: #fff; border-radius: 14px; padding: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--shadow-soft); width: 46px; height: 46px; }
.brand-logo-tile img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.brand-pane .brand-logo-tile { width: 64px; height: 64px; padding: 7px; }
.topbar .brand-logo-tile { width: 30px; height: 30px; border-radius: 9px; padding: 3px; }
.shop-hero .brand-logo-tile { width: 34px; height: 34px; padding: 3px; }
.brand-name { font-size: 15px; letter-spacing: .01em; opacity: .9; }
.brand-name b { font-weight: 600; color: #fff; }
.brand-headline { margin: 56px 0 12px; font-size: clamp(34px,5vw,48px); font-weight: 600; line-height: 1.08; max-width: 9.5em; position: relative; z-index: 1; }
.brand-sub { font-size: 16px; line-height: 1.6; color: var(--cocoa-200); max-width: 34ch; position: relative; z-index: 1; }
.brand-bottom { position: relative; z-index: 1; display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--cocoa-200); opacity: .8; padding-top: 32px; border-top: 1px solid rgba(255,255,255,.12); }
.powered { font-size: 12px; opacity: .55; margin-top: 6px; }

.login-pane { padding: 48px 32px 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; font-weight: 600; }
.login-card p.lede { color: var(--cocoa-500); font-size: 14.5px; margin: 0 0 28px; }
.role-switch { display: flex; background: var(--cream-100); padding: 4px; border-radius: var(--radius-pill); margin-bottom: 26px; border: 1px solid var(--cocoa-200); }
.role-switch button { flex: 1; border: none; background: transparent; padding: 10px 14px; border-radius: var(--radius-pill); font-weight: 600; font-size: 13.5px; color: var(--cocoa-500); transition: all .18s ease; }
.role-switch button.active { background: var(--cocoa-900); color: #fff; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--cocoa-700); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--cocoa-200); font-size: 14.5px; font-family: inherit; background: #fff; color: var(--cocoa-900); }
.field input:focus { outline: 2px solid var(--strawberry-500); outline-offset: 1px; border-color: var(--strawberry-500); }
.field-error { color: var(--danger-600); font-size: 12.5px; margin: -10px 0 14px; display: none; }
.field-error.show { display: block; }

.btn-primary { width: 100%; padding: 13px 16px; border-radius: 12px; border: none; background: var(--strawberry-600); color: #fff; font-weight: 600; font-size: 14.5px; margin-top: 6px; box-shadow: var(--shadow-soft); transition: transform .12s ease, background .15s ease; }
.btn-primary:hover { background: var(--strawberry-500); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.hint { font-size: 12px; color: var(--cocoa-500); text-align: center; margin-top: 16px; }
.demo-note { font-size: 11.5px; color: var(--cocoa-500); background: var(--cream-100); border: 1px dashed var(--cocoa-200); border-radius: 10px; padding: 10px 12px; margin-top: 22px; line-height: 1.5; }

#googleBtnContainer { display: flex; justify-content: center; margin-bottom: 6px; }

/* ---------- App shell ---------- */
#app { display: none; min-height: 100vh; background: var(--cream-50); }
.topbar { position: sticky; top: 0; z-index: 40; background: var(--cocoa-950); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; height: 58px; }
.topbar .left { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; }
.topbar .left .brand-glyph { width: 30px; height: 30px; font-size: 13px; border-radius: 9px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.pill-btn { border: 1px solid rgba(255,255,255,.22); background: transparent; color: #fff; padding: 7px 13px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; }
.pill-btn.solid { background: var(--strawberry-600); border-color: transparent; }

#vendorView { display: none; }
.vendor-shell { display: flex; min-height: calc(100vh - 58px); }
.sidebar { width: 210px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--cocoa-200); padding: 18px 10px; position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--cocoa-700); margin-bottom: 3px; border: none; background: transparent; width: 100%; text-align: left; }
.side-link .ic { width: 20px; text-align: center; }
.side-link.active { background: var(--strawberry-100); color: var(--strawberry-600); }
.side-link .badge { margin-left: auto; background: var(--strawberry-600); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.main { flex: 1; min-width: 0; padding: 22px 22px 60px; }
@media (max-width: 720px) {
  .vendor-shell { flex-direction: column; }
  .sidebar { width: 100%; position: static; height: auto; display: flex; overflow-x: auto; gap: 4px; padding: 10px; border-right: none; border-bottom: 1px solid var(--cocoa-200); }
  .side-link { flex-shrink: 0; }
  .main { padding: 16px 14px 60px; }
}

.page-title { font-size: 22px; font-weight: 600; margin: 0 0 3px; }
.page-sub { color: var(--cocoa-500); font-size: 13.5px; margin: 0 0 22px; }
.card { background: #fff; border: 1px solid var(--cocoa-200); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--cocoa-500); font-weight: 600; }
.stat .value { font-family: 'Fraunces', serif; font-size: 25px; font-weight: 600; margin-top: 4px; }
.stat .delta { font-size: 11.5px; margin-top: 4px; font-weight: 600; }
.delta.up { color: var(--success-600); } .delta.down { color: var(--danger-600); }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.card-h { padding: 16px 18px 0; display: flex; align-items: center; justify-content: space-between; }
.card-h h3 { font-size: 15px; margin: 0; font-weight: 600; }
.card-body { padding: 14px 18px 18px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.bars .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars .bar { width: 100%; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--strawberry-500), var(--strawberry-600)); }
.bars .bar-label { font-size: 10.5px; color: var(--cocoa-500); font-weight: 600; }

.leaderboard-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--cream-100); }
.leaderboard-row:last-child { border-bottom: none; }
.lb-thumb { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--cream-100); flex-shrink:0; }
.lb-name { font-size: 13px; font-weight: 600; flex: 1; }
.lb-qty { font-size: 12px; color: var(--cocoa-500); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-box { flex: 1; min-width: 160px; position: relative; }
.search-box input { width: 100%; padding: 10px 14px 10px 34px; border-radius: 11px; border: 1.5px solid var(--cocoa-200); font-size: 13.5px; font-family: inherit; }
.search-box::before { content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--cocoa-500); font-size: 15px; }
.btn-small { padding: 9px 14px; border-radius: 11px; border: 1.5px solid var(--cocoa-200); background: #fff; font-weight: 600; font-size: 13px; color: var(--cocoa-700); }
.btn-small.primary { background: var(--cocoa-900); color: #fff; border-color: transparent; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px,1fr)); gap: 14px; }
.prod-card { padding: 12px; position: relative; }
.prod-img { width: 100%; height: 92px; border-radius: 12px; object-fit: cover; margin-bottom: 8px; background: var(--cream-100); }
.prod-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.prod-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price-tag { font-family: 'Fraunces', serif; font-weight: 600; font-size: 14.5px; color: var(--cocoa-900); }
.qty-tag { font-size: 11px; color: var(--cocoa-500); }
.status-chip { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px; position: absolute; top: 10px; right: 10px; }
.status-chip.in { background: var(--success-100); color: var(--success-600); }
.status-chip.out { background: var(--danger-100); color: var(--danger-600); }
.prod-actions { display: flex; gap: 6px; margin-top: 10px; }
.icon-btn { border: 1.5px solid var(--cocoa-200); background: #fff; border-radius: 9px; padding: 6px 9px; font-size: 12px; flex: 1; font-weight: 600; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(31,18,12,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal h3 { margin: 0 0 14px; font-size: 18px; }

.file-drop { border: 1.5px dashed var(--cocoa-200); border-radius: 14px; padding: 14px; text-align: center; cursor: pointer; background: var(--cream-100); }
.file-drop input[type=file] { display: none; }
.file-preview { width: 100%; height: 120px; object-fit: cover; border-radius: 12px; margin-top: 10px; display: none; }

.recipe-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.recipe-row select { flex: 1.4; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--cocoa-200); font-size: 13px; font-family: inherit; background: #fff; }
.recipe-row input { flex: 1; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--cocoa-200); font-size: 13px; font-family: inherit; min-width: 0; }
.recipe-row .unit-tag { font-size: 11.5px; color: var(--cocoa-500); width: 34px; flex-shrink: 0; }
.recipe-row .rm-row { border: none; background: var(--cream-100); color: var(--danger-600); width: 28px; height: 28px; border-radius: 8px; font-weight: 700; flex-shrink: 0; }

.stock-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.stock-row .nm { flex: 1; font-weight: 600; font-size: 13.5px; }
.stock-row .qty { font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; }
.stock-row .qty.low { color: var(--danger-600); }
.stock-row .unit-badge { font-size: 10.5px; color: var(--cocoa-500); background: var(--cream-100); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

.billing-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 900px) { .billing-layout { grid-template-columns: 1fr; } }
.bill-item-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.bill-item-row:hover { background: var(--cream-100); }
.bill-item-row img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--cream-100); }
.bill-item-row .nm { flex: 1; font-size: 13px; font-weight: 600; }
.bill-item-row .pr { font-size: 12.5px; color: var(--cocoa-500); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--cocoa-200); background: #fff; font-weight: 700; }
.cart-line { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--cream-100); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; padding-top: 12px; margin-top: 6px; border-top: 1.5px solid var(--cocoa-200); font-family: 'Fraunces', serif; }
.pay-methods { display: flex; gap: 8px; margin: 14px 0; }
.pay-methods button { flex: 1; padding: 10px; border-radius: 11px; border: 1.5px solid var(--cocoa-200); background: #fff; font-weight: 600; font-size: 12.5px; }
.pay-methods button.sel { border-color: var(--strawberry-600); background: var(--strawberry-100); color: var(--strawberry-600); }

.order-card { padding: 14px 16px; margin-bottom: 12px; }
.order-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.order-id { font-weight: 700; font-size: 13.5px; }
.order-time { font-size: 11.5px; color: var(--cocoa-500); }
.order-items { font-size: 12.5px; color: var(--cocoa-700); margin-bottom: 10px; line-height: 1.5; }
.status-badge { font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.status-badge.new { background: var(--gold-100); color: #8A6410; }
.status-badge.accepted, .status-badge.preparing { background: #DCEAFB; color: #235A9C; }
.status-badge.ready { background: var(--success-100); color: var(--success-600); }
.status-badge.closed { background: var(--cream-100); color: var(--cocoa-500); }
.status-badge.denied { background: var(--danger-100); color: var(--danger-600); }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order-actions button { flex: 1; min-width: 90px; padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; border: none; }
.act-accept { background: var(--success-600); color: #fff; }
.act-deny { background: #fff; border: 1.5px solid var(--danger-600) !important; color: var(--danger-600); }
.act-preparing { background: #235A9C; color: #fff; }
.act-ready { background: var(--strawberry-600); color: #fff; }
.act-close { background: var(--cocoa-900); color: #fff; }

.low-stock-item { display: flex; justify-content: space-between; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid var(--cream-100); }
.low-stock-item:last-child { border-bottom: none; }

/* ---------- Customer site ---------- */
#customerView { display: none; }
.shop-hero { background: linear-gradient(160deg, var(--cocoa-950), var(--cocoa-700)); color: #fff; padding: 34px 20px 26px; position: relative; overflow: hidden; }
.shop-hero h1 { font-size: clamp(26px,4vw,34px); margin: 6px 0 6px; font-weight: 600; }
.shop-hero p { color: var(--cocoa-200); font-size: 13.5px; max-width: 46ch; margin: 0 0 16px; }
.shop-hero .loc { font-size: 12px; color: var(--cocoa-200); display: flex; gap: 14px; flex-wrap: wrap; }
.shop-hero .loc a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); }

.customer-nav { position: sticky; top: 58px; z-index: 30; background: #fff; border-bottom: 1px solid var(--cocoa-200); display: flex; gap: 4px; padding: 8px 20px; overflow-x: auto; }
.cnav-btn { border: none; background: transparent; padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--cocoa-500); flex-shrink: 0; }
.cnav-btn.active { background: var(--cocoa-950); color: #fff; }

.shop-wrap { padding: 20px; max-width: 980px; margin: 0 auto; }
.shop-section { display: none; }
.shop-section.active { display: block; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 16px; }
.shop-card { overflow: hidden; }
.shop-card img { width: 100%; height: 118px; object-fit: cover; background: var(--cream-100); }
.shop-card .body { padding: 12px 14px 14px; }
.shop-card .nm { font-weight: 600; font-size: 14px; }
.shop-card .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.add-btn { border: none; background: var(--cocoa-950); color: #fff; padding: 8px 13px; border-radius: 10px; font-weight: 700; font-size: 12.5px; }
.add-btn:disabled { background: var(--cream-100); color: var(--cocoa-500); }
.stepper-mini { display: flex; align-items: center; gap: 8px; background: var(--cocoa-950); border-radius: 10px; padding: 5px 8px; }
.stepper-mini button { background: transparent; border: none; color: #fff; font-weight: 700; width: 18px; }
.stepper-mini span { color: #fff; font-weight: 700; font-size: 13px; min-width: 14px; text-align: center; }

.cart-fab { position: fixed; bottom: 20px; right: 20px; z-index: 50; background: var(--strawberry-600); color: #fff; border: none; border-radius: 999px; padding: 13px 20px; font-weight: 700; font-size: 13.5px; box-shadow: 0 10px 30px -8px rgba(193,63,92,.6); display: none; align-items: center; gap: 8px; }
.cart-fab.show { display: inline-flex; }
.cart-fab .count { background: rgba(255,255,255,.28); border-radius: 999px; padding: 1px 8px; font-size: 12px; }

.about-card { padding: 18px 20px; margin-bottom: 14px; }
.about-card h3 { margin: 0 0 10px; font-size: 15.5px; }
.about-row { display: flex; gap: 10px; font-size: 13px; padding: 6px 0; color: var(--cocoa-700); }
.about-row .ic { width: 20px; flex-shrink: 0; }
.review-stars { color: var(--gold-500); font-size: 15px; letter-spacing: 2px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--cocoa-500); }
.empty-state .big { font-size: 34px; margin-bottom: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--cocoa-950); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 600; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.toast.show { opacity: 1; }
.toast.error { background: var(--danger-600); }
