/* ════════════════════════════════════════════════════════════
   HANDBASKET · market-fresh design system
   display: Fraunces · body: Nunito Sans · receipt: Space Mono
   ════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-Italic.woff2') format('woff2');
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('../fonts/NunitoSans.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('../fonts/SpaceMono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('../fonts/SpaceMono-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #F6F0E1;
  --paper-2: #FCF8ED;
  --card: #FFFDF6;
  --ink: #26291F;
  --ink-soft: #6A6F5E;
  --line: #E3DABF;
  --line-soft: #EDE5CF;

  --green: #1E6B3C;
  --green-deep: #14522C;
  --green-ink: #0D3A1E;
  --green-bright: #2F8C46;
  --mint: #DCEBDD;

  --tomato: #DF4826;
  --tomato-deep: #B93A1E;
  --butter: #F2B84B;
  --butter-deep: #D99A25;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 18px;

  --shadow-s: 0 1px 2px rgba(38, 41, 31, .05), 0 2px 8px -2px rgba(38, 41, 31, .08);
  --shadow: 0 1px 2px rgba(38, 41, 31, .06), 0 10px 28px -14px rgba(38, 41, 31, .25);
  --shadow-l: 0 2px 4px rgba(38, 41, 31, .08), 0 22px 48px -20px rgba(38, 41, 31, .38);

  --display: 'Fraunces', Georgia, serif;
  --body: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SF Mono', monospace;

  --stick-awning: 58px;
  --stick-addbar: 137px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  padding-bottom: 84px;
}

/* ambient layered background: warm tints + paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(640px 420px at 4% -6%, rgba(63, 143, 76, .12), transparent 62%),
    radial-gradient(720px 480px at 102% 12%, rgba(242, 184, 75, .14), transparent 60%),
    radial-gradient(680px 520px at 46% 112%, rgba(223, 72, 38, .08), transparent 62%),
    var(--paper);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.39 0 0 0 0 0.30 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(242, 184, 75, .55); }

button { font-family: inherit; cursor: pointer; color: inherit; background: none; border: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(242, 184, 75, .8); outline-offset: 2px; border-radius: 6px; }

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
input[type='search']::-webkit-search-cancel-button { display: none; }

.ic { width: 18px; height: 18px; display: block; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .75;
}
.linkish {
  color: var(--green);
  font-weight: 800;
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 4px;
}
.linkish:hover { color: var(--green-deep); }

/* ── awning ─────────────────────────────────────────────────── */

.awning {
  position: sticky;
  top: 0;
  z-index: 60;
  background:
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, .045) 0 14px, transparent 14px 28px),
    linear-gradient(180deg, var(--green-deep), var(--green-ink));
  color: #F6EFDD;
  box-shadow: 0 6px 18px -8px rgba(13, 58, 30, .55);
}
.awning::after {
  content: '';
  display: block;
  height: 11px;
  background: conic-gradient(from 135deg at 50% 0, var(--green-ink) 90deg, #0000 0) 0 0 / 22px 11px repeat-x;
  filter: drop-shadow(0 3px 3px rgba(13, 58, 30, .28));
}
.awning-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px 10px;
  min-height: var(--stick-awning);
}
.brand { display: flex; align-items: center; gap: 10px; text-align: left; }
.brand-mark {
  font-size: 26px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: rgba(246, 239, 221, .12);
  border: 1.5px solid rgba(246, 239, 221, .28);
  border-radius: 12px 12px 14px 14px;
  transition: transform .25s cubic-bezier(.34, 1.6, .5, 1);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: 23px;
  letter-spacing: -.01em;
}
.brand-dot { color: var(--butter); }
.brand-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .28em;
  text-transform: uppercase;
  opacity: .65;
  margin-top: 3px;
}
.awning-right { display: flex; align-items: center; gap: 12px; }
.today {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  opacity: .8;
  display: none;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: inherit;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: rgba(246, 239, 221, .14); }
.icon-btn:active { transform: scale(.92); }
.awning-btn { color: #F6EFDD; }

/* ── shell / responsive layout ──────────────────────────────── */

.shell { max-width: 1180px; margin: 0 auto; padding: 14px 14px 40px; }
.main { max-width: 660px; margin: 0 auto; }
.side { display: none; }

.view { display: none; }
.view.on { display: block; animation: viewIn .3s cubic-bezier(.22, .9, .3, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 940px) {
  body { padding-bottom: 40px; }
  .today { display: inline; }
  .shell {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
    padding: 26px 22px 60px;
  }
  .side {
    display: block;
    position: sticky;
    top: calc(var(--stick-awning) + 22px);
    max-height: calc(100dvh - var(--stick-awning) - 44px);
    overflow: auto;
    padding-right: 4px;
  }
}

/* ── buttons / chips / switches ─────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14.5px;
  padding: 11px 18px;
  border-radius: 11px;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(180deg, var(--green-bright), var(--green));
  color: #FBF6E8;
  box-shadow: 0 2px 0 var(--green-ink), 0 8px 18px -8px rgba(30, 107, 60, .6);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost {
  border: 1.5px solid rgba(38, 41, 31, .22);
  background: rgba(255, 253, 246, .6);
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); background: var(--mint); }
.btn-danger { background: var(--tomato); color: #FFF4EC; }
.btn-danger:hover { background: var(--tomato-deep); }
.btn-danger-outline { border: 1.5px solid rgba(223, 72, 38, .5); color: var(--tomato-deep); background: transparent; }
.btn-danger-outline:hover { background: rgba(223, 72, 38, .08); }
.btn-big { padding: 14px 22px; font-size: 15.5px; border-radius: 13px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background .15s, transform .12s, border-color .15s;
}
.chip:active { transform: scale(.95); }
.chip-fav { border-color: rgba(217, 154, 37, .55); color: var(--butter-deep); background: rgba(242, 184, 75, .12); }
.chip-fav.on { background: var(--butter); color: #4A3607; }
.chip-danger { border-color: rgba(223, 72, 38, .45); color: var(--tomato-deep); background: rgba(223, 72, 38, .07); }
.chip-danger:hover { background: rgba(223, 72, 38, .14); }

.switch {
  position: relative;
  width: 46px;
  height: 27px;
  flex: none;
  border-radius: 999px;
  background: #D8D0B8;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #FFFDF6;
  box-shadow: 0 1px 3px rgba(38, 41, 31, .3);
  transition: transform .22s cubic-bezier(.34, 1.5, .5, 1);
}
.switch.on { background: var(--green-bright); }
.switch.on::after { transform: translateX(19px); }

.seg {
  display: inline-flex;
  background: #EAE1C8;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background .15s, color .15s, transform .12s;
}
.seg-btn:active { transform: scale(.94); }
.seg-btn.on { background: var(--green); color: #FBF6E8; box-shadow: 0 1px 3px rgba(13, 58, 30, .35); }
.seg-btn.solo { background: #EAE1C8; border-radius: 999px; }
.seg-btn.solo.on { background: var(--butter); color: #4A3607; }
.seg-mini .seg-btn { padding: 5px 10px; font-size: 12px; }

.pill {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  vertical-align: 2px;
}
.pill-current { background: var(--butter); color: #4A3607; }

/* ── list identity + budget meter ───────────────────────────── */

.list-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 12px;
}
.list-emoji {
  font-size: 26px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1.5px dashed rgba(30, 107, 60, .4);
  border-radius: 14px;
  transition: transform .2s cubic-bezier(.34, 1.6, .5, 1);
}
.list-emoji:hover { transform: rotate(-6deg) scale(1.06); }
.list-name-wrap { flex: 1; min-width: 0; }
.list-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 27px;
  letter-spacing: -.015em;
  line-height: 1.1;
  cursor: text;
  overflow-wrap: anywhere;
}
.list-name:hover { color: var(--green-deep); }
.list-meta { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.list-rename {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  width: 100%;
  border: none;
  border-bottom: 2.5px solid var(--butter);
  background: rgba(255, 253, 246, .8);
  padding: 2px 4px;
  border-radius: 6px 6px 0 0;
}

.budget-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-l);
  padding: 16px 18px 14px;
  color: #F6EFDD;
  background:
    radial-gradient(300px 140px at 90% -20%, rgba(242, 184, 75, .22), transparent 70%),
    linear-gradient(135deg, var(--green-deep) 0%, var(--green) 68%, #257A44 100%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: background .4s;
}
.budget-card[data-state='warn'] {
  background:
    radial-gradient(300px 140px at 90% -20%, rgba(242, 184, 75, .34), transparent 70%),
    linear-gradient(135deg, #6E5313 0%, #94721C 68%, #A98322 100%);
}
.budget-card[data-state='over'] {
  background:
    radial-gradient(300px 140px at 90% -20%, rgba(242, 184, 75, .25), transparent 70%),
    linear-gradient(135deg, #8C2B16 0%, var(--tomato-deep) 68%, #C4452A 100%);
  animation: overGlow 1.6s ease-in-out infinite;
}
@keyframes overGlow {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(223, 72, 38, 0); }
  50% { box-shadow: var(--shadow), 0 0 0 5px rgba(223, 72, 38, .18); }
}
.budget-card.shake { animation: shake .45s; }
@keyframes shake {
  20% { transform: translateX(-5px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
.budget-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.big-total {
  font-family: var(--display);
  font-weight: 900;
  font-size: 36px;
  letter-spacing: -.02em;
  line-height: 1.05;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.budget-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chip-budget {
  background: rgba(246, 239, 221, .14);
  border: 1px solid rgba(246, 239, 221, .35);
  color: #F6EFDD;
}
.chip-budget:hover { background: rgba(246, 239, 221, .24); }
.chip-cart {
  background: rgba(13, 58, 30, .35);
  color: rgba(246, 239, 221, .92);
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 11px;
  border-radius: 999px;
  background: rgba(13, 58, 30, .42);
  margin: 13px 0 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7CC98B, #DFF2C8);
  transition: width .55s cubic-bezier(.22, .9, .3, 1), background .4s;
  min-width: 0;
}
.budget-card[data-state='warn'] .meter-fill { background: linear-gradient(90deg, var(--butter-deep), var(--butter)); }
.budget-card[data-state='over'] .meter-fill {
  background: repeating-linear-gradient(45deg, #FFB08F 0 10px, #FF8E66 10px 20px);
  background-size: 200% 100%;
  animation: barber 1s linear infinite;
}
@keyframes barber { to { background-position: 28px 0; } }
.budget-note { font-size: 12.5px; font-weight: 600; opacity: .92; }
.budget-note b { font-weight: 800; }

/* ── add bar ────────────────────────────────────────────────── */

#addbar-zone { position: sticky; top: calc(var(--stick-awning) + 12px); z-index: 45; padding: 2px 0 10px; }
.addbar {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.addbar:focus-within { border-color: var(--green); box-shadow: var(--shadow), 0 0 0 4px rgba(47, 140, 70, .14); }
.addbar-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.addbar-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--green-bright), var(--green));
  color: #FBF6E8;
  box-shadow: 0 2px 0 var(--green-ink);
}
.addbar-icon .ic { width: 20px; height: 20px; stroke-width: 2.6; }
#add-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 0;
}
#add-input:focus { outline: none; }
#add-input::placeholder { color: #A8A48E; font-weight: 500; }
.addbar-clear {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--ink-soft);
  font-size: 13px;
  flex: none;
}
.addbar-clear:hover { background: var(--line-soft); }

.add-drop { border-top: 1.5px dashed var(--line); max-height: 330px; overflow: auto; }
.drop-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 14px 4px;
}
.drop-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
}
.drop-row:last-child { border-bottom: none; }
.drop-row:hover, .drop-row.active { background: var(--mint); }
.sug-emoji { font-size: 22px; text-align: center; }
.sug-body { min-width: 0; display: flex; flex-direction: column; }
.sug-body b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-sub { font-size: 11.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.sug-quick {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  color: var(--green);
  background: var(--card);
  transition: background .12s, color .12s, transform .12s;
}
.sug-quick:hover { background: var(--green); color: #FBF6E8; transform: scale(1.1); }
.sug-quick .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.drop-custom { border-top: 1.5px dashed var(--line); }
.drop-custom .sug-emoji { filter: grayscale(.2); }
.drop-custom b { color: var(--tomato-deep); }

/* composer */
.composer { border-top: 1.5px dashed var(--line); padding: 12px 12px 12px; animation: composerIn .25s cubic-bezier(.22, .9, .3, 1); }
@keyframes composerIn { from { opacity: 0; transform: translateY(-6px); } }
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.composer-emoji { font-size: 26px; }
.composer-name-static { font-family: var(--display); font-weight: 800; font-size: 19px; flex: 1; }
.composer-name {
  flex: 1;
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  border: none;
  border-bottom: 2.5px solid var(--butter);
  background: transparent;
  padding: 2px;
}
.composer-name:focus { outline: none; }
.composer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; }
.c-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.c-full { margin-top: 10px; }
.c-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.c-label em { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .7; }
.c-field input, .c-field select, .sheet-input {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--radius-s);
  padding: 9px 10px;
  font-size: 14.5px;
  font-weight: 600;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.c-field input:focus, .c-field select:focus, .sheet-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 140, 70, .15);
}
.c-qty, .c-price { display: flex; align-items: stretch; }
.c-qty input { text-align: center; border-radius: 0; border-left: none; border-right: none; }
.c-qty .step-btn:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.c-qty .step-btn:last-child { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.c-price { position: relative; }
.c-price i {
  font-style: normal;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border: 1.5px solid var(--line);
  border-right: none;
  border-radius: var(--radius-s) 0 0 var(--radius-s);
  background: var(--paper-2);
  color: var(--ink-soft);
  font-weight: 700;
}
.c-price input { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.composer .btn-block { margin-top: 14px; }

.step-btn {
  width: 30px;
  height: 38px;
  flex: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  font-size: 17px;
  font-weight: 800;
  color: var(--green-deep);
  transition: background .12s, transform .1s;
}
.step-btn:hover { background: var(--mint); }
.step-btn:active { transform: scale(.9); background: var(--green); color: #fff; }

/* ── quick shelf / filters / sort ───────────────────────────── */

.quickshelf { margin: 4px 0 12px; }
.shelf-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.shelf-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.shelf-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-s);
  transition: transform .15s cubic-bezier(.34, 1.5, .5, 1), border-color .15s, background .15s;
}
.shelf-chip:hover { transform: translateY(-2px); border-color: var(--green); background: var(--mint); }
.shelf-chip:active { transform: scale(.94); }
.shelf-chip i { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--ink-soft); }
.shelf-chip em { font-style: normal; font-size: 11px; opacity: .7; }

.filterbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search-pill {
  flex: 1;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--ink-soft);
  transition: border-color .15s, box-shadow .15s;
}
.search-pill:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 140, 70, .14); color: var(--green); }
.search-pill .ic { width: 16px; height: 16px; flex: none; }
.search-pill input { flex: 1; min-width: 0; border: none; background: none; font-size: 14px; font-weight: 600; }
.search-pill input:focus { outline: none; }

.sortbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 2px 8px; }
.sort-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.sort-label .ic { width: 15px; height: 15px; }
.result-note { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); padding: 12px; }
.no-results { text-align: center; color: var(--ink-soft); font-weight: 600; padding: 34px 16px; line-height: 1.7; }

/* ── aisle groups + item rows ───────────────────────────────── */

.shop-list { padding-bottom: 8px; }
.group { margin-bottom: 6px; }
.group-head {
  position: sticky;
  top: var(--stick-addbar);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  margin: 4px 0 2px;
  background: rgba(246, 240, 225, .9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--line);
}
.group-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .01em;
  flex: 1;
}
.group-count {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--line-soft);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--ink-soft);
}

.item { position: relative; margin: 8px 0; }
.item.dragging { z-index: 55; }
.swipe-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(223, 72, 38, .05) 30%, var(--tomato) 92%);
  color: #FFF2EA;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding-right: 20px;
  font-weight: 800;
  font-size: 13px;
  opacity: 0;
  transition: opacity .15s;
}
.item.swiping .swipe-bg { opacity: 1; }
.swipe-bg .ic { width: 17px; height: 17px; }

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 6px 10px 10px;
  box-shadow: var(--shadow-s);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .15s, box-shadow .15s, opacity .25s;
  cursor: pointer;
}
.item-card:hover { border-color: #CBC19F; box-shadow: var(--shadow); }
.item.dragging .item-card { box-shadow: var(--shadow-l); border-color: var(--green); cursor: grabbing; }

.check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid #C3CBAF;
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  transition: background .18s, border-color .18s, transform .18s;
}
.check:hover { border-color: var(--green-bright); transform: scale(1.1); }
.check svg { width: 18px; height: 18px; }
.check .tick { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .24s ease .04s; }
.check.on {
  background: linear-gradient(180deg, var(--green-bright), var(--green));
  border-color: var(--green);
  color: #FBF6E8;
  animation: checkPop .34s cubic-bezier(.34, 1.8, .5, 1);
}
.check.on .tick { stroke-dashoffset: 0; }
@keyframes checkPop { 45% { transform: scale(1.28); } }

.item-emoji { font-size: 23px; text-align: center; transition: filter .3s, transform .3s; }
.item-main { min-width: 0; }
.item-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: color .25s;
  text-align: left;
  padding: 0;
}
.item-name:hover { color: var(--green-deep); text-decoration: underline dotted rgba(30, 107, 60, .5); text-underline-offset: 3px; }
.item .rename-input {
  font-size: 15px;
  font-weight: 700;
  width: 100%;
  max-width: 240px;
  border: none;
  border-bottom: 2.5px solid var(--butter);
  border-radius: 5px 5px 0 0;
  background: #fff;
  padding: 2px 4px;
}
.item .rename-input:focus { outline: none; }
.item.checked .item-name { color: var(--ink-soft); }
.item.checked .item-name::after {
  content: '';
  position: absolute;
  left: -2px;
  right: -2px;
  top: 52%;
  height: 2px;
  background: var(--tomato);
  border-radius: 2px;
  transform-origin: left center;
  animation: strike .3s cubic-bezier(.22, .9, .3, 1) forwards;
}
@keyframes strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.item.checked .item-emoji { filter: grayscale(.75) opacity(.6); transform: scale(.92); }
.item.checked .item-card { opacity: .62; background: var(--paper-2); }

.item-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.item-note { font-size: 11.5px; color: var(--butter-deep); font-weight: 700; }
.aisle-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); font-weight: 600; }

.item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.line-total { font-family: var(--display); font-weight: 700; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.noprice { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: #B4AC93; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper .step-btn { width: 26px; height: 28px; font-size: 15px; border-radius: 8px; }
.qty-input {
  width: 40px;
  text-align: right;
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.qty-input:focus { outline: none; color: var(--green-deep); }
.qty-unit { font-size: 11px; color: var(--ink-soft); font-weight: 700; width: 30px; }

.grip {
  display: grid;
  place-items: center;
  width: 24px;
  height: 40px;
  color: #C0B795;
  touch-action: none;
  cursor: grab;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.grip:hover { color: var(--green); background: var(--mint); }
.grip .ic { width: 17px; height: 17px; fill: currentColor; stroke: none; }
body.is-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
body.is-dragging * { cursor: grabbing !important; }

.item-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.22, .9, .3, 1);
  background: var(--paper-2);
  border: 0 solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -6px;
}
.item.open .item-detail { max-height: 320px; border-width: 0 1.5px 1.5px; }
.item.open .item-card { border-radius: var(--radius) var(--radius) 0 0; border-bottom-color: var(--line-soft); }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 12px 4px;
}
.d-aisle, .d-notes { grid-column: 1 / -1; }
.detail-actions { display: flex; gap: 8px; padding: 10px 12px 14px; }

.item.flash .item-card { animation: rowFlash .9s ease-out; }
@keyframes rowFlash {
  0% { background: var(--mint); border-color: var(--green-bright); box-shadow: 0 0 0 4px rgba(47, 140, 70, .25); }
  100% { background: var(--card); }
}
.flip-in { animation: flipIn .34s cubic-bezier(.22, .9, .3, 1); }
@keyframes flipIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

.clear-checked { display: block; margin: 6px auto 2px; }

/* ── welcome / empty states ─────────────────────────────────── */

.welcome {
  background: var(--card);
  border: 2px dashed rgba(30, 107, 60, .42);
  border-radius: var(--radius-l);
  padding: 24px 22px;
  margin-top: 8px;
  box-shadow: var(--shadow);
}
.welcome-badge {
  font-size: 42px;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--mint), #F0E9D2);
  border-radius: 20px 20px 24px 24px;
  transform: rotate(-4deg);
  box-shadow: var(--shadow-s);
  margin-bottom: 16px;
  animation: bobble 4s ease-in-out infinite;
}
@keyframes bobble { 50% { transform: rotate(3deg) translateY(-5px); } }
.welcome-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(29px, 7.5vw, 38px);
  line-height: 1.06;
  letter-spacing: -.02em;
  color: var(--green-ink);
}
.welcome-copy { color: var(--ink-soft); font-size: 15px; max-width: 46ch; margin: 12px 0 18px; }
.welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.welcome-tpls { margin-top: 22px; }
.tpl-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.tpl-card {
  flex: none;
  width: 152px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--paper-2);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  transition: transform .18s cubic-bezier(.34, 1.5, .5, 1), border-color .15s, box-shadow .15s;
}
.tpl-card:hover { transform: translateY(-3px); border-color: var(--green); border-style: solid; box-shadow: var(--shadow); }
.tpl-emoji { font-size: 26px; }
.tpl-card b { font-size: 14px; }
.tpl-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); }

.empty { text-align: center; padding: 44px 18px 30px; }
.small-empty { padding: 34px 18px; }
.empty-art { position: relative; height: 110px; margin-bottom: 10px; }
.empty-basket {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 62px;
  filter: drop-shadow(0 8px 12px rgba(38, 41, 31, .18));
  animation: bobble 3.6s ease-in-out infinite;
}
.done-basket { animation: none; }
.float {
  position: absolute;
  font-size: 26px;
  animation: floaty 4.5s ease-in-out infinite;
}
.f1 { left: 16%; top: 12%; animation-delay: .2s; }
.f2 { left: 72%; top: 6%; animation-delay: 1.1s; }
.f3 { left: 8%; top: 58%; animation-delay: .6s; }
.f4 { left: 82%; top: 52%; animation-delay: 1.6s; }
.f5 { left: 30%; top: 78%; animation-delay: 2.2s; font-size: 22px; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-11px) rotate(7deg); }
}
.empty-title { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.01em; }
.empty-copy { color: var(--ink-soft); margin: 8px auto 16px; max-width: 38ch; }
.starter-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 480px; margin: 0 auto; }

/* ── lists + history views ──────────────────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 16px;
}
.page-title { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }

.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-l);
  padding: 13px 10px 13px 14px;
  box-shadow: var(--shadow-s);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.list-card.current { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 140, 70, .16), var(--shadow); }
.lc-emoji {
  font-size: 26px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--mint), #F0E9D2);
  border-radius: 14px;
  transition: transform .2s;
}
.lc-emoji:hover { transform: rotate(-8deg) scale(1.07); }
.lc-main { min-width: 0; cursor: pointer; }
.lc-name { font-weight: 800; font-size: 15.5px; overflow-wrap: anywhere; }
.lc-meta { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin: 2px 0 6px; }
.lc-bar { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.lc-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-bright), #7CC98B); border-radius: 999px; transition: width .5s cubic-bezier(.22, .9, .3, 1); }
.history-link { display: block; margin: 18px auto 0; }

.trip-cards { display: flex; flex-direction: column; gap: 10px; }
.trip-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-l);
  padding: 12px 16px;
  box-shadow: var(--shadow-s);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.trip-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #CBC19F; }
.trip-date {
  text-align: center;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 6px 4px;
  line-height: 1.05;
}
.trip-date b { font-family: var(--display); font-size: 21px; font-weight: 800; display: block; }
.trip-date span { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.trip-main { min-width: 0; }
.trip-main b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-main span { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.trip-total-col { text-align: right; }
.trip-total-sm { font-family: var(--display); font-weight: 800; font-size: 17px; display: block; }
.delta-under { font-family: var(--mono); font-size: 9.5px; color: var(--green); letter-spacing: .06em; }
.delta-over { font-family: var(--mono); font-size: 9.5px; color: var(--tomato); letter-spacing: .06em; }

/* ── sidebar (desktop) ──────────────────────────────────────── */

.side-sec {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-l);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-s);
}
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.side-head .shelf-label { margin: 0; }
.side-empty { font-size: 12.5px; color: var(--ink-soft); padding: 4px 2px; }
.side-list, .side-trip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 8px;
  border-radius: 10px;
  transition: background .12s, transform .12s;
}
.side-list:hover, .side-trip:hover { background: var(--mint); }
.side-list:active, .side-trip:active { transform: scale(.98); }
.side-list.current { background: var(--mint); box-shadow: inset 0 0 0 1.5px var(--green); }
.sl-emoji { font-size: 20px; text-align: center; }
.sl-main { min-width: 0; display: flex; flex-direction: column; }
.sl-main b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-main span { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.sl-check { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); }

/* ── tabbar ─────────────────────────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(252, 248, 237, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1.5px solid var(--line);
  padding: 6px 10px calc(7px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px -14px rgba(38, 41, 31, .3);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 5px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  transition: color .15s, background .15s;
}
.tab .tab-ic { width: 23px; height: 23px; }
.tab.on { color: var(--green-deep); }
.tab.on .tab-ic { animation: tabBounce .4s cubic-bezier(.34, 1.8, .5, 1); }
@keyframes tabBounce { 40% { transform: translateY(-5px) scale(1.12); } }
.tab:active { transform: scale(.94); }
.tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--tomato);
  color: #FFF2EA;
  font-family: var(--mono);
  font-size: 9.5px;
  font-style: normal;
  display: grid;
  place-items: center;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(185, 58, 30, .5);
}
@media (min-width: 940px) {
  .tabbar { display: none; }
}

/* ── toasts ─────────────────────────────────────────────────── */

#toasts {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, 92vw);
  pointer-events: none;
}
@media (min-width: 940px) { #toasts { bottom: 26px; } }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: #26291F;
  color: #F6EFDD;
  border-radius: 13px;
  padding: 12px 15px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-l);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition: opacity .25s, transform .3s cubic-bezier(.22, 1.2, .3, 1);
  border-left: 5px solid var(--green-bright);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.tone-warn { border-left-color: var(--butter); }
.toast.tone-ok { border-left-color: var(--green-bright); }
.toast-msg { flex: 1; }
.toast-act {
  color: var(--butter);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-radius: 8px;
  flex: none;
}
.toast-act:hover { background: rgba(242, 184, 75, .16); }

/* ── sheets ─────────────────────────────────────────────────── */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(24, 28, 17, .48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .28s;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 560px;
  max-height: 88dvh;
  overflow: auto;
  background: var(--paper-2);
  border-radius: 22px 22px 0 0;
  border-top: 1.5px solid var(--line);
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 60px -18px rgba(20, 24, 15, .5);
  transform: translateY(102%);
  transition: transform .34s cubic-bezier(.3, 1.1, .36, 1);
}
.sheet-wide { max-width: 640px; }
.sheet-wrap.show .sheet-scrim { opacity: 1; }
.sheet-wrap.show .sheet { transform: translateY(0); }
.sheet-grab { width: 46px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 14px; }
.sheet-title { font-family: var(--display); font-weight: 800; font-size: 23px; letter-spacing: -.01em; }
.sheet-text { color: var(--ink-soft); font-size: 14px; margin-top: 6px; max-width: 52ch; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.sheet-input { font-size: 17px; margin-top: 4px; }

/* list actions sheet */
.la-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.la-emoji {
  font-size: 30px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--mint), #F0E9D2);
  border-radius: 16px;
  flex: none;
}
.la-title { font-size: 21px; }
.la-meta { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.la-menu { display: flex; flex-direction: column; }
.la-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 10px;
  border-radius: 11px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s, transform .1s;
}
.la-row:hover { background: var(--mint); }
.la-row:active { transform: scale(.98); }
.la-danger { color: var(--tomato-deep); border-bottom: none; }
.la-danger:hover { background: rgba(223, 72, 38, .08); }
.la-inline { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

/* settings */
.set-rows { margin-top: 14px; display: flex; flex-direction: column; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.set-row b { font-size: 14.5px; display: block; }
.set-row span { font-size: 12px; color: var(--ink-soft); }
.set-danger { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.set-danger span { font-size: 11.5px; color: var(--ink-soft); }

/* trip complete */
.trip-done { text-align: center; padding: 6px 0 2px; }
.trip-badge { font-size: 52px; animation: checkPop .5s cubic-bezier(.34, 1.8, .5, 1); }
.trip-title { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: -.02em; margin-top: 6px; }
.trip-sub { color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.trip-total-wrap { margin: 18px auto 6px; }
.trip-total {
  font-family: var(--display);
  font-weight: 900;
  font-size: 46px;
  letter-spacing: -.02em;
  color: var(--green-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.trip-delta { font-weight: 800; font-size: 13.5px; margin-top: 4px; }
.trip-delta.under { color: var(--green); }
.trip-delta.over { color: var(--tomato); }
.trip-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 4px;
}
.tstat {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 6px;
}
.tstat b { font-family: var(--display); font-weight: 800; font-size: 20px; display: block; }
.tstat span { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.trip-actions { justify-content: center; }

/* ── receipt ────────────────────────────────────────────────── */

.receipt {
  position: relative;
  background: #fff;
  color: #20241C;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  width: min(400px, 100%);
  margin: 14px auto 0;
  padding: 24px 20px 20px;
  box-shadow: var(--shadow);
}
.receipt::before, .receipt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: conic-gradient(from -45deg at 50% 100%, #fff 90deg, #0000 0) 0 0 / 16px 10px repeat-x;
}
.receipt::before { top: -9px; }
.receipt::after {
  top: auto;
  bottom: -9px;
  background: conic-gradient(from 135deg at 50% 0, #fff 90deg, #0000 0) 0 0 / 16px 10px repeat-x;
}
.r-head { text-align: center; }
.r-brand { font-weight: 700; font-size: 16px; letter-spacing: .14em; }
.r-subhead { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; opacity: .6; margin-top: 2px; }
.r-meta { margin-top: 8px; font-size: 11px; opacity: .8; }
.r-rule { border-top: 1.5px dashed #B9B29E; margin: 12px 0; }
.r-rule.double { border-top: 4px double #B9B29E; }
.r-dept { font-weight: 700; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin: 10px 0 4px; display: flex; align-items: center; gap: 6px; }
.rline { display: flex; align-items: baseline; gap: 4px; }
.rline-miss { opacity: .5; }
.rline-miss em { font-style: normal; font-size: 10px; }
.rname { flex: none; max-width: 62%; }
.rlead { flex: 1; border-bottom: 2px dotted #CFC8B2; transform: translateY(-3px); min-width: 12px; }
.ramt { flex: none; font-variant-numeric: tabular-nums; }
.r-sub { display: flex; font-weight: 700; margin-top: 2px; }
.r-total-line { font-weight: 700; font-size: 15px; }
.r-verdict { text-align: center; font-weight: 700; margin-top: 8px; padding: 6px; border-radius: 6px; }
.r-verdict.under { color: var(--green-deep); background: rgba(47, 140, 70, .1); }
.r-verdict.over { color: var(--tomato-deep); background: rgba(223, 72, 38, .1); }
.r-thanks { text-align: center; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; margin-top: 14px; }
.r-barcode {
  height: 36px;
  width: 72%;
  margin: 10px auto 4px;
  background: repeating-linear-gradient(90deg,
    #20241C 0 2px, #0000 2px 4px, #20241C 4px 7px, #0000 7px 9px,
    #20241C 9px 10px, #0000 10px 14px, #20241C 14px 15px, #0000 15px 17px);
}
.r-code { text-align: center; font-size: 10px; letter-spacing: .3em; opacity: .7; }

.dept-bars { margin: 22px 2px 4px; }
.dbar-row { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; align-items: center; gap: 10px; margin: 7px 0; }
.dbar-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbar-track { height: 10px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.dbar-track i { display: block; height: 100%; border-radius: 999px; animation: barGrow .7s cubic-bezier(.22, .9, .3, 1); transform-origin: left; }
@keyframes barGrow { from { transform: scaleX(0); } }
.dbar-amt { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ── confetti canvas ────────────────────────────────────────── */

#confetti { position: fixed; inset: 0; z-index: 200; pointer-events: none; width: 100%; height: 100%; }

/* ── small screens ──────────────────────────────────────────── */

@media (max-width: 430px) {
  .composer-grid { grid-template-columns: 1fr 1fr; }
  .composer-grid .c-field:first-child { grid-column: 1 / -1; }
  .budget-right { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
  .big-total { font-size: 32px; }
  .item-card { grid-template-columns: 32px 30px minmax(0, 1fr) auto 20px; gap: 5px; padding-left: 8px; }
  .qty-unit { width: 26px; }
  .qty-input { width: 34px; }
  .detail-grid { grid-template-columns: 1fr; }
  .trip-stats { grid-template-columns: repeat(3, 1fr); }
}

/* ── reduced motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: #CFC5A6 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #CFC5A6; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
