/* Haatly — one stylesheet for landing, seller panel and storefront. */
:root {
  --green: #0F3D2E;
  --green-2: #1C5A45;
  --ink: #14201B;
  --muted: #4F5B55;
  --line: #D5D9D2;
  --soft: #F1F2EE;
  --paper: #F7F5EF;
  --white: #FFFFFF;
  --accent: #F2A33A;
  --on-accent: #14201B;
  --wa: #1A7F4B;
  --danger: #B3261E;
  --r: 14px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.5; }
h1, h2 { font-family: var(--display); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.3px; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; font-family: var(--body); letter-spacing: 0; }
p { margin: 0 0 12px; }
a { color: var(--green); font-weight: 500; }
a:hover { color: #0A2A20; }
img { max-width: 100%; display: block; }
small { font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 24px 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-all; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap-gap { flex-wrap: wrap; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--white); color: var(--ink); font: 700 15px/1 var(--body); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(0.95); }
.btn.wa { background: var(--wa); color: #fff; border-color: transparent; }
.btn.wa:hover { background: #136a3e; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost-light { background: transparent; color: var(--paper); border-color: rgba(247,245,239,.5); }
.btn.ghost-light:hover { border-color: var(--paper); color: var(--paper); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn.lg { min-height: 56px; font-size: 17px; padding: 0 24px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.link-btn { background: none; border: 0; color: var(--muted); font: 500 15px var(--body); display: inline-flex; gap: 8px; align-items: center; cursor: pointer; padding: 10px 0; min-height: 44px; }
.link-btn:hover { color: var(--ink); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
input, select, textarea {
  font: 400 16px var(--body); color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-height: 50px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,61,46,.15); }
input::placeholder, textarea::placeholder { color: #7A8580; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { flex-direction: row !important; align-items: center; font-weight: 400 !important; gap: 8px; }
.check input { width: 20px; min-height: 20px; height: 20px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.prefix-input { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--white); overflow: hidden; }
.prefix-input span { padding: 0 0 0 14px; display: flex; align-items: center; color: var(--muted); font-weight: 400; font-size: 14px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.prefix-input input { border: 0; padding-left: 2px; min-width: 0; }
.switch-row { flex-direction: row !important; justify-content: space-between; align-items: center; background: var(--soft); border-radius: var(--r); padding: 12px 16px; }
.switch-row > span { display: flex; flex-direction: column; font-weight: 400; }
.switch { appearance: none; -webkit-appearance: none; width: 52px !important; min-height: 32px !important; height: 32px; border-radius: 16px; background: #B9C1BC; border: 0; padding: 0; position: relative; cursor: pointer; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.swatches legend { font-size: 14px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.swatch { width: 44px; height: 44px; border-radius: 50%; background: var(--c); cursor: pointer; position: relative; flex-direction: row !important; }
.swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--green); outline-offset: 4px; }

/* Flash + badges */
.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-weight: 500; }
.flash.ok { background: #E1F0E6; color: #0F3D2E; }
.flash.err { background: #FBE4E1; color: #8A1C14; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.s-new { background: #FDEBCB; color: #6E4300; }
.s-confirmed { background: #E0ECF8; color: #1D4F86; }
.s-shipped { background: #ECE3F7; color: #4E2A84; }
.s-delivered { background: #E1F0E6; color: #0F3D2E; }
.s-cancelled { background: #F1F2EE; color: #4F5B55; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 22px var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.4px; }
.brand.light, .brand.light:hover { color: var(--paper); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--green); display: inline-flex; align-items: center; justify-content: center; }

/* Landing */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.land-top { background: var(--green); color: var(--paper); padding: 20px 0 72px; }
.hero { padding-top: 64px; max-width: 720px; margin-left: max(0px, calc((100% - 1080px) / 2)); }
.hero h1 { font-size: clamp(38px, 7vw, 64px); letter-spacing: -1.5px; margin-bottom: 16px; }
.hero p { font-size: 18px; color: #C9D6CF; max-width: 560px; margin-bottom: 28px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: -40px; }
.feature { background: var(--white); border-radius: 20px; padding: 24px; box-shadow: 0 6px 20px rgba(15,61,46,.08); }
.feature p { color: var(--muted); margin: 0; }
.feat-ic { width: 44px; height: 44px; border-radius: 12px; background: #E1F0E6; color: var(--green); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.land-foot { padding: 40px 20px; color: var(--muted); font-size: 14px; }

/* Auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--green); }
.auth-hero { padding: 28px 24px 32px; max-width: 480px; width: 100%; margin: 0 auto; }
.auth-card { background: var(--paper); flex: 1; border-radius: 28px 28px 0 0; padding: 28px 24px 40px; width: 100%; max-width: 480px; margin: 0 auto; }
@media (min-width: 600px) { .auth { justify-content: center; padding: 40px 16px; } .auth-card { flex: none; border-radius: 28px; } .auth-hero { padding: 0 8px 20px; } }

/* Seller app shell */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 260px; background: var(--white); border-right: 1px solid #E4E6E0; padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.on { background: #E1F0E6; color: var(--green); font-weight: 700; }
.side-logout { margin-top: auto; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 100px; max-width: 1100px; display: flex; flex-direction: column; gap: 20px; }
.main > h1 { margin: 0; }
@media (max-width: 760px) {
  .app { flex-direction: column; flex-wrap: nowrap; }
  .side { max-width: none; flex: none; padding: 0; border: 0; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; border-top: 1px solid #E4E6E0; gap: 0; }
  .side .brand, .side-logout { display: none; }
  .nav { flex-direction: row; }
  .nav a { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 2px; border-radius: 0; min-height: 60px; justify-content: center; }
  .nav a.on { background: transparent; }
  .main { padding-top: 20px; }
}
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); min-height: 44px; }

.card { background: var(--white); border-radius: 20px; padding: 20px; box-shadow: 0 2px 10px rgba(15,61,46,.05); }
.card.narrow { max-width: 560px; }
.card.empty { text-align: left; }
.hello p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--white); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { font: 800 26px var(--display); }
.share { display: flex; flex-direction: column; gap: 12px; }
.share p { margin: 0; }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 16px; padding: 12px 16px; text-decoration: none; color: var(--ink); }
.list-item:hover { color: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.list-item small { color: var(--muted); font-weight: 400; }
.avatar { width: 44px; height: 44px; border-radius: 12px; background: #E1F0E6; color: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Products (seller) */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.prod-card { background: var(--white); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.prod-card.oos .prod-img { opacity: .5; }
.prod-img { aspect-ratio: 1; background: var(--soft); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.prod-body h2 { font-size: 16px; margin: 0; }
.prod-body p { margin: 0; display: flex; gap: 8px; }
.photo-pick { display: flex; flex-direction: column; gap: 8px; }
.photo-drop { position: relative; width: 160px; height: 160px; border-radius: 18px; border: 2px dashed #9AA7A0; background: var(--soft); cursor: pointer; overflow: hidden; display: block !important; }
.photo-drop input, .logo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; height: 100%; }
.photo-drop:focus-within, .logo-drop:focus-within { outline: 3px solid var(--green); outline-offset: 2px; }
.photo-preview { position: absolute; inset: 0; background: center/cover no-repeat; pointer-events: none; }
.photo-hint { position: absolute; left: 8px; right: 8px; bottom: 8px; background: rgba(255,255,255,.92); border-radius: 10px; padding: 6px 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; justify-content: center; pointer-events: none; }
.logo-row { display: flex; align-items: center; gap: 16px; }
.logo-row > div { display: flex; flex-direction: column; gap: 2px; }
.logo-drop { position: relative; width: 80px; height: 80px; border-radius: 20px; overflow: hidden; cursor: pointer; display: block !important; flex: none; }
.logo-preview { position: absolute; inset: 0; background: var(--accent) center/cover no-repeat; color: var(--on-accent); font: 800 32px var(--display); display: flex; align-items: center; justify-content: center; pointer-events: none; }

/* Orders */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.tabs a { white-space: nowrap; padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; background: var(--white); text-decoration: none; color: var(--ink); font-size: 14px; }
.tabs a small { color: var(--muted); }
.tabs a.on { background: var(--green); color: var(--paper); }
.tabs a.on small { color: #C9D6CF; }
.orders { display: flex; flex-direction: column; gap: 14px; }
.order { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 20px; }
.order:target { box-shadow: 0 0 0 3px var(--accent); }
.order h2 { margin: 0; }
.items { width: 100%; border-collapse: collapse; font-size: 15px; }
.items td { padding: 6px 0; border-bottom: 1px solid #ECEEE8; }
.items .tot td { font-weight: 700; border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.cust { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 15px; }
.cust dt { color: var(--muted); }
.cust dd { margin: 0; }
.order select { width: auto; min-height: 40px; padding: 6px 10px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--white); text-decoration: none; }
.pager a.on { background: var(--green); color: var(--paper); }

/* Storefront */
.shop { max-width: 960px; margin: 0 auto; background: var(--white); min-height: 100vh; }
body:has(.shop) { background: var(--soft); }
.shop-top { background: var(--green); height: 120px; }
.shop-top-inner { padding: 16px 20px; text-align: right; }
.shop-host { font-size: 12px; color: #C9D6CF; }
.shop-head { padding: 0 20px; margin-top: -40px; }
.shop-head h1 { font-size: 26px; margin: 8px 0 4px; }
.shop-logo { width: 80px; height: 80px; border-radius: 22px; border: 4px solid var(--white); background: var(--accent) center/cover no-repeat; color: var(--on-accent); display: flex; align-items: center; justify-content: center; font: 800 32px var(--display); }
.shop-search { padding: 16px 20px 8px; }
.shop-search input { background: var(--soft); border-color: transparent; }
.shop-grid { padding: 8px 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 14px; }
.item { display: flex; flex-direction: column; gap: 6px; }
.item[hidden] { display: none; }
.item-img { position: relative; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--soft); border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.item.oos .item-img img { opacity: .5; }
.oos-tag { position: absolute; left: 8px; top: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.item h2 { font-size: 15px; font-weight: 500; margin: 0; }
.price { margin: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price s { font-size: 13px; color: #6A746F; }
.off { font-size: 12px; font-weight: 700; color: var(--wa); }
.btn.add { width: 100%; border-color: var(--green); color: var(--green); }
.stepper { display: flex; align-items: center; justify-content: space-between; border-radius: 12px; background: var(--green); color: #fff; min-height: 44px; min-width: 112px; }
.stepper button { background: none; border: 0; color: #fff; font: 700 20px var(--body); width: 44px; height: 44px; cursor: pointer; }
.stepper span { font-weight: 700; }
.cartbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(928px, calc(100% - 32px)); background: var(--green); color: var(--paper); border-radius: 18px; padding: 8px 8px 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 8px 24px rgba(15,61,46,.3); z-index: 10; }
.cartbar[hidden] { display: none; }
body.has-cart .shop { padding-bottom: 90px; }

/* Bottom sheets */
.sheet { border: 0; padding: 24px 20px 28px; width: min(560px, 100%); max-height: 92vh; border-radius: 24px 24px 0 0; margin: auto auto 0; overflow-y: auto; color: var(--ink); background: var(--white); }
.sheet::backdrop { background: rgba(20,32,27,.55); }
@media (min-width: 640px) { .sheet { border-radius: 24px; margin: auto; } }
.sheet h2 { font: 800 22px var(--display); padding-right: 40px; }
.sheet .x { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--soft); font-size: 24px; cursor: pointer; color: var(--ink); }
.sheet form[method=dialog] { margin: 0; }
.sheet > form[method=dialog] .btn { margin-top: 10px; }
.pd-img img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 16px; background: var(--soft); margin-bottom: 14px; }
.co-items { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.co-row { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid #ECEEE8; }
.co-row .num { min-width: 70px; font-weight: 700; }
.co-total { display: flex; justify-content: space-between; font-size: 18px; margin: 4px 0 16px; }

/* ---- v2: options, plans, owner ---- */
@media (max-width: 760px) { .nav a.hide-m { display: none; } }
.upsell { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: #FFF6E6; }
.upsell p { margin: 0; }
.options { border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.options legend { font-size: 14px; font-weight: 700; padding: 0 6px; }
.options p { margin: 0; }
.opt-head, .opt-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 56px 44px; gap: 8px; align-items: center; }
.opt-head { font-size: 12px; color: var(--muted); font-weight: 700; }
#optRows { display: flex; flex-direction: column; gap: 8px; }
#optRows:empty + template + .row { margin-top: 0; }
.opt-row input:not(.switch) { min-height: 44px; padding: 8px 10px; }
.opt-del { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--soft); font-size: 22px; cursor: pointer; color: var(--muted); }
.opt-del:hover { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.chips:empty { display: none; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--white); color: var(--ink); font: 500 15px var(--body); cursor: pointer; }
.chip.on { border-color: var(--green); background: var(--green); color: #fff; }
.chip.oos { text-decoration: line-through; color: #8A938E; cursor: not-allowed; }
.co-row small { display: block; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 4px; }
.plan-card.pro { box-shadow: 0 0 0 2px var(--accent); }
.plan-price { font: 800 32px var(--display); margin: 0; }
.plan-price small { font: 400 15px var(--body); color: var(--muted); }
.plan-price.sm { font-size: 20px; }
.plan-now p { margin: 0; }
.ticks { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.ticks li { padding-left: 26px; position: relative; }
.ticks li::before { content: ''; position: absolute; left: 4px; top: 5px; width: 12px; height: 7px; border-left: 2.5px solid var(--wa); border-bottom: 2.5px solid var(--wa); transform: rotate(-45deg); }
.period { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 16px; }
.period-opt { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer; }
.period-opt:has(input:checked) { border-color: var(--green); background: #E1F0E6; }
.period-opt input { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }
.period-opt span { display: flex; flex-direction: column; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 18px; }
.steps li { padding-left: 4px; }
.steps li > * { display: flex; margin-top: 6px; }
.steps li > b { margin-top: 0; }
.steps li > .btn { display: inline-flex; }
.qr { width: 200px; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.dot { background: var(--accent); color: var(--on-accent) !important; border-radius: 10px; padding: 0 7px; font-weight: 700; }
.stat small, .stat a { font-size: 13px; }
.search-row input { flex: 1; min-width: 0; }
.store-row h2 a { color: var(--ink); text-decoration: none; }
.store-row h2 a:hover { text-decoration: underline; }
.store-row p { margin: 0; }
.store-row select { width: auto; min-height: 40px; padding: 6px 10px; }
.qr-preview { background-color: var(--soft); color: var(--muted); font-size: 18px; }
