/* ===== Abeille — design tokens ===== */
:root{
  --cream: #FBF2DF;
  --cream-deep: #F3E5C4;
  --paper: #FFFDF8;
  --espresso: #3A2913;
  --espresso-soft: #6B5738;
  --honey: #D9971F;
  --honey-deep: #B06A16;
  --honey-pale: #F1C567;
  --sage: #78865A;
  --sage-deep: #5C6B42;
  --line: rgba(58,41,19,0.14);
  --shadow: 0 6px 20px rgba(58,41,19,0.10);
  --radius-hex: 12px;
  --radius-card: 18px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;}
body{
  font-family:var(--font-body);
  background-color:var(--cream);
  background-image:
    linear-gradient(180deg, rgba(251,242,223,0.94), rgba(251,242,223,0.97) 40%, var(--cream) 70%),
    url('../icons/bg-frame.png');
  background-repeat:no-repeat;
  background-position:top center;
  background-size:130% auto;
  color:var(--espresso);
  min-height:100vh;
  padding-bottom:76px;
  -webkit-font-smoothing:antialiased;
}
img{max-width:100%; display:block;}
button{font-family:inherit; cursor:pointer;}
a{color:inherit;}
::selection{background:var(--honey-pale); color:var(--espresso);}
:focus-visible{outline:2px solid var(--honey-deep); outline-offset:2px;}

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

/* ===== Top bar ===== */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px 10px;
}
.brand{display:flex; align-items:center; gap:10px;}
.brand-mark{width:38px; height:38px; flex-shrink:0; border-radius:10px; overflow:hidden;}
.brand-mark img{width:100%; height:100%; object-fit:cover;}
.brand-name{
  font-family:var(--font-display);
  font-size:1.5rem;
  font-weight:600;
  letter-spacing:0.01em;
}
.cart-btn{
  position:relative;
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:999px;
  width:42px; height:42px;
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow);
}
.cart-btn svg{width:20px; height:20px; stroke:var(--espresso); fill:none;}
.cart-count{
  position:absolute; top:-4px; right:-4px;
  background:var(--honey-deep); color:#fff;
  font-size:0.68rem; font-weight:700;
  min-width:18px; height:18px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  padding:0 4px;
}

/* ===== Hero ===== */
.hero{ position:relative; padding:10px 20px 30px; }
.hero-eyebrow{ font-size:0.95rem; color:var(--sage-deep); font-weight:600; margin:0 0 4px; }
.hero h1{
  font-family:var(--font-display); font-weight:600;
  font-size:2.1rem; line-height:1.14; margin:0 0 10px; max-width:18ch;
}
.hero p{ font-size:1rem; line-height:1.5; color:var(--espresso-soft); max-width:36ch; margin:0; }

/* ===== Section headers ===== */
.section{padding:8px 20px 28px;}
.section-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:14px; }
.section-head h2{ font-family:var(--font-display); font-size:1.35rem; font-weight:600; margin:0; }
.section-head .see-all{ font-size:0.88rem; color:var(--honey-deep); font-weight:600; background:none; border:none; padding:0; }

/* ===== Honeycomb category grid ===== */
.comb-grid{ display:grid; grid-template-columns:repeat(2, 1fr); gap:12px 12px; padding-bottom:22px; }
.comb-grid .comb-tile:nth-child(2n){ transform:translateY(22px); }
.comb-tile{
  position:relative; aspect-ratio:1/0.95;
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  background:linear-gradient(155deg, var(--honey-pale), var(--honey) 70%);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:14px; border:none; color:var(--espresso);
}
.comb-tile:nth-child(2){background:linear-gradient(155deg, #E9CE93, var(--honey-deep) 75%); color:#fff;}
.comb-tile:nth-child(3){background:linear-gradient(155deg, #C9D0B4, var(--sage) 75%); color:#fff;}
.comb-tile:nth-child(4){background:linear-gradient(155deg, #F3DFA8, var(--honey) 70%);}
.comb-tile:nth-child(5){background:linear-gradient(155deg, #DDE3CC, var(--sage-deep) 75%); color:#fff;}
.comb-tile:nth-child(6){background:linear-gradient(155deg, #F1C567, var(--honey-deep) 75%); color:#fff;}
.comb-tile-icon{width:34px; height:34px; margin-bottom:8px;}
.comb-tile-label{font-family:var(--font-display); font-weight:600; font-size:1rem; line-height:1.2;}
.comb-tile-count{font-size:0.75rem; opacity:0.85; margin-top:2px;}

/* ===== Product grid ===== */
.product-grid{ display:grid; grid-template-columns:repeat(2, 1fr); gap:14px; }
.product-card{ background:var(--paper); border-radius:var(--radius-card); overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--line); }
.product-photo{ width:100%; aspect-ratio:1/1; background:var(--cream-deep); display:flex; align-items:center; justify-content:center; overflow:hidden; }
.product-photo img{width:100%; height:100%; object-fit:cover;}
.product-photo .placeholder-icon{width:40%; height:40%; opacity:0.4;}
.product-body{padding:10px 12px 12px;}
.product-name{font-weight:600; font-size:0.92rem; line-height:1.25; margin:0 0 4px;}
.product-price{color:var(--honey-deep); font-weight:700; font-size:0.92rem; margin:0 0 8px;}
.product-add{ width:100%; background:var(--espresso); color:var(--cream); border:none; border-radius:999px; padding:8px 0; font-weight:600; font-size:0.85rem; }
.product-add:active{transform:scale(0.97);}
.product-add.added{background:var(--sage-deep);}
.product-add:disabled{opacity:0.5;}

.empty-note{ background:var(--paper); border:1px dashed var(--line); border-radius:var(--radius-card); padding:22px; text-align:center; color:var(--espresso-soft); font-size:0.92rem; }

/* ===== Bottom nav ===== */
.bottom-nav{
  position:fixed; left:0; right:0; bottom:0; background:var(--paper);
  border-top:1px solid var(--line); display:flex;
  padding:6px 4px calc(6px + env(safe-area-inset-bottom)); z-index:40;
}
.nav-btn{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; background:none; border:none; padding:6px 2px; color:var(--espresso-soft); font-size:0.68rem; font-weight:600; }
.nav-btn svg{width:21px; height:21px; stroke:currentColor; fill:none;}
.nav-btn.active{color:var(--honey-deep);}

/* ===== Page system ===== */
.page{display:none;}
.page.active{display:block;}

.back-row{ display:flex; align-items:center; gap:10px; padding:16px 20px 4px; }
.back-btn{ background:var(--paper); border:1px solid var(--line); border-radius:999px; width:36px; height:36px; display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow); }
.back-btn svg{width:16px; height:16px; fill:none; stroke:var(--espresso);}
.back-title{font-family:var(--font-display); font-weight:600; font-size:1.2rem;}

/* ===== Cart drawer ===== */
.drawer-overlay{ position:fixed; inset:0; background:rgba(58,41,19,0.35); z-index:50; opacity:0; pointer-events:none; transition:opacity 0.25s; }
.drawer-overlay.open{opacity:1; pointer-events:auto;}
.drawer{
  position:fixed; right:0; top:0; bottom:0; width:min(92vw, 400px);
  background:var(--cream); z-index:51; transform:translateX(100%);
  transition:transform 0.28s ease; display:flex; flex-direction:column;
}
.drawer.open{transform:translateX(0);}
.drawer-head{ display:flex; align-items:center; justify-content:space-between; padding:18px 18px 12px; border-bottom:1px solid var(--line); }
.drawer-head h3{font-family:var(--font-display); font-size:1.25rem; margin:0;}
.drawer-close{background:none; border:none; font-size:1.4rem; line-height:1; color:var(--espresso-soft);}
.drawer-body{flex:1; overflow-y:auto; padding:14px 18px;}
.cart-line{ display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); }
.cart-line-photo{width:56px; height:56px; border-radius:10px; background:var(--cream-deep); flex-shrink:0; overflow:hidden;}
.cart-line-photo img{width:100%; height:100%; object-fit:cover;}
.cart-line-info{flex:1;}
.cart-line-name{font-weight:600; font-size:0.9rem;}
.cart-line-price{color:var(--honey-deep); font-size:0.85rem; font-weight:600;}
.qty-row{display:flex; align-items:center; gap:8px; margin-top:6px;}
.qty-btn{ width:24px; height:24px; border-radius:999px; border:1px solid var(--line); background:var(--paper); font-weight:700; font-size:0.9rem; display:flex; align-items:center; justify-content:center; }
.qty-val{font-size:0.88rem; font-weight:600; min-width:16px; text-align:center;}
.remove-line{background:none; border:none; color:var(--espresso-soft); font-size:0.78rem; text-decoration:underline; margin-left:auto;}
.drawer-foot{border-top:1px solid var(--line); padding:14px 18px calc(14px + env(safe-area-inset-bottom));}
.drawer-total{display:flex; justify-content:space-between; font-weight:700; font-size:1.05rem; margin-bottom:12px;}
.checkout-btn{ width:100%; background:var(--honey-deep); color:#fff; border:none; border-radius:999px; padding:13px 0; font-weight:700; font-size:0.98rem; }
.checkout-btn:disabled{opacity:0.5;}

/* ===== Forms / modals ===== */
.modal-overlay{ position:fixed; inset:0; background:rgba(58,41,19,0.4); z-index:60; display:none; align-items:flex-end; justify-content:center; }
.modal-overlay.open{display:flex;}
.modal-sheet{ background:var(--cream); width:100%; max-width:480px; border-radius:22px 22px 0 0; padding:22px 20px calc(22px + env(safe-area-inset-bottom)); max-height:88vh; overflow-y:auto; }
.modal-sheet h3{font-family:var(--font-display); margin:0 0 4px; font-size:1.3rem;}
.modal-sheet .sub{color:var(--espresso-soft); font-size:0.88rem; margin:0 0 16px;}
.field{margin-bottom:14px;}
.field label{display:block; font-size:0.82rem; font-weight:600; margin-bottom:6px; color:var(--espresso-soft);}
.field input, .field textarea, .field select{ width:100%; padding:11px 12px; border-radius:12px; border:1px solid var(--line); background:var(--paper); font-family:inherit; font-size:0.95rem; color:var(--espresso); }
.field textarea{resize:vertical; min-height:70px;}
.field-hint{font-size:0.76rem; color:var(--espresso-soft); margin-top:5px;}
.primary-btn{ width:100%; background:var(--espresso); color:var(--cream); border:none; border-radius:999px; padding:13px 0; font-weight:700; font-size:0.98rem; margin-top:4px; }
.primary-btn:disabled{opacity:0.5;}
.secondary-btn{ width:100%; background:none; color:var(--espresso-soft); border:1px solid var(--line); border-radius:999px; padding:11px 0; font-weight:600; font-size:0.9rem; margin-top:8px; }
.danger-btn{ background:none; color:#a83b3b; border:1px solid rgba(168,59,59,0.3); border-radius:999px; padding:9px 14px; font-weight:600; font-size:0.82rem; }

/* ===== Confirmation ===== */
.confirm-wrap{text-align:center; padding:16px 4px 6px;}
.confirm-icon{width:56px; height:56px; margin:0 auto 14px;}
.confirm-wrap h3{font-family:var(--font-display); font-size:1.3rem; margin:0 0 8px;}
.confirm-wrap p{color:var(--espresso-soft); font-size:0.92rem; line-height:1.5;}
.order-code{ display:inline-block; background:var(--paper); border:1px solid var(--line); border-radius:10px; padding:8px 14px; font-weight:700; letter-spacing:0.04em; margin:10px 0; }

/* ===== Education & Community feed ===== */
.feed-card{ background:var(--paper); border-radius:var(--radius-card); overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--line); margin-bottom:16px; }
.feed-photo{width:100%; aspect-ratio:16/10; background:var(--cream-deep); overflow:hidden;}
.feed-photo img{width:100%; height:100%; object-fit:cover;}
.feed-body{padding:14px 16px 16px;}
.feed-title{font-family:var(--font-display); font-weight:600; font-size:1.05rem; margin:0 0 6px;}
.feed-text{font-size:0.9rem; line-height:1.5; color:var(--espresso-soft); margin:0 0 8px; white-space:pre-wrap;}
.feed-link{font-size:0.85rem; font-weight:600; color:var(--honey-deep); display:inline-block;}
.feed-meta{font-size:0.76rem; color:var(--espresso-soft); opacity:0.8; margin-top:8px;}
.feed-author{font-weight:600; color:var(--sage-deep);}
.fab{
  position:fixed; right:18px; bottom:88px; z-index:30;
  background:var(--honey-deep); color:#fff; border:none;
  width:52px; height:52px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 20px rgba(176,106,22,0.4);
}
.fab svg{width:22px; height:22px; fill:none; stroke:#fff;}

/* ===== Install banner ===== */
.install-banner{
  position:fixed; left:12px; right:12px; bottom:82px;
  background:var(--espresso); color:var(--cream);
  border-radius:16px; padding:12px 14px;
  display:none; align-items:center; gap:12px;
  box-shadow:0 10px 24px rgba(0,0,0,0.25); z-index:45;
}
.install-banner.show{display:flex;}
.install-banner-icon{width:34px; height:34px; border-radius:9px; flex-shrink:0; overflow:hidden;}
.install-banner-icon img{width:100%; height:100%; object-fit:cover;}
.install-banner-text{flex:1; font-size:0.8rem; line-height:1.3;}
.install-banner-text strong{display:block; font-size:0.85rem; margin-bottom:1px;}
.install-banner-close{background:none; border:none; color:var(--cream); opacity:0.7; font-size:1.1rem; padding:2px 4px;}
.install-btn{ background:var(--honey); color:var(--espresso); border:none; border-radius:999px; padding:7px 12px; font-weight:700; font-size:0.78rem; white-space:nowrap; }

/* ===== Toast ===== */
.toast{
  position:fixed; left:50%; bottom:96px; transform:translateX(-50%) translateY(10px);
  background:var(--espresso); color:var(--cream); padding:10px 18px; border-radius:999px;
  font-size:0.85rem; font-weight:600; z-index:70; opacity:0; pointer-events:none;
  transition:opacity 0.2s, transform 0.2s;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

/* ===== Footer ===== */
.db-footer{ text-align:center; padding:8px 20px 24px; font-size:0.75rem; color:var(--espresso-soft); opacity:0.75; }
.db-footer a{font-weight:600; color:var(--sage-deep);}

.lock-wrap{ min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; text-align:center; }
.lock-wrap .brand-mark{width:64px; height:64px; margin-bottom:16px;}
.lock-wrap h1{font-family:var(--font-display); font-size:1.6rem; margin:0 0 20px;}
.pin-input{ font-size:1.6rem; letter-spacing:0.5em; text-align:center; width:220px; padding:14px 10px 14px 20px; border-radius:14px; border:1px solid var(--line); background:var(--paper); margin-bottom:14px; }
.pin-error{color:#a83b3b; font-size:0.85rem; min-height:1.2em; margin-bottom:8px;}

.admin-tabs{ display:flex; gap:8px; overflow-x:auto; padding:14px 20px; }
.admin-tab{ background:var(--paper); border:1px solid var(--line); border-radius:999px; padding:8px 14px; font-size:0.85rem; font-weight:600; color:var(--espresso-soft); white-space:nowrap; }
.admin-tab.active{background:var(--espresso); color:var(--cream); border-color:var(--espresso);}
.admin-list-item{ background:var(--paper); border:1px solid var(--line); border-radius:16px; padding:12px 14px; margin-bottom:10px; display:flex; gap:12px; align-items:center; }
.admin-list-photo{width:52px; height:52px; border-radius:10px; background:var(--cream-deep); overflow:hidden; flex-shrink:0;}
.admin-list-photo img{width:100%; height:100%; object-fit:cover;}
.admin-list-info{flex:1; min-width:0;}
.admin-list-info .name{font-weight:600; font-size:0.92rem;}
.admin-list-info .meta{font-size:0.78rem; color:var(--espresso-soft);}
.admin-list-actions{display:flex; gap:6px; flex-shrink:0;}
.icon-btn{ background:var(--cream-deep); border:none; border-radius:999px; width:32px; height:32px; display:flex; align-items:center; justify-content:center; }
.icon-btn svg{width:15px; height:15px; fill:none; stroke:var(--espresso);}
.status-pill{ display:inline-block; font-size:0.72rem; font-weight:700; padding:3px 10px; border-radius:999px; }
.status-new{background:#F3DFA8; color:#6B4E10;}
.status-paid{background:#DCE7C6; color:#3E5326;}
.status-ready{background:#CFE3E8; color:#1F4B54;}
.status-picked{background:#E2DCD3; color:var(--espresso-soft);}

@media (min-width:560px){
  .comb-grid{grid-template-columns:repeat(3,1fr);}
  .product-grid{grid-template-columns:repeat(3,1fr);}
}
