/* =====================================================================
   Tangra Square — customer pages (v14): dish page, cart, checkout, tracking, account
   ===================================================================== */
:root { --good: #1F8A4C; --muted-2: #9A8F84; }
[hidden] { display: none !important; }

/* ---------- Branding hooks ---------- */
.announce-bar { background: var(--ink); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 9px 14px; }
.brand-seal { display: grid; place-items: center; text-decoration: none; overflow: hidden; }
.brand-seal.has-logo { background: none; box-shadow: none; }
.brand-seal img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hero-card.has-photo { background-image: linear-gradient(100deg, rgba(112, 10, 26, .94) 0%, rgba(150, 16, 36, .78) 48%, rgba(20, 10, 8, .35) 100%), var(--hero-photo); background-size: cover; background-position: center; }
.hero-card.has-photo .hero-bowl { display: none; }

/* ---------- Prices, discount + sold-out ---------- */
.price-now { font-weight: 800; }
.price-was { color: var(--muted-2); font-weight: 500; font-size: .78em; margin-left: 6px; text-decoration-thickness: 1px; }
.price-off { margin-left: 8px; font-size: .62em; font-weight: 800; color: var(--good); background: #E6F4EC; padding: 3px 7px; border-radius: 7px; letter-spacing: .02em; vertical-align: middle; }
.tag-off { background: var(--good); color: #fff; font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 7px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); letter-spacing: .02em; }
.dish-price { display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 2px; }
.dish.sold-out .dish-media img, .dish.sold-out .dish-ph { filter: grayscale(1); opacity: .5; }
.dish.sold-out .dish-name { color: #8B8177; }
.dish.sold-out .dish-price { color: var(--muted-2); }
.soldout-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(33, 26, 21, .88); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; padding: 7px 14px; border-radius: 999px; white-space: nowrap; }
.soldout-badge.big { font-size: 15px; padding: 10px 20px; }
.dish-soon { font-weight: 700; }

/* ---------- Pages shell ---------- */
.pages { padding: 0 14px 120px; min-height: 60vh; }
.page-in { max-width: 1180px; margin: 0 auto; padding: 14px 0 20px; }
.page-in.narrow { max-width: 880px; }
.page-top { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.page-top h1 { font-size: 26px; font-weight: 800; line-height: 1.15; outline: none; }
.back-btn { width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 1px solid var(--ring); display: grid; place-items: center; flex: none; cursor: pointer; box-shadow: 0 1px 2px rgba(33, 26, 21, .05); }
.back-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:hover { border-color: var(--red); }
.page-loading { padding: 60px 0; text-align: center; color: var(--muted); }
.steps { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; }
.steps li { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted-2); padding: 8px 4px; border-bottom: 3px solid #E8DED0; }
.steps li.on { color: var(--red); border-color: var(--red); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.text-link { background: none; border: 0; color: var(--red); font-weight: 700; font-size: 14px; padding: 6px; cursor: pointer; text-align: center; }
.text-link:hover { text-decoration: underline; }
.cart-bar.on-page { display: none !important; }

.summary-card, .form-card { background: #fff; border: 1px solid var(--ring); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 12px; }
.form-card { margin-bottom: 14px; box-shadow: none; }
.summary-card h2, .form-card h2 { font-size: 19px; font-weight: 800; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; }
.sum-row.save strong { color: var(--good); }
.sum-row.total { font-size: 17px; border-top: 1px dashed #E3D6C3; padding-top: 12px; }
.sum-row.total strong { font-size: 22px; }
.sum-note { font-size: 13px; color: #9B1B2B; background: #FDECEE; border-radius: 12px; padding: 10px 12px; font-weight: 600; }
.place-order-btn:disabled { background: #D9D2CA; box-shadow: none; cursor: not-allowed; }
.place-order-btn.compact { display: inline-flex; width: auto; padding: 12px 22px; margin-top: 8px; }
.closed-note { background: #FDECEE; color: #9B1B2B; border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.order-instructions { font-size: 13.5px; background: #FFF6E2; border-radius: 12px; padding: 10px 12px; color: #6B4B00; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.form-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--ink); }
.form-card input:not([type=checkbox]):not([type=hidden]), .form-card textarea, .summary-card input { padding: 12px 14px; border: 1px solid var(--ring); border-radius: 14px; background: #FFFDFA; font: 500 15px 'Inter', system-ui, sans-serif; width: 100%; color: var(--ink); }
.form-card textarea { min-height: 84px; resize: vertical; }
.form-card input:focus, .form-card textarea:focus, .summary-card input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214, 41, 59, .12); outline: none; }
.account-actions { display: flex; flex-direction: column; gap: 10px; }
.account-profile-card { gap: 4px; }
.account-intro { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.empty-state { text-align: center; padding: 44px 16px; background: #fff; border: 1px dashed #DDCFBA; border-radius: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state h2 { font-size: 22px; } .empty-state p { color: var(--muted); font-size: 14.5px; }
.empty-ic { font-size: 38px; }

/* ---------- Cart ---------- */
.cart-line { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 12px; background: #fff; border: 1px solid var(--ring); border-radius: 20px; padding: 12px; margin-bottom: 12px; align-items: start; }
.cl-media { position: relative; width: 78px; height: 78px; border-radius: 14px; overflow: hidden; background: #F3E7D8; display: block; }
.cl-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-media .dish-ph svg { width: 54%; }
.cl-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cl-name { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--ink); text-decoration: none; line-height: 1.25; }
.cl-size { font-size: 12.5px; color: var(--muted); }
.cl-price { font-size: 14px; } .cl-price s { color: var(--muted-2); font-size: .9em; margin-left: 4px; }
.cart-line .cart-item-note-input { margin-top: 6px; padding: 8px 12px; border: 1px solid var(--ring); border-radius: 12px; font-size: 13px; background: #FFFDFA; width: 100%; }
.cl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cl-total { font-size: 16px; }
.cart-line .qty-stepper, .qty-stepper.big { display: inline-flex; align-items: center; background: var(--red); border-radius: 999px; color: #fff; overflow: hidden; border: 0; }
.cart-line .qty-stepper button, .qty-stepper.big button { color: #fff; background: transparent; width: 34px; height: 36px; font-size: 18px; font-weight: 700; }
.cart-line .qty-stepper span, .qty-stepper.big span { min-width: 22px; text-align: center; font-weight: 800; font-size: 14px; color: #fff; }
.qty-stepper.big button { width: 42px; height: 48px; } .qty-stepper.big button:disabled { opacity: .45; cursor: default; }
.cart-item-remove { color: #9B1B2B; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #FDECEE; border: 0; cursor: pointer; }
.suggest-block { margin-top: 22px; }
.suggest-block h2 { font-size: 21px; font-weight: 800; }
.checkout-items { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.co-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; } .co-line em { color: var(--muted); font-style: normal; } .co-line small { display: block; color: var(--muted); font-size: 12px; }
.co-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; } .co-addr { font-size: 13.5px; color: #5E544B; }

/* ---------- Dish page ---------- */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0 14px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--red); } .crumbs b { color: var(--ink); font-weight: 600; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.item-media { position: relative; border-radius: 26px; overflow: hidden; aspect-ratio: 4 / 3; background: #F3E7D8; box-shadow: var(--shadow-card); }
.item-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-media .dish-ph svg { width: 30%; max-width: 120px; }
.item-media.sold-out img, .item-media.sold-out .dish-ph { filter: grayscale(1); opacity: .5; }
.item-media .back-btn.floating { position: absolute; left: 12px; top: 12px; z-index: 2; }
.tag-off.big { position: absolute; right: 14px; top: 14px; font-size: 14px; padding: 7px 13px; border-radius: 10px; }
.item-info { display: flex; flex-direction: column; gap: 12px; }
.item-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.diet-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--ring); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.item-title { font-size: clamp(28px, 6vw, 40px); font-weight: 800; line-height: 1.1; }
.item-price { font-size: 30px; display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 4px; }
.item-price .price-off { font-size: .42em; }
.save-line { color: var(--good); font-weight: 700; font-size: 14px; margin-top: -4px; }
.item-note { font-size: 15px; color: #5E544B; font-weight: 600; }
.item-desc h2, .item-opt h2 { font-size: 15px; font-weight: 800; font-family: 'Inter', system-ui, sans-serif; margin-bottom: 6px; }
.item-desc p { font-size: 15px; line-height: 1.65; color: #5E544B; white-space: pre-line; }
.item-sizes { max-width: 360px; } .item-sizes button { padding: 12px 8px; font-size: 14px; }
.item-buy { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.buy-cta { flex: 1; min-width: 0; height: 48px; border-radius: 999px; background: var(--red); color: #fff; font-weight: 800; font-size: 15.5px; box-shadow: 0 10px 22px rgba(214, 41, 59, .3); white-space: nowrap; padding: 0 16px; cursor: pointer; }
.buy-cta.danger { background: #fff; color: var(--red); border: 1.5px solid var(--red); box-shadow: none; }
.buy-cta:disabled { background: #D9D2CA; color: #fff; box-shadow: none; cursor: default; }
.in-cart-line { font-size: 14px; color: var(--good); font-weight: 700; } .in-cart-line a { color: var(--red); }
.item-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: var(--muted); align-items: center; padding-top: 6px; border-top: 1px dashed #E3D6C3; }

/* ---------- Order tracking ---------- */
.track-hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; border-radius: 24px; padding: 20px; margin-bottom: 16px; }
.track-hero.done { background: linear-gradient(135deg, #2E8B57, #1F6F43); } .track-hero.bad { background: #6B6159; }
.track-ic { width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 26px; font-weight: 800; flex: none; }
.track-hero h2 { font-size: 22px; line-height: 1.2; } .track-hero p { font-size: 14.5px; opacity: .92; margin-top: 3px; }
.reward-card { background: #FFF6E2; border: 1px solid #F1D79B; color: #6B4B00; border-radius: 16px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }
.track-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.timeline { list-style: none; margin: 4px 0 6px; padding: 0; }
.timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: #E8DED0; }
.timeline li:last-child::before { display: none; }
.timeline li.done::before { background: var(--good); }
.timeline .dot { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid #D9CDBB; display: grid; place-items: center; font-size: 14px; font-weight: 800; color: #fff; flex: none; z-index: 1; }
.timeline li.done .dot { background: var(--good); border-color: var(--good); }
.timeline li.now .dot { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 5px rgba(214, 41, 59, .18); }
.timeline b { display: block; font-size: 15px; } .timeline small { color: var(--muted); font-size: 13px; }
.timeline li:not(.done):not(.now) b { color: var(--muted-2); }
.track-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.track-actions.two > * { flex: 1; }
.order-action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.track-btn { background: #fff; color: var(--ink); border: 1px solid var(--ring); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Orders / account lists ---------- */
.orders-list-panel { display: flex; flex-direction: column; gap: 12px; }
.orders-lookup { gap: 12px; }

/* ---------- Wider screens ---------- */
@media (min-width: 600px) { .field-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
  .pages { padding: 0 20px 90px; }
  .page-top h1 { font-size: 32px; }
  .two-col { grid-template-columns: minmax(0, 1fr) 390px; gap: 26px; }
  .two-col.even { grid-template-columns: 1fr 1fr; }
  .summary-card { position: sticky; top: calc(var(--topbar-h, 96px) + 16px); }
  .item-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .item-media { position: sticky; top: calc(var(--topbar-h, 96px) + 16px); }
  .track-grid { grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; }
  .toast { bottom: 28px; }
  .account-actions { flex-direction: row; }
}
@media (max-width: 560px) {
  .cart-line { grid-template-columns: 66px minmax(0, 1fr); }
  .cl-media { width: 66px; height: 66px; }
  .cl-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .item-buy { position: sticky; bottom: calc(78px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(251, 247, 241, 0), #FBF7F1 28%); padding: 14px 0 6px; z-index: 5; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
