/* ==========================================================================
   Pedidos Granel — folha de estilo única, mobile-first, sem build.
   Paleta: verde-pistache (ação), açafrão (destaques), tinta verde-escura.
   ========================================================================== */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage.ada540c0e24a.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans.fa41c43a3d8e.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-ext.1ff13d113ba4.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f3f5f0;
  --surface: #ffffff;
  --sunk: #eaede6;
  --ink: #17221b;
  --muted: #5b675e;
  --faint: #8b968d;
  --line: #dce1d8;
  --leaf: #2d6a4b;
  --leaf-hover: #245a3f;
  --leaf-ink: #ffffff;
  --leaf-soft: #e1ede5;
  --saffron: #c98a06;
  --saffron-soft: #fbefcf;
  --saffron-ink: #6b4800;
  --up: #b13a25;
  --up-soft: #f7e2dc;
  --down: #22784a;
  --down-soft: #dbefe2;
  --info-soft: #e3ebf3;
  --info: #2f5c86;
  --bar: #17221b;
  --bar-ink: #f3f5f0;
  --focus: #2d6a4b;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --font-display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --header-h: 56px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101612;
    --surface: #172019;
    --sunk: #0c110e;
    --ink: #e6ece6;
    --muted: #a0ada3;
    --faint: #738077;
    --line: #283329;
    --leaf: #74c495;
    --leaf-hover: #8fd3ab;
    --leaf-ink: #0d1711;
    --leaf-soft: #1c3226;
    --saffron: #f0b437;
    --saffron-soft: #3a2d0e;
    --saffron-ink: #f6d48a;
    --up: #f08a74;
    --up-soft: #3c1f19;
    --down: #78cf9a;
    --down-soft: #18301f;
    --info-soft: #1b2733;
    --info: #9cc3e6;
    --bar: #e6ece6;
    --bar-ink: #101612;
    --focus: #74c495;
    color-scheme: dark;
  }
}

/* ----------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
[x-cloak] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 16px; height: 16px; }

:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

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

/* ----------------------------------------------------------------- shell */
.app-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 28px; color: var(--leaf); }
.top-nav { display: none; gap: 2px; margin-left: 18px; }
.top-nav a { text-decoration: none; padding: 7px 11px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .94rem; }
.top-nav a:hover { color: var(--ink); background: var(--sunk); }
.top-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--sunk); }
.dot-count {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--saffron); color: #1d1500; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center; line-height: 1; border: 2px solid var(--paper);
}
.avatar {
  width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center;
  background: var(--leaf-soft); color: var(--leaf); font-weight: 700; font-size: .8rem; font-family: var(--font-display);
}

.main { padding: 18px var(--gutter) calc(var(--tabbar-h) + 32px + var(--safe-b)); max-width: 1120px; margin: 0 auto; }
.main.has-cartbar { padding-bottom: calc(var(--tabbar-h) + 120px + var(--safe-b)); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--faint); font-size: .72rem; font-weight: 600;
}
.tabbar a[aria-current="page"] { color: var(--leaf); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--leaf);
}
.tabbar .dot-count { top: 6px; right: calc(50% - 24px); border-color: var(--surface); }

@media (min-width: 900px) {
  .top-nav { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 48px; }
  .main.has-cartbar { padding-bottom: 120px; }
  h1 { font-size: 1.9rem; }
}

/* ----------------------------------------------------------------- page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 18px; }
.page-head .lead { flex: 1 1 260px; display: grid; gap: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 10px; }
.back:hover { color: var(--ink); }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

/* ----------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 16px; }
@media (min-width: 640px) { .card-pad { padding: 20px 22px; } }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); align-items: start; } .sticky-side { position: sticky; top: calc(var(--header-h) + 16px); } }
.divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--leaf); color: var(--leaf-ink); }
.btn-primary:hover { background: var(--leaf-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-quiet { background: transparent; color: var(--muted); padding: 0 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--sunk); }
.btn-danger { background: var(--up-soft); color: var(--up); }
.btn-danger:hover { background: color-mix(in srgb, var(--up-soft) 70%, var(--up)); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1.02rem; padding: 0 24px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.link { color: var(--leaf); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ----------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  font-size: 1rem; /* evita zoom no iOS */
}
.field textarea { min-height: 88px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
.field .help { font-size: .8rem; color: var(--faint); }
.field .errorlist, .errorlist { list-style: none; margin: 0; padding: 0; color: var(--up); font-size: .84rem; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--leaf); margin-top: 2px; flex: none; }

.search {
  position: relative; display: flex; align-items: center;
}
.search .i { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; min-height: 50px; padding: 0 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 1rem; }
.search input:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .htmx-indicator { position: absolute; right: 16px; }

/* ----------------------------------------------------------------- chips & tabs */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: .88rem; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: none;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .count { font-size: .75rem; opacity: .75; }

/* ----------------------------------------------------------------- catálogo */
.catalog-tools { position: sticky; top: var(--header-h); z-index: 20; background: var(--paper); padding: 10px 0 8px; margin-top: -8px; display: grid; gap: 10px; }
.notice { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.notice .i { color: var(--saffron); margin-top: 1px; }

.countdown { display: inline-flex; align-items: center; gap: 6px; width: fit-content; margin: 0; font-size: .82rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.countdown .i { color: var(--faint); }
.countdown-warn { padding: 3px 10px; border-radius: 99px; background: var(--saffron-soft); color: var(--saffron-ink); }
.countdown-warn .i { color: var(--saffron-ink); }

.product-list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 900px) { .product-list { grid-template-columns: 1fr 1fr; column-gap: 0; } .product:nth-child(odd) { border-right: 1px solid var(--line); } }

.product {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px;
  padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); min-height: 84px;
  transition: background-color .2s;
}
.product.in-cart { background: linear-gradient(90deg, var(--leaf-soft), transparent 70%); }
.product.in-cart::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--leaf); }
.product-name { font-weight: 600; font-size: .95rem; line-height: 1.3; overflow-wrap: anywhere; }
.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.product-code { font-size: .75rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.product-name .product-code { font-weight: 500; margin-right: 2px; }
.price { font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price small { font-size: .72em; font-weight: 600; color: var(--muted); margin-right: 2px; }
.product-side { display: grid; justify-items: end; gap: 8px; }
.fav-form { margin: 0; }
.fav-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 99px; background: transparent; color: var(--faint); cursor: pointer; }
.fav-btn:hover { color: var(--saffron); background: var(--saffron-soft); }
.fav-btn[aria-pressed="true"] { color: var(--saffron); }
.fav-btn[aria-pressed="true"] .i { fill: currentColor; }
.htmx-request .fav-btn, .htmx-request.fav-form .fav-btn { opacity: .6; }
.line-total { font-size: .78rem; color: var(--leaf); font-weight: 600; font-variant-numeric: tabular-nums; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.tag-featured { background: var(--saffron-soft); color: var(--saffron-ink); }
.tag-new { background: var(--info-soft); color: var(--info); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }

/* stepper — o controle mais tocado do sistema */
.stepper { display: inline-flex; align-items: center; height: 44px; border-radius: 999px; background: var(--leaf); color: var(--leaf-ink); }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.stepper button:hover { background: rgb(0 0 0 / .12); }
.stepper input {
  width: 44px; height: 44px; border: 0; background: transparent; color: inherit; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; -moz-appearance: textfield; appearance: textfield; padding: 0;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: rgb(0 0 0 / .14); border-radius: 8px; }
.add-btn {
  width: 44px; height: 44px; border-radius: 999px; border: 1.5px solid var(--leaf); background: transparent; color: var(--leaf);
  display: grid; place-items: center; cursor: pointer;
}
.add-btn:hover { background: var(--leaf); color: var(--leaf-ink); }
.htmx-request .stepper, .htmx-request.stepper, .htmx-request .add-btn { opacity: .7; }

.load-more { padding: 18px; text-align: center; color: var(--faint); font-size: .85rem; grid-column: 1 / -1; }

/* barra do pedido (fixa acima da tabbar) */
.cartbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px + var(--safe-b)); z-index: 35;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px;
  background: var(--bar); color: var(--bar-ink); border-radius: 26px; text-decoration: none;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
  animation: rise .25s ease-out;
}
.cartbar-info { display: grid; line-height: 1.2; min-width: 0; }
.cartbar-total { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.cartbar-sub { font-size: .76rem; opacity: .75; }

/* meta coletiva de frete: <progress> estilizado (sem style inline, compatível com a CSP) */
.goal { display: grid; gap: 6px; --goal-track: var(--sunk); --goal-fill: var(--leaf); }
.goal-text { font-size: .8rem; line-height: 1.35; color: var(--muted); }
.goal-bar { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 99px; overflow: hidden; background: var(--goal-track); color: var(--goal-fill); }
.goal-bar::-webkit-progress-bar { background: var(--goal-track); }
.goal-bar::-webkit-progress-value { background: var(--goal-fill); border-radius: 99px; transition: width .3s ease; }
.goal-bar::-moz-progress-bar { background: var(--goal-fill); border-radius: 99px; }
.goal-compact { margin-top: 4px; gap: 4px; }
.goal-compact .goal-text { font-size: .72rem; }
.cartbar .goal { --goal-track: color-mix(in srgb, var(--bar-ink) 25%, transparent); --goal-fill: var(--saffron); }
.cartbar .goal-text { color: inherit; opacity: .8; }
.kv + .goal { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.cartbar .btn { margin-left: auto; background: var(--leaf); color: var(--leaf-ink); }
@media (prefers-color-scheme: dark) { .cartbar .btn { background: var(--leaf-ink); color: var(--leaf); } }
@media (min-width: 900px) { .cartbar { bottom: 20px; left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100% - 40px)); animation: none; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* ----------------------------------------------------------------- listas / tabelas */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
.list-entry { border-bottom: 1px solid var(--line); }
.list-entry:last-child { border-bottom: 0; }
.list-entry .list-item { border-bottom: 0; }
.list-row { display: flex; align-items: center; }
.list-row .list-item { flex: 1; min-width: 0; }
.list-row .icon-btn { flex: none; margin-right: 8px; color: var(--leaf); }
.list-actions { display: flex; justify-content: flex-end; margin: 0; padding: 0 16px 12px; }
a.list-item:hover { background: var(--paper); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.chev { color: var(--faint); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--paper); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--paper) 60%, transparent); }

/* tabela que vira cartões no celular */
@media (max-width: 699px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
  .rtable tr:last-child { border-bottom: 0; }
  .rtable td { padding: 0; border: 0; text-align: left !important; }
  .rtable td[data-label]::before { content: attr(data-label) " "; color: var(--faint); font-size: .76rem; }
  .rtable td.primary { grid-column: 1 / -1; font-weight: 600; }
  .rtable td.end { text-align: right !important; justify-self: end; }
  .rtable td.hide-sm { display: none; }
}

/* ----------------------------------------------------------------- status */
.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.st-draft { background: var(--sunk); color: var(--muted); }
.st-requested { background: var(--info-soft); color: var(--info); }
.st-quoted { background: var(--saffron-soft); color: var(--saffron-ink); }
.st-approved { background: var(--down-soft); color: var(--down); }
.st-rejected, .st-canceled { background: var(--up-soft); color: var(--up); }
.st-pending { background: var(--saffron-soft); color: var(--saffron-ink); }
.st-applied { background: var(--down-soft); color: var(--down); }
/* pagamento e entrega depois da aprovação */
.st-receipt_sent, .st-picking { background: var(--info-soft); color: var(--info); }
.st-shipped { background: var(--saffron-soft); color: var(--saffron-ink); }
.st-paid, .st-delivered { background: var(--down-soft); color: var(--down); }

/* ----------------------------------------------------------------- resumo / valores */
.kv { display: grid; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.kv-row dt { color: var(--muted); }
.kv-row dd { margin: 0; font-weight: 600; text-align: right; }
.kv-total { padding-top: 12px; border-top: 1px dashed var(--line); align-items: baseline; }
.kv-total dt { color: var(--ink); font-weight: 600; }
.kv-total dd { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.est { font-size: .72rem; font-weight: 600; color: var(--saffron-ink); background: var(--saffron-soft); padding: 2px 7px; border-radius: 99px; margin-left: 6px; }

.code-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--ink); color: var(--paper); font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; font-size: 1rem; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: grid; gap: 2px; padding: 14px 16px; text-decoration: none; }
.stat .v { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--muted); }
a.stat:hover { border-color: var(--faint); }
.stat.attention { background: var(--saffron-soft); border-color: transparent; }
.stat.attention .k { color: var(--saffron-ink); }

/* linha do tempo do pedido (é sequência de fato) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding-bottom: 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .node { width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.timeline .done .node { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-ink); }
.timeline .now .node { border-color: var(--saffron); box-shadow: 0 0 0 4px var(--saffron-soft); }
.timeline .bad .node { background: var(--up); border-color: var(--up); color: #fff; }
.timeline .t { font-weight: 600; font-size: .92rem; }
.timeline .d { font-size: .8rem; color: var(--muted); }

/* ----------------------------------------------------------------- alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: .92rem; }
.alert-ok { background: var(--down-soft); color: var(--down); }
.alert-error { background: var(--up-soft); color: var(--up); }
.alert-warn { background: var(--saffron-soft); color: var(--saffron-ink); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert .i { margin-top: 1px; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }

.callout { padding: 16px; border-radius: var(--r-lg); background: var(--saffron-soft); color: var(--saffron-ink); display: grid; gap: 12px; }
.callout h2 { color: var(--ink); }

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 44px 20px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--faint); stroke-width: 1.4; }
.empty h3 { color: var(--ink); }

/* ----------------------------------------------------------------- overlays */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px;
  box-shadow: 0 16px 40px -16px rgb(0 0 0 / .35);
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; border: 0; background: none; text-decoration: none; text-align: left; cursor: pointer; font-size: .94rem; }
.menu a:hover, .menu button:hover { background: var(--sunk); }
.menu .menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.notif-menu { width: min(360px, calc(100vw - 24px)); right: -48px; padding: 0; overflow: hidden; }
@media (min-width: 500px) { .notif-menu { right: 0; } }
.notif { display: grid !important; gap: 2px; padding: 12px 14px !important; border-radius: 0 !important; border-bottom: 1px solid var(--line) !important; }
.notif.unread { background: var(--leaf-soft); }
.notif .nt { font-weight: 600; font-size: .9rem; }
.notif .nb { font-size: .82rem; color: var(--muted); }
.notif .nd { font-size: .74rem; color: var(--faint); }
.notif-scroll { max-height: min(420px, 60vh); overflow-y: auto; }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgb(10 16 12 / .5); display: grid; align-items: end; }
@media (min-width: 640px) { .overlay { align-items: center; justify-items: center; padding: 20px; } }
.sheet {
  background: var(--surface); width: 100%; max-height: 92dvh; overflow-y: auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 20px var(--gutter) calc(20px + var(--safe-b));
  animation: sheet-in .22s ease-out;
}
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -8px auto 14px; }
@media (min-width: 640px) { .sheet { width: min(560px, 100%); border-radius: var(--r-lg); padding: 24px; } .sheet-grip { display: none; } }
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }

.toasts { position: fixed; z-index: 80; left: 12px; right: 12px; top: calc(var(--header-h) + 8px); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 999px; background: var(--bar); color: var(--bar-ink); font-size: .9rem; font-weight: 500; box-shadow: 0 10px 30px -12px rgb(0 0 0 / .5); max-width: 520px; }
.toast.error { background: var(--up); color: #fff; }

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner { width: 18px; height: 18px; border-radius: 99px; border: 2px solid var(--line); border-top-color: var(--leaf); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- upload */
.drop {
  position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 16px;
  border: 2px dashed var(--line); border-radius: var(--r-lg); background: var(--paper); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--leaf); background: var(--leaf-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .i { width: 32px; height: 32px; color: var(--leaf); }

/* ----------------------------------------------------------------- PIX */
.pix-grid { display: grid; gap: 16px; justify-items: center; }
@media (min-width: 640px) { .pix-grid { grid-template-columns: 200px minmax(0, 1fr); justify-items: stretch; align-items: start; } }
.pix-qr { width: 200px; max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.pix-qr svg { display: block; width: 100%; height: auto; }
.pix-code { width: 100%; min-height: 84px; resize: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; word-break: break-all; }
.pay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.pay-actions form { display: inline; }
.pay-cell { display: grid; gap: 6px; justify-items: start; }
.delivery-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.delivery-bar .field { min-width: 180px; }
.delivery-bar .grow { flex: 1 1 220px; }

/* ----------------------------------------------------------------- comparação */
.diff-counts { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.price-old { color: var(--faint); text-decoration: line-through; font-size: .85rem; }
.bar-up { color: var(--up); }
.bar-down { color: var(--down); }

/* gráfico de histórico */
.chart { width: 100%; height: auto; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--leaf); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--surface); stroke: var(--leaf); stroke-width: 2.5; }
.chart .pt-last { fill: var(--leaf); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }

/* seleção de pedidos para fechamento */
.select-row { cursor: pointer; }
.select-row:has(input:checked) td { background: var(--leaf-soft) !important; }
.close-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px + var(--safe-b)); z-index: 35;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: var(--bar); color: var(--bar-ink); box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
}
.close-bar .btn { margin-left: auto; }
@media (min-width: 900px) { .close-bar { bottom: 20px; left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100% - 40px)); } }

/* ----------------------------------------------------------------- login */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-title { font-size: 2.1rem; line-height: 1.05; letter-spacing: -0.03em; }
.auth-art { color: var(--leaf); width: 56px; height: 56px; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.hide-sm { display: none; }
@media (min-width: 700px) { .hide-sm { display: revert; } .show-sm { display: none; } }
.product-list > .empty { grid-column: 1 / -1; }
.row-center { display: flex; align-items: center; justify-content: center; gap: 10px; }
[data-grow] { flex: 1; }
.fieldset { border: 0; padding: 0; margin: 0; gap: 10px; }
.table tfoot td { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--paper); }
.table td.num, .table th.r { white-space: nowrap; }
#closing-preview .table { font-size: .84rem; }
#closing-preview .table th, #closing-preview .table td { padding: 10px 8px; }
#closing-preview .table td:first-child { white-space: normal; }
@media (max-width: 699px) { .rtable td.full { grid-column: 1 / -1; justify-self: start; text-align: left !important; } }
@media (max-width: 899px) { .stat .v { font-size: 1.35rem; white-space: nowrap; } }

/* ----------------------------------------------------------------- divisões */
.tag-split { background: var(--leaf-soft); color: var(--leaf); text-decoration: none; }
.block { display: block; }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 12px; height: 12px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); }
.pip.on { background: var(--leaf); border-color: var(--leaf); }
.pip.owner { background: var(--saffron); border-color: var(--saffron); }
.split-item { flex-wrap: wrap; align-items: flex-start; }
.split-item form.row { flex-wrap: wrap; }
.split-item .field select { min-height: 40px; }

/* ----------------------------------------------------------------- valores extras no fechamento */
.charge-all { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.charge-all .btn { grid-column: 1 / -1; justify-self: start; }
.charge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 38vh; overflow-y: auto; }
.charge-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); }
.charge-row .charge-name { grid-column: 1 / -1; }
.charge-row input:first-of-type { grid-column: 1 / -1; }
.charge-row input, .charge-all input { min-height: 40px; }
.extra-line { color: var(--saffron-ink); }
@media (prefers-color-scheme: dark) { .extra-line { color: var(--saffron); } }
@media (min-width: 640px) {
  .charge-all { grid-template-columns: 1fr 1fr auto; }
  .charge-all .btn { grid-column: auto; }
  .charge-row { grid-template-columns: 1fr 110px 110px 110px; align-items: center; }
  .charge-row .charge-name { grid-column: auto; }
  .charge-row input:first-of-type { grid-column: auto; }
}
