/* Baliant Bake — checkout */
:root{
  --bg:#faf6f0; --card:#ffffff; --ink:#2b2118; --muted:#8a7a68;
  --brand:#a4552e; --brand-dark:#7d3d1f; --accent:#e7b98b;
  --line:#eadfce; --ok:#2e7d4f; --err:#b3261e; --shadow:0 6px 24px rgba(80,50,20,.08);
}
*{box-sizing:border-box}
[hidden]{display:none !important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:'Inter',system-ui,sans-serif;font-size:15px;line-height:1.55}
h1,h2,h3{font-family:'Playfair Display',serif;margin:0 0 .4rem}
h1{font-size:1.6rem}
h3{font-size:1.05rem;color:var(--brand-dark)}
.muted{color:var(--muted)}
.hint{font-size:.8rem;color:var(--muted);margin-top:.5rem}
.hint.center{text-align:center}
.r{text-align:right}

/* top bar */
.topbar{background:var(--card);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:50}
.topbar-inner{max-width:1080px;margin:0 auto;padding:.7rem 1rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:.6rem}
.brand-mark{width:38px;height:38px;border-radius:10px;background:linear-gradient(135deg,var(--brand),var(--accent));color:#fff;display:flex;align-items:center;justify-content:center;font-family:'Playfair Display',serif;font-weight:700;font-size:1rem}
.brand-name{font-family:'Playfair Display',serif;font-weight:700;font-size:1.05rem}
.brand-sub{font-size:.72rem;color:var(--muted);letter-spacing:.08em;text-transform:uppercase}
.steps{display:flex;gap:.3rem;list-style:none;margin:0;padding:0}
.step{display:flex;align-items:center;gap:.45rem;padding:.45rem .8rem;border-radius:999px;color:var(--muted);font-size:.82rem;font-weight:600}
.step .dot{width:22px;height:22px;border-radius:50%;background:#eee5d6;display:flex;align-items:center;justify-content:center;font-size:.75rem}
.step.active{background:#f7ead8;color:var(--brand-dark)}
.step.active .dot{background:var(--brand);color:#fff}
.step.done{color:var(--ok)}
.step.done .dot{background:var(--ok);color:#fff}
@media(max-width:640px){.step .label{display:none}}

/* layout */
.container{max-width:1080px;margin:1.2rem auto 3rem;padding:0 1rem}
.panel{background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:1.6rem;display:none}
.panel.active{display:block}
.panel-head{margin-bottom:1.2rem}
.panel-head p{margin:0;color:var(--muted)}

/* buttons */
.btn{font:inherit;font-weight:600;border:none;border-radius:10px;padding:.7rem 1.4rem;cursor:pointer;transition:.15s}
.btn.primary{background:var(--brand);color:#fff}
.btn.primary:hover{background:var(--brand-dark)}
.btn.primary:disabled{background:#cbb9a6;cursor:not-allowed}
.btn.ghost{background:transparent;color:var(--brand-dark);border:1px solid var(--line)}
.btn.ghost:hover{border-color:var(--brand)}
.btn.big{padding:.9rem 2.4rem;font-size:1.02rem}
.btn.link{background:none;border:none;color:var(--brand);font-weight:600;cursor:pointer;font-size:.8rem;text-decoration:underline}
.nav-btns{display:flex;justify-content:space-between;margin-top:1.4rem;gap:.8rem}

/* step 1 catalog */
.catalog-layout{display:grid;grid-template-columns:1fr 300px;gap:1.4rem;align-items:start}
@media(max-width:860px){.catalog-layout{grid-template-columns:1fr}}
.search{width:100%;padding:.7rem .9rem;border:1px solid var(--line);border-radius:10px;font:inherit;margin-bottom:1rem;background:#fdfbf7}
.search:focus{outline:2px solid var(--accent);border-color:transparent}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:.8rem}
.card{border:1px solid var(--line);border-radius:12px;padding:.9rem;background:#fffdf9;display:flex;flex-direction:column;gap:.6rem;transition:.15s}
.card:hover{border-color:var(--accent);box-shadow:0 3px 12px rgba(164,85,46,.12)}
.card-name{font-weight:600;font-size:.92rem;line-height:1.3;min-height:2.4em}
.card-price{color:var(--brand-dark);font-weight:700;font-size:.9rem}
.stepper{display:flex;align-items:center;gap:.4rem;margin-top:auto}
.stepper button{width:30px;height:30px;border-radius:8px;border:1px solid var(--line);background:#fff;font-size:1.05rem;cursor:pointer;color:var(--brand-dark)}
.stepper button:hover{border-color:var(--brand);background:#f7ead8}
.stepper .qty{min-width:2ch;text-align:center;font-weight:700}
.card.selected{border-color:var(--brand);background:#fdf3e7}

/* cart */
.cart{position:sticky;top:84px;border:1px solid var(--line);border-radius:14px;padding:1rem;background:#fffdf9}
.cart-items{display:flex;flex-direction:column;gap:.5rem;max-height:300px;overflow:auto;margin-bottom:.8rem}
.cart-line{display:flex;justify-content:space-between;gap:.5rem;font-size:.85rem;border-bottom:1px dashed var(--line);padding-bottom:.4rem}
.cart-line .x{cursor:pointer;color:var(--muted);font-weight:700;background:none;border:none}
.cart-line .x:hover{color:var(--err)}
.cart-total{display:flex;justify-content:space-between;font-weight:700;padding:.6rem 0;border-top:2px solid var(--line)}

/* forms */
.form{display:flex;flex-direction:column;gap:1rem;max-width:640px}
.field{display:flex;flex-direction:column;gap:.35rem}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media(max-width:640px){.field-row{grid-template-columns:1fr}}
label{font-weight:600;font-size:.85rem}
input[type=text],input[type=email],input[type=tel],textarea{font:inherit;padding:.7rem .9rem;border:1px solid var(--line);border-radius:10px;background:#fdfbf7;width:100%}
textarea{resize:vertical}
input:focus,textarea:focus{outline:2px solid var(--accent);border-color:transparent}
input.invalid{border-color:var(--err);outline:1px solid var(--err)}
.field-err{color:var(--err);font-size:.78rem;min-height:1em}
.field-err:empty{display:none}

/* address suggestions */
.addr-wrap{position:relative}
.suggest{position:absolute;top:calc(100% + 4px);left:0;right:0;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);max-height:260px;overflow:auto;z-index:40;width:auto}
.suggest-item{padding:.6rem .8rem;cursor:pointer;font-size:.88rem;border-bottom:1px solid #f3ecdd}
.suggest-item:last-child{border-bottom:none}
.suggest-item:hover,.suggest-item.active{background:#fdf3e7}
.field{position:relative}
.addr-chip{background:#eaf5ee;border:1px solid #bfe0cc;color:var(--ok);font-size:.82rem;padding:.45rem .7rem;border-radius:8px;margin-top:.4rem;display:flex;justify-content:space-between;gap:.5rem}
.addr-chip button{background:none;border:none;color:var(--err);cursor:pointer;font-weight:700}

/* review */
.review{display:flex;flex-direction:column;gap:1.2rem}
.review-table{width:100%;border-collapse:collapse;font-size:.9rem}
.review-table th,.review-table td{padding:.5rem .6rem;border-bottom:1px solid var(--line);text-align:left}
.review-table tfoot td{font-weight:700;border-top:2px solid var(--line)}
.review-cols{display:grid;grid-template-columns:1fr 1fr;gap:1.2rem}
@media(max-width:640px){.review-cols{grid-template-columns:1fr}}
.kv{display:grid;grid-template-columns:auto 1fr;gap:.35rem 1rem;font-size:.88rem;margin:0}
.kv dt{color:var(--muted)}
.kv dd{margin:0;font-weight:600;word-break:break-word}

/* success */
.success{text-align:center;padding:2rem 1rem}
.success-icon{width:72px;height:72px;border-radius:50%;background:var(--ok);color:#fff;font-size:2.2rem;display:flex;align-items:center;justify-content:center;margin:0 auto 1rem}

.footer{text-align:center;color:var(--muted);font-size:.8rem;padding:1.5rem}

/* ---------- customer note banner (admin-set, page 1) ---------- */
.note-banner{display:flex;align-items:flex-start;justify-content:space-between;gap:.8rem;margin-top:.9rem;padding:.8rem 1rem;background:#fdecea;border:1px solid #f0b9b4;border-radius:10px;color:#b3261e;font-weight:600;font-size:.92rem}
.note-banner .x{background:none;border:none;color:#b3261e;font-weight:700;cursor:pointer;font-size:1rem;padding:0}

.card-main{display:flex;flex-direction:column;gap:.2rem;min-width:0}

/* ---------- product category sections (step 1) ---------- */
.cat-head{display:flex;align-items:baseline;gap:.6rem;margin:1.3rem 0 .6rem}
.cat-head:first-child{margin-top:0}
.cat-head h2{font-family:'Playfair Display',serif;font-size:1.15rem;margin:0;color:var(--brand-dark)}
.cat-head span{font-size:.78rem;font-weight:600}

/* ---------- product images ---------- */
.p-img{width:100%;aspect-ratio:4/3;border-radius:9px;overflow:hidden;background:#f3ecdd;display:flex;align-items:center;justify-content:center}
.p-img img{width:100%;height:100%;object-fit:cover;display:block}
.noimg-icon{font-size:1.8rem;opacity:.5}
.card.out{opacity:.55}
.card-out{font-size:.74rem;font-weight:700;color:var(--err);text-transform:uppercase;letter-spacing:.05em;margin-top:auto}

/* ---------- shipping calendar ---------- */
.calendar-wrap{max-width:640px;background:#fffdf9;border:1px solid var(--line);border-radius:14px;padding:1.2rem}
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:.8rem}
.cal-head h3{margin:0}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:.35rem}
.cal-cell{border:1px solid var(--line);border-radius:9px;background:#fff;min-height:56px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.15rem;font-size:.85rem;cursor:default;padding:.3rem}
.cal-cell b{font-size:.95rem}
.cal-cell .cap{font-size:.62rem;color:var(--muted);line-height:1.1;text-align:center}
.cal-cell.avail{cursor:pointer;border-color:#bfe0cc;background:#f2faf5}
.cal-cell.avail:hover{border-color:var(--ok);box-shadow:0 2px 8px rgba(46,125,79,.25)}
.cal-cell.full{background:#f4efe6;color:var(--muted);border-style:dashed}
.cal-cell.past{background:#eee9e0;color:#b5a896;text-decoration:line-through}
.cal-cell.selected{background:var(--brand);border-color:var(--brand-dark);color:#fff}
.cal-cell.selected .cap{color:#ffe9d6}
.cal-cell.empty{border:none;background:none}
.cal-legend{display:flex;gap:1rem;flex-wrap:wrap;margin-top:.9rem;font-size:.74rem;color:var(--muted)}
.cal-legend .lg{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:.3rem;vertical-align:-1px}
.lg.avail{background:#e2f3e8;border:1px solid #bfe0cc}
.lg.sel{background:var(--brand)}
.lg.full{background:#f4efe6;border:1px dashed #d8cdb8}
.lg.past{background:#eee9e0}
.ship-date-line{font-weight:700;color:var(--brand-dark);font-size:1.05rem;margin:0}

/* ---------- step 5 : greetings ---------- */
.greet-card{border:1px solid var(--line,#e7dcc9);border-radius:12px;padding:1rem;background:#fffdf9;margin-bottom:.9rem}
.greet-card .greet-head{margin-bottom:.7rem;font-size:1rem}
.greet-card label{display:block;font-size:.8rem;color:#8a7a68;margin:.55rem 0 .25rem}
.greet-card input[type=text],.greet-card textarea{width:100%;padding:.55rem .7rem;border:1px solid #e7dcc9;border-radius:8px;font:inherit;background:#fff;resize:vertical}
.greet-card input:focus,.greet-card textarea:focus{outline:2px solid #e7b98b}
.greet-summary{border-left:3px solid #e7b98b;padding:.35rem .7rem;margin-bottom:.6rem;font-size:.9rem;line-height:1.5;background:#fdf9f1;border-radius:0 8px 8px 0}
.greet-summary .muted{color:#8a7a68}

/* extra (paid) greeting cards */
.extra-cards{margin-top:1.6rem;border-top:2px dashed var(--line,#e7dcc9);padding-top:1rem}
.extra-cards-head h3{font-size:1rem;margin-bottom:.2rem}
.extra-cards-head .hint{margin-top:.2rem}
.greet-card.extra{border-style:dashed;background:#fbf7ef}
.greet-card.extra .greet-head{display:flex;align-items:center;gap:.5rem}
.greet-card.extra .greet-head b{flex:1}
.extra-remove{background:none;border:1px solid #e7dcc9;border-radius:50%;width:26px;height:26px;color:#b3261e;cursor:pointer;font-size:.85rem;line-height:1}
.extra-remove:hover{background:#fdecea;border-color:#f0b9b4}
#addExtraCard{margin-top:.3rem}

/* ---------- step 4 : multiple receivers + hamper assignment ---------- */
.rec-box{border:1px solid #e7dcc9;border-radius:12px;padding:1rem;margin-bottom:.9rem;background:#fffdf9;transition:border-color .15s, box-shadow .15s}
.rec-box.active{border-color:#a4552e;box-shadow:0 0 0 3px rgba(164,85,46,.12)}
.rec-head{display:flex;align-items:center;gap:.6rem;margin-bottom:.6rem}
.rec-head b{font-size:1rem}
.rec-remove{margin-left:auto;background:none;border:none;color:#b3261e;font-size:1rem;cursor:pointer}
.rec-assigned{display:flex;flex-wrap:wrap;gap:.4rem;margin-bottom:.8rem}
.rec-chip{display:inline-flex;align-items:center;gap:.35rem;background:#f3ecdd;border:1px solid #e7dcc9;border-radius:99px;padding:.3rem .7rem;font-size:.8rem}
.rec-chip button{background:none;border:none;color:#8a7a68;cursor:pointer;font-size:.85rem;padding:0}
.rec-box .field-err{border-color:#b3261e !important;outline:2px solid rgba(179,38,30,.35) !important}
.assign-wrap{border:1px dashed #d9c9ae;border-radius:12px;padding:1rem;margin:1rem 0}
.assign-wrap h3{margin:0 0 .3rem;font-size:1rem}
#assignPool{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.6rem}
.assign-chip{display:inline-flex;align-items:center;gap:.5rem;background:#fff;border:1px solid #e7dcc9;border-radius:99px;padding:.35rem .5rem .35rem .4rem;cursor:pointer;font:inherit;transition:border-color .15s, transform .1s}
.assign-chip:hover{border-color:#a4552e;transform:translateY(-1px)}
.assign-chip img{width:34px;height:34px;border-radius:50%;object-fit:cover}
.assign-chip .noimg{width:34px;height:34px;border-radius:50%;background:#f3ecdd;display:inline-flex;align-items:center;justify-content:center;font-size:1rem}
.assign-chip .assign-name{font-size:.85rem}
.assign-chip .assign-plus{width:22px;height:22px;border-radius:50%;background:#a4552e;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:1rem;font-weight:700}
.rec-review{border-left:3px solid #e7b98b;padding:.35rem .7rem;margin-bottom:.6rem;font-size:.9rem;line-height:1.5;background:#fdf9f1;border-radius:0 8px 8px 0}
.rec-review .muted{color:#8a7a68}

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */

/* --- sticky bottom cart on narrow screens (step 1) --- */
@media(max-width:860px){
  .catalog-layout{padding-bottom:34vh} /* keep the grid scrollable above the fixed cart */
  .cart{
    position:fixed;left:0;right:0;bottom:0;top:auto;
    z-index:60;max-height:33vh;min-height:0;
    display:flex;flex-direction:column;
    border-radius:16px 16px 0 0;border-bottom:none;
    box-shadow:0 -8px 30px rgba(80,50,20,.18);
    padding:.9rem 1rem .7rem;
  }
  .cart::before{content:'';position:absolute;top:7px;left:50%;transform:translateX(-50%);width:44px;height:4px;border-radius:2px;background:var(--line)}
  .cart h3{font-size:.95rem;margin:0 0 .4rem}
  .cart-items{flex:1 1 auto;min-height:0;max-height:none;overflow:auto;margin-bottom:.4rem}
  .cart-total{padding:.45rem 0;border-top:1px solid var(--line)}
  .cart .hint{display:none}
  .cart #toDate{width:100%}
}

/* --- product list on phones: thumbnail left, name/price/stepper right --- */
@media(max-width:640px){
  .grid{grid-template-columns:1fr}
  .card{flex-direction:row;align-items:center;gap:.8rem;padding:.7rem}
  .card .p-img{width:76px;height:76px;flex:0 0 76px;aspect-ratio:1}
  .card-main{flex:1 1 auto}
  .card-name{min-height:0}
  .stepper{margin-top:0;flex-shrink:0}
  .card-out{margin-top:0}
}

/* --- compact calendar on phones --- */
@media(max-width:560px){
  .calendar-wrap{padding:.8rem}
  .cal-grid{gap:.25rem}
  .cal-cell{min-height:42px;min-width:0;padding:.15rem;border-radius:7px;font-size:.72rem}
  .cal-cell b{font-size:.82rem}
  .cal-cell .cap{display:none}
  .cal-head h3{font-size:1rem}
  .cal-legend{gap:.6rem 1rem;font-size:.7rem}
}

/* --- misc: keep wide tables scrollable on phones --- */
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
@media(min-width:641px){.table-scroll .review-table{min-width:360px}}
@media(max-width:640px){
  .review-table th,.review-table td{padding:.4rem .35rem;font-size:.82rem}
  .review-table th:nth-child(1),.review-table td:nth-child(1){min-width:0;word-break:break-word}
  .nav-btns .btn{padding:.65rem 1rem}
  .panel{padding:1.1rem}
  .steps{gap:.15rem}
  .step{padding:.4rem .55rem}
}
