/* ==========================================================================
   Panels: shared primitives for the transactional + account pages
   (cart, checkout, success, account/*, legal). Tokens only, so dark mode works.
   Loaded before the page's own CSS (cart.css, checkout.css, account.css ...).

   .page            page wrapper (use with .wrap)
   .ph              page head: .back link, h1, p, .ph-tools
   .panel           white rounded card; .panel-h heading (+ .num step circle)
   .ms              Material Symbols icon sizing helper (font loaded by base.html)
   .tile-ic         round icon tile (.hot .sun .veg .muted variants)
   .badge           status pill (.ok .warn .bad .info .muted)
   .notice          inline message strip (.brand .sun .hot .veg)
   .pick            radio/checkbox chip: <label class="pick"><input class="sr"><span>..</span></label>
   .pick-card       radio card (address, payment)
   .days            7-up weekday grid of .pick
   .switch          checkbox switch (input.switch)
   .fgrid2/.fgrid3  form grids of .field
   .prep            line_prep include inside a line (overrides its utility classes)
   .kv              key/value rows (bill style)
   .empty-card      empty state
   .btn-danger      quiet destructive button
   ========================================================================== */

.page { padding-top: clamp(16px, 2.4vw, 32px); padding-bottom: clamp(32px, 5vw, 64px); max-width: 1360px; }
.ms { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; display: inline-block; vertical-align: middle; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; }
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* page head */
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: clamp(16px, 2vw, 24px); }
.ph h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.35rem); font-weight: 800; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ph h1 small { font-family: var(--f-body); font-size: .95rem; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.ph p { color: var(--ink-2); margin-top: 6px; max-width: 62ch; font-size: .92rem; }
.ph-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .84rem; color: var(--ink-2); margin-bottom: 10px; transition: color .2s, gap .3s var(--ease); }
.back:hover { color: var(--brand); gap: 8px; }
.back .ms { font-size: 18px; }

/* panels */
.panel { background: var(--surface); color: var(--ink); border-radius: 22px; padding: clamp(16px, 2vw, 24px); box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 14px; }
.panel-h { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-size: 1.12rem; font-weight: 800; letter-spacing: -.03em; margin: 0 0 14px; }
.panel-h .num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-family: var(--f-body); font-size: .8rem; font-weight: 800; letter-spacing: 0; flex-shrink: 0; }
.panel-h .num.done { background: var(--veg); color: var(--white); }
.panel-h small { font-family: var(--f-body); font-weight: 600; font-size: .8rem; color: var(--muted); letter-spacing: 0; }
.panel-h .end { margin-left: auto; }
.panel-sub { color: var(--muted); font-size: .84rem; margin: -8px 0 14px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: .8rem; }
.link { color: var(--brand); font-weight: 800; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

/* icon tile */
.tile-ic { width: 42px; height: 42px; border-radius: 13px; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; flex-shrink: 0; }
.tile-ic svg { width: 21px; }
.tile-ic .ms { font-size: 22px; }
.tile-ic.hot { background: color-mix(in srgb, var(--hot) 13%, var(--surface)); color: var(--hot); }
.tile-ic.sun { background: color-mix(in srgb, var(--sun) 38%, var(--surface)); color: var(--egg); }
.tile-ic.veg { background: color-mix(in srgb, var(--veg) 14%, var(--surface)); color: var(--veg); }
.tile-ic.muted { background: var(--surface-2); color: var(--muted); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 800; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.badge.ok { background: color-mix(in srgb, var(--veg) 14%, var(--surface)); color: var(--veg); }
.badge.info { background: var(--mint); color: var(--mint-ink); }
.badge.warn { background: color-mix(in srgb, var(--sun) 40%, var(--surface)); color: var(--sun-ink); }
.badge.bad { background: color-mix(in srgb, var(--hot) 13%, var(--surface)); color: var(--hot); }
.badge.live::before { animation: blink 1.2s steps(2) infinite; }
:root[data-theme="dark"] .badge.warn { color: var(--sun); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.warn { color: var(--sun); } }

/* notice strip */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); color: var(--ink); font-size: .86rem; line-height: 1.45; }
.notice > .ms, .notice > svg { font-size: 20px; width: 20px; margin-top: 1px; color: var(--ink-2); }
.notice b { font-weight: 800; }
.notice.brand { background: var(--mint); color: var(--ink); }
.notice.brand > .ms, .notice.brand > svg { color: var(--brand); }
.notice.sun { background: color-mix(in srgb, var(--sun) 28%, var(--surface)); }
.notice.sun > .ms { color: var(--egg); }
.notice.hot { background: color-mix(in srgb, var(--hot) 11%, var(--surface)); }
.notice.hot > .ms { color: var(--hot); }
.notice.veg { background: color-mix(in srgb, var(--veg) 12%, var(--surface)); }
.notice.veg > .ms { color: var(--veg); }

/* pick: chip radios / checkboxes */
.picks { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { position: relative; cursor: pointer; display: inline-flex; }
.pick > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pick > span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 15px; border-radius: 99px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: .84rem; box-shadow: inset 0 0 0 1.5px var(--line); transition: background .2s, color .2s, box-shadow .2s, transform .3s var(--spring); width: 100%; text-align: center; }
.pick > span .ms { font-size: 18px; }
.pick:hover > span { box-shadow: inset 0 0 0 1.5px var(--brand); }
.pick > input:checked + span { background: var(--brand); color: var(--on-brand); box-shadow: none; }
.pick.soft > input:checked + span { background: color-mix(in srgb, var(--brand) 11%, var(--surface)); color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.pick > input:focus-visible + span { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.pick > input:disabled + span { opacity: .45; cursor: not-allowed; }
.pick:active > span { transform: scale(.96); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days .pick > span { border-radius: 13px; min-height: 44px; padding: 6px 2px; }

/* pick-card: radio cards (address, payment, delivery) */
.pick-cards { display: grid; gap: 10px; }
.pick-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 46px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; transition: background .25s, box-shadow .25s; min-width: 0; }
.pick-card > input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card::before { content: ""; position: absolute; left: 14px; top: 16px; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); transition: background .25s, box-shadow .25s, transform .35s var(--spring); }
.pick-card:hover { box-shadow: inset 0 0 0 1.5px var(--brand); }
.pick-card:has(> input:checked) { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); box-shadow: inset 0 0 0 2px var(--brand); }
.pick-card:has(> input:checked)::before { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; box-shadow: none; transform: scale(1.08); }
.pick-card:has(> input:focus-visible) { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.pick-card b { display: block; font-size: .92rem; }
.pick-card small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* switch */
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); border: 0; position: relative; margin: 0; cursor: pointer; transition: background .3s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--white); top: 3px; left: 3px; transition: transform .35s var(--spring); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(18px); }

/* form grids + field tweaks */
.fgrid2, .fgrid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fgrid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: 1 / -1; }
.field .opt-l { color: var(--muted); font-weight: 600; }
.field input:disabled { background: var(--surface-2); color: var(--muted); }
.field input[type="date"] { font-variant-numeric: tabular-nums; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B958F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.field textarea { min-height: 84px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: .86rem; font-weight: 600; cursor: pointer; color: var(--ink); }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--muted); background: var(--surface); margin: 0; flex-shrink: 0; cursor: pointer; transition: background .2s, box-shadow .2s; }
.check input:checked { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat; box-shadow: none; }
.check a { color: var(--brand); font-weight: 800; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* line_prep include (it still carries utility class names; style by element) */
.prep { font-size: .76rem; color: var(--ink-2); }
.prep p, .prep ul { margin: 3px 0 0; font-size: .76rem !important; line-height: 1.4 !important; color: var(--ink-2) !important; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.prep ul { display: block; padding: 0; list-style: none; color: var(--muted) !important; }
.prep [data-bulk-line] { margin-top: 6px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--sun) 22%, var(--surface)); }
.prep [data-bulk-line] p:first-child { font-weight: 800; color: var(--ink) !important; }
.prep .material-symbols-outlined { font-size: 14px !important; }
.prep .text-text-muted { color: var(--muted) !important; }

/* line cards (cart, checkout summary, order items) build on samudhra .line */
.line .lmeta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.line .lname { font-weight: 800; font-size: .92rem; line-height: 1.3; color: var(--ink); display: block; }
a.lname:hover { color: var(--brand); }
.line .ph-ic { width: 60px; height: 60px; border-radius: 13px; display: grid; place-items: center; font-size: 1.7rem; background: linear-gradient(135deg, var(--mint), color-mix(in srgb, var(--sun) 30%, var(--surface))); }

/* key/value rows */
.kv { display: grid; gap: 7px; font-size: .88rem; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.kv dt, .kv > div > span:first-child { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; }
.kv .sv, .kv .sv dt, .kv .sv dd { color: var(--veg); font-weight: 700; }
.kv .tot { font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.kv .tot dt, .kv .tot > span:first-child { color: var(--ink); }

/* empty state */
.empty-card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); text-align: center; padding: clamp(40px, 6vw, 72px) 20px; }
.empty-card .big { font-size: 3.6rem; line-height: 1; display: inline-block; animation: floaty 4s ease-in-out infinite; }
.empty-card h2 { font-size: 1.35rem; font-weight: 800; margin-top: 14px; }
.empty-card p { color: var(--muted); margin: 8px auto 0; max-width: 46ch; font-size: .9rem; }
.empty-card .btn { margin-top: 20px; }
@keyframes floaty { 50% { transform: translateY(-8px) rotate(-4deg); } }

.btn-danger { background: transparent; color: var(--hot); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--hot) 35%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--hot) 10%, var(--surface)); }
.btn .ms { font-size: 19px; }
.btn:hover .ms { transform: none; }

/* entrance */
.rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

@media (max-width: 767px) {
  .fgrid2, .fgrid3 { grid-template-columns: 1fr; }
  .panel { border-radius: 20px; }
  .days { gap: 4px; }
  .days .pick > span { font-size: .74rem; }
}
@media (prefers-reduced-motion: reduce) { .rise, .empty-card .big { animation: none; } }
