/* ═══════════════════════════════════════════════════════════════
   KABANNAS · Mesa de pedidos
   Conceito: mesa de expedição — etiquetas de envio, carimbos,
   papel kraft, tinta preta e laranja de sinalização.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --f-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --paper: #f0eee4;
  --slip: #fcfbf6;
  --slip-2: #f5f3ea;
  --field: #ffffff;
  --ink: #1a1e14;
  --ink-2: #454b3b;
  --muted: #787d6c;
  --rule: #e2dfd2;
  --rule-2: #cbc7b6;

  /* Marca: verde-sálvia Kabannas */
  --accent: #9cae83;
  --accent-deep: #839a64;
  --accent-ink: #5b6d43;
  --accent-soft: #e6ebdc;
  --on-accent: #1a1e14;
  /* Atenção (etapa "comprar"): verde Kabannas */
  --alert: #9cae83;
  --alert-ink: #5b6d43;
  --alert-soft: #e6ebdc;
  --on-alert: #1a1e14;
  --red: #d02e2e;
  --red-soft: #f7dcdc;
  --blue: #4f6f94;
  --blue-soft: #e1e8ef;
  /* Concluído: oliva profundo (para não confundir com o verde da etapa "comprar") */
  --green: #3f5230;
  --green-soft: #e3ead7;
  --on-green: #f0eee4;

  --rail: #1a1e14;
  --rail-2: #242a1b;
  --rail-text: #f0eee4;
  --rail-muted: #9aa189;
  --rail-rule: #333a28;

  --pf-liu: #d61f69;
  --pf-shein: #1a1e14;
  --pf-shein-fg: #fcfbf6;
  --pf-shopee: #ee4d2d;
  --pf-outro: #6d7263;

  --shadow: 0 1px 0 rgba(26, 30, 20, .05), 0 14px 26px -20px rgba(26, 30, 20, .4);
  --grain: .2;
  --grain-blend: multiply;
  --stamp-blend: multiply;
  --r: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11130d;
    --slip: #191c14;
    --slip-2: #1f2319;
    --field: #15180f;
    --ink: #efece0;
    --ink-2: #cfd0c0;
    --muted: #8e9582;
    --rule: #2b3024;
    --rule-2: #414836;
    --accent: #a8ba8e;
    --accent-deep: #93a877;
    --accent-ink: #b9cb9f;
    --accent-soft: #252b1d;
    --on-accent: #12140e;
    --alert: #a8ba8e;
    --alert-ink: #b9cb9f;
    --alert-soft: #252b1d;
    --on-alert: #12140e;
    --red: #e5484d;
    --red-soft: #3a1b1c;
    --blue: #8fb0d6;
    --blue-soft: #1b2533;
    --green: #62804a;
    --green-soft: #1d2716;
    --on-green: #efece0;
    --rail: #0b0d08;
    --rail-2: #161a10;
    --rail-rule: #283020;
    --rail-text: #efece0;
    --rail-muted: #939b84;
    --pf-shein: #efece0;
    --pf-shein-fg: #1a1e14;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 30px -20px rgba(0, 0, 0, .9);
    --grain: .45;
    --grain-blend: overlay;
    --stamp-blend: normal;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11130d;
  --slip: #191c14;
  --slip-2: #1f2319;
  --field: #15180f;
  --ink: #efece0;
  --ink-2: #cfd0c0;
  --muted: #8e9582;
  --rule: #2b3024;
  --rule-2: #414836;
  --accent: #a8ba8e;
  --accent-deep: #93a877;
  --accent-ink: #b9cb9f;
  --accent-soft: #252b1d;
  --on-accent: #12140e;
  --alert: #a8ba8e;
  --alert-ink: #b9cb9f;
  --alert-soft: #252b1d;
  --on-alert: #12140e;
  --red: #e5484d;
  --red-soft: #3a1b1c;
  --blue: #8fb0d6;
  --blue-soft: #1b2533;
  --green: #62804a;
  --green-soft: #1d2716;
  --on-green: #efece0;
  --rail: #0b0d08;
  --rail-2: #161a10;
  --rail-rule: #283020;
  --rail-text: #efece0;
  --rail-muted: #939b84;
  --pf-shein: #efece0;
  --pf-shein-fg: #1a1e14;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 30px -20px rgba(0, 0, 0, .9);
  --grain: .45;
  --grain-blend: overlay;
  --stamp-blend: normal;
  color-scheme: dark;
}

/* ═══════════════════════════ Base ═══════════════════════════ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14px/1.5 var(--f-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
/* Grão de papel */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--grain); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .28 0 0 0 0 .32 0 0 0 0 .2 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }

.kicker {
  font: 500 11px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}

/* ═══════════════════════════ Layout ═══════════════════════════ */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 34px;
  padding: 28px 20px 20px;
  background: var(--rail); color: var(--rail-text);
}
.brand { display: grid; gap: 12px; color: inherit; padding: 0 2px; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 188px; max-width: 100%; height: auto; }
.brand-sub {
  display: flex; align-items: center; gap: 8px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--rail-muted);
}
.brand-sub::before { content: ""; width: 18px; height: 1px; background: var(--accent); }

.nav { display: grid; }
.nav a {
  position: relative; display: flex; align-items: baseline; gap: 12px;
  padding: 13px 6px 13px 10px; color: var(--rail-muted);
  border-top: 1px solid var(--rail-rule);
  font: 700 17px/1.1 var(--f-sans); font-stretch: 112%; letter-spacing: -.005em;
  transition: color .15s, background .15s;
}
.nav a:last-child { border-bottom: 1px solid var(--rail-rule); }
.nav a:hover { color: var(--rail-text); text-decoration: none; background: var(--rail-2); }
.nav a.active { color: var(--rail-text); background: var(--rail-2); }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.nav-no { font: 500 11px var(--f-mono); letter-spacing: .06em; }
.nav a.active .nav-no { color: var(--accent); }
.nav-badge {
  margin-left: auto; align-self: center; padding: 2px 7px; border-radius: 2px;
  font: 600 11.5px/1.3 var(--f-mono); background: var(--accent); color: var(--on-accent);
}
.nav-badge.warn { background: transparent; color: var(--alert); box-shadow: inset 0 0 0 1px var(--alert); }
.nav-badge:empty { display: none; }

.rail-foot { margin-top: auto; display: grid; gap: 12px; }
.ticket {
  position: relative; display: grid; gap: 9px; padding: 14px 14px 14px;
  border: 1px dashed var(--rail-rule); background: var(--rail-2);
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--rail);
}
.ticket::before { left: -8px; }
.ticket::after { right: -8px; }
.ticket-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--rail-muted);
}
.ticket-row b { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--rail-text); text-align: right; letter-spacing: .04em; }
.sync-dot { width: 7px; height: 7px; background: var(--accent); flex: none; }
.sync-dot.off { background: var(--rail-muted); }
.sync-dot.busy { background: var(--accent); animation: blink .9s steps(2) infinite; }
.sync-dot.err { background: var(--red); }
@keyframes blink { 50% { opacity: .2; } }
.theme-toggle {
  display: flex; align-items: center; gap: 10px; padding: 6px 4px;
  border: 0; background: none; color: var(--rail-muted); cursor: pointer;
  font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
}
.theme-toggle:hover { color: var(--rail-text); }
.rail-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-toggle .ic { width: 15px; height: 15px; }

.main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 38px 44px 140px; }

/* ═══════════════════════════ Cabeçalho de página ═══════════════════════════ */
.page-head {
  display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  margin-bottom: 24px; padding-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.page-head .kicker { display: block; margin-bottom: 10px; }
.page-head h1 {
  margin: 0; font: 900 clamp(34px, 5.2vw, 56px)/.88 var(--f-sans); font-stretch: 125%;
  text-transform: uppercase; letter-spacing: -.015em;
}
.page-sub { margin: 12px 0 0; max-width: 540px; color: var(--ink-2); font-size: 14.5px; }
.page-aside { margin-left: auto; text-align: right; }
.page-aside .big { display: block; font: 800 34px/1 var(--f-sans); font-stretch: 125%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════ Controles ═══════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 3px;
  border: 1.5px solid var(--ink); background: var(--slip); color: var(--ink);
  font: 700 12.5px/1 var(--f-sans); font-stretch: 90%; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; box-shadow: 2px 2px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn .ic { width: 15px; height: 15px; }
.btn-primary { background: var(--ink); color: var(--slip); box-shadow: 3px 3px 0 var(--accent); }
.btn-primary:hover { box-shadow: 4px 4px 0 var(--accent); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 3px 3px 0 #000; }
.btn-accent:hover { box-shadow: 4px 4px 0 #000; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--slip-2); box-shadow: none; transform: none; }
.btn-danger { color: var(--red); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 11.5px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 3px; flex: none;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--slip-2); color: var(--ink); }
.icon-btn .ic { width: 17px; height: 17px; }

input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 3px;
  border: 1px solid var(--rule-2); background: var(--field); color: var(--ink);
  font: 400 14px var(--f-sans); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c7466' stroke-width='2.4' stroke-linecap='square'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.btn:focus-visible, .icon-btn:focus-visible, .step:focus-visible, .cell:focus-visible, .tab:focus-visible, .pf-chip:focus-visible, .btn-supplier:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); cursor: pointer; }

.input-icon { position: relative; display: block; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input-icon > input, .input-icon > select { padding-left: 37px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font: 500 11.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

.field { display: grid; gap: 7px; }
.field-label { font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.field-label em { font-style: normal; color: var(--muted); margin-left: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ═══════════════════════════ Placar (status) ═══════════════════════════ */
.board {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px;
  background: var(--slip); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.cell {
  position: relative; display: grid; align-content: space-between; gap: 18px; min-height: 118px;
  padding: 15px 18px 16px; text-align: left; cursor: pointer;
  border: 0; border-left: 1px solid var(--rule); background: transparent; color: var(--ink); font: inherit;
  transition: background .15s;
}
.cell:first-child { border-left: 0; }
.cell:hover { background: var(--slip-2); }
.cell-k { display: flex; align-items: center; gap: 8px; font: 500 11px var(--f-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.cell-k::before { content: ""; width: 9px; height: 9px; background: var(--tone); flex: none; }
.cell-n { font: 800 46px/.9 var(--f-sans); font-stretch: 125%; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.cell.active { background: var(--ink); color: var(--slip); }
.cell.active .cell-k { color: color-mix(in srgb, var(--slip) 65%, transparent); }
.cell.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--tone); }
.t-alert { --tone: var(--alert); }
.t-blue { --tone: var(--blue); }
.t-green { --tone: var(--green); }
.t-ink { --tone: var(--muted); }

/* ═══════════════════════════ Filtros ═══════════════════════════ */
.filters {
  display: grid; gap: 10px; padding: 12px; margin-bottom: 12px;
  background: var(--slip); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow);
}
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filters-row .search { flex: 2 1 320px; }
.filters-row .select { flex: 1 1 190px; min-width: 175px; }
.filters-row .select.wide { flex: 1 1 235px; }
.date-extra { display: contents; }
.date-extra input { flex: 0 1 170px; width: 170px; }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips-row:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 27px; padding: 0 4px 0 10px; border-radius: 2px;
  font: 500 11px var(--f-mono); letter-spacing: .05em; text-transform: uppercase;
  background: var(--ink); color: var(--slip); border: 0;
}
.chip .ic { width: 13px; height: 13px; }
.chip button {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 2px;
  background: transparent; color: inherit; cursor: pointer;
}
.chip button:hover { background: var(--accent); color: var(--on-accent); }
.chip button .ic { width: 12px; height: 12px; }
.chip-clear { background: transparent; color: var(--accent-ink); padding: 0 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.results-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 16px 2px 12px;
  font: 500 11.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.results-bar strong { color: var(--ink); font-weight: 600; }

/* Abas (produtos) */
.tabs { display: flex; gap: 26px; margin-bottom: 16px; border-bottom: 1px solid var(--rule-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 0 12px;
  border: 0; background: none; cursor: pointer; white-space: nowrap; color: var(--muted);
  font: 700 13px var(--f-sans); font-stretch: 90%; letter-spacing: .06em; text-transform: uppercase;
}
.tab .count { font: 500 11.5px var(--f-mono); letter-spacing: 0; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ink); }
.tab .ic { width: 14px; height: 14px; }

/* ═══════════════════════════ Plataformas ═══════════════════════════ */
.pf-logo {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 2px;
  font: 800 11px/1 var(--f-sans); font-stretch: 100%; letter-spacing: -.02em; color: #fff; background: var(--pf);
}
.pf-logo .ic { width: 15px; height: 15px; }
.pf-logo.sm { width: 26px; height: 26px; font-size: 10px; }
.pf-logo.sm .ic { width: 13px; height: 13px; }
.pf-logo.xs { width: 16px; height: 16px; font-size: 7.5px; }
.pf-logo.xs .ic { width: 10px; height: 10px; }
.pf-liu { --pf: var(--pf-liu); }
.pf-shein { --pf: var(--pf-shein); }
.pf-shein.pf-logo { color: var(--pf-shein-fg); }
.pf-shopee { --pf: var(--pf-shopee); }
.pf-outro { --pf: var(--pf-outro); }

.platform-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.platform-opt { position: relative; cursor: pointer; }
.platform-opt input { position: absolute; opacity: 0; pointer-events: none; }
.platform-opt .opt {
  display: grid; justify-items: center; gap: 9px; padding: 16px 8px 13px;
  border: 1.5px solid var(--rule-2); border-radius: 3px; background: var(--field);
  font: 700 12px var(--f-sans); font-stretch: 90%; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2);
  transition: transform .08s, box-shadow .08s, border-color .15s;
}
.platform-opt .opt .pf-logo { width: 42px; height: 42px; font-size: 15px; }
.platform-opt .opt .pf-logo .ic { width: 20px; height: 20px; }
.platform-opt:hover .opt { border-color: var(--ink-2); }
.platform-opt input:checked + .opt {
  border-color: var(--ink); color: var(--ink); background: color-mix(in srgb, var(--pf) 7%, var(--field));
  box-shadow: 4px 4px 0 var(--pf); transform: translate(-2px, -2px);
}
.platform-opt input:focus-visible + .opt { outline: 2px solid var(--accent); outline-offset: 2px; }

.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px 0 5px; border-radius: 2px;
  border: 1px solid var(--rule-2); background: var(--field); color: var(--muted); cursor: pointer;
  font: 700 11px var(--f-sans); font-stretch: 90%; letter-spacing: .07em; text-transform: uppercase;
  transition: all .12s;
}
.pf-chip .pf-logo { filter: grayscale(1); opacity: .5; }
.pf-chip:hover { color: var(--ink); border-color: var(--ink-2); }
.pf-chip:hover .pf-logo { filter: none; opacity: 1; }
.pf-chip.active { color: var(--ink); border-color: var(--ink); box-shadow: 2px 2px 0 var(--pf); }
.pf-chip.active .pf-logo { filter: none; opacity: 1; }

/* ═══════════════════════════ Etiqueta de pedido ═══════════════════════════ */
.orders { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.slip {
  position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); overflow: hidden;
  background: var(--slip); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow);
  animation: rise .3s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.slip.selected { outline: 2px solid var(--ink); outline-offset: 3px; }
.slip.cancelled { opacity: .55; }
.stage-to_order { --tone: var(--alert); --tone-fg: var(--on-alert); }
.stage-to_track { --tone: var(--blue); --tone-fg: #fff; }
.stage-done { --tone: var(--green); --tone-fg: var(--on-green); }
.slip-band { display: flex; align-items: center; justify-content: center; background: var(--tone); color: var(--tone-fg); }
.slip-band span {
  writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
  font: 600 10.5px var(--f-mono); letter-spacing: .24em; text-transform: uppercase;
}
.slip-body { min-width: 0; }

.slip-head { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; }
.slip-head > .fieldbox { padding: 14px 18px 15px; border-left: 1px solid var(--rule); min-width: 0; display: grid; align-content: start; gap: 5px; }
.slip-head > .fieldbox:first-child { border-left: 0; }
.id-top { display: flex; align-items: center; gap: 10px; }
.slip-no {
  font: 600 27px/1 var(--f-mono); letter-spacing: -.03em; color: var(--ink);
}
a.slip-no:hover { color: var(--accent-ink); text-decoration: none; }
.barcode { display: block; width: 104px; height: 15px; color: var(--ink); opacity: .85; margin-top: 3px; }
.slip-date { font: 400 12px var(--f-mono); color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.aging {
  font: 600 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 2px; color: var(--alert-ink); box-shadow: inset 0 0 0 1px currentColor;
}
.aging.late { background: var(--alert); color: var(--on-alert); box-shadow: none; }
.to-name { font: 700 16.5px/1.2 var(--f-sans); overflow-wrap: anywhere; }
.to-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.name-edit { width: 28px; height: 28px; opacity: .45; transition: opacity .15s; }
.name-edit .ic { width: 15px; height: 15px; }
.slip:hover .name-edit, .name-edit:focus-visible { opacity: 1; }
/* Compra no fornecedor */
.purchase {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  padding: 10px 18px; border-bottom: 1px solid var(--rule);
}
.purchase-item { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.purchase-item > .ic { width: 15px; height: 15px; color: var(--muted); }
.purchase-item b { font: 600 13.5px var(--f-sans); }
.purchase-item b small { font: 500 11.5px var(--f-mono); color: var(--muted); }
.purchase-item.missing b { font: 500 12px var(--f-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--alert-ink); }
.purchase-item.margin.pos b { color: var(--green); }
.purchase-item.margin.neg b { color: var(--red); }
.purchase-edit { margin-left: auto; }
.results-bar strong.pos { color: var(--green); }
.results-bar strong.neg { color: var(--red); }
.new-profile { display: flex; gap: 8px; margin-top: 8px; }
.new-profile[hidden] { display: none; }
.money-input { position: relative; display: block; }
.money-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font: 600 14px var(--f-mono); color: var(--muted); pointer-events: none; }
.money-input input { padding-left: 40px; font: 600 18px var(--f-mono); height: 48px; }
.margin-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 3px;
  background: var(--green-soft); border: 1px dashed color-mix(in srgb, var(--green) 50%, transparent);
}
.margin-box[hidden] { display: none; }
.margin-box strong { font: 700 18px var(--f-mono); color: var(--green); }
.margin-box.neg { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.margin-box.neg strong { color: var(--red); }
.field[hidden] { display: none; }

/* Compra separada por produto */
#purchase-dialog { width: min(780px, calc(100vw - 32px)); }
.single-fields { display: grid; gap: 18px; }
.single-fields[hidden], .split-items[hidden], .split-toggle[hidden] { display: none; }
.split-items { display: grid; border: 1px solid var(--rule-2); border-radius: 3px; background: var(--field); }
.split-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 200px 140px; gap: 12px; align-items: center;
  padding: 10px 12px; border-top: 1px dashed var(--rule-2);
}
.split-row:first-child { border-top: 0; }
.split-row .thumb { width: 44px; height: 44px; }
.split-info { min-width: 0; display: grid; gap: 3px; }
.split-title { font: 650 13.5px/1.25 var(--f-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-info .line-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.split-row select, .split-row input { height: 40px; font-size: 13px; }
.split-row .money-input input { font-size: 15px; height: 40px; }
.line-purchase {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; width: max-content; max-width: 100%;
  margin-top: 2px; padding: 3px 8px; border-radius: 2px; background: var(--slip-2); box-shadow: inset 0 0 0 1px var(--rule);
  font: 500 11.5px var(--f-mono); color: var(--ink-2);
}
.line-purchase .ic { width: 13px; height: 13px; color: var(--muted); }
.line-purchase b { font-weight: 600; color: var(--ink); }
.line-purchase b.miss { color: var(--alert-ink); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.line-purchase .sep { opacity: .5; }
.split-badge b { font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--blue); }
.split-badge > .ic { color: var(--blue); }
@media (max-width: 640px) {
  .split-row { grid-template-columns: 40px minmax(0, 1fr); }
  .split-row .split-profile, .split-row .split-cost { grid-column: 1 / -1; }
}

.name-loading { display: flex; align-items: center; gap: 10px; padding: 18px 0; font: 500 12px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.name-loading[hidden] { display: none; }
.name-fields { display: grid; gap: 16px; }
.name-preview {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 3px;
  background: var(--slip-2); border: 1px dashed var(--rule-2);
}
.name-preview strong { font: 700 18px/1.2 var(--f-sans); }
.to-loc { color: var(--ink-2); font-size: 13px; }
.fieldbox.total { justify-items: end; text-align: right; }
.total-v { font: 800 23px/1 var(--f-sans); font-stretch: 115%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin-top: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 2px; white-space: nowrap;
  font: 500 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule-2);
}
.badge.green { color: var(--green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 55%, transparent); background: var(--green-soft); }
.badge.amber { color: var(--alert-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alert) 50%, transparent); background: var(--alert-soft); }
.badge.red { color: #fff; background: var(--red); box-shadow: none; }
.badge.blue { color: var(--blue); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 50%, transparent); background: var(--blue-soft); }

/* Etapas + carimbo */
.slip-steps {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-height: 66px;
  padding: 12px 18px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--slip-2);
}
.step {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px 0 10px; border-radius: 3px;
  border: 1.5px dashed var(--rule-2); background: transparent; color: var(--muted); cursor: pointer;
  font: 700 12.5px var(--f-sans); font-stretch: 90%; letter-spacing: .06em; text-transform: uppercase;
  transition: transform .08s, box-shadow .08s;
}
.step .box { display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 2px; flex: none; }
.step .box .ic { width: 13px; height: 13px; stroke-width: 3; }
.step small { font: 400 11px var(--f-mono); letter-spacing: 0; text-transform: none; opacity: .8; }
.step:hover { color: var(--ink); border-color: var(--ink-2); }
.step.next {
  border: 1.5px solid var(--ink); background: var(--field); color: var(--ink); box-shadow: 3px 3px 0 var(--tone);
}
.step.next:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--tone); }
.step.next:active { transform: translate(2px, 2px); box-shadow: none; }
.step.done { border: 1.5px solid transparent; color: var(--ink-2); }
.step.done .box { background: var(--ink); border-color: var(--ink); color: var(--slip); }
.step.done:hover { border-color: var(--rule-2); border-style: dashed; }
.step-arrow { color: var(--rule-2); font: 400 16px var(--f-mono); }

.slip-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 3px 0 8px; border-radius: 2px;
  font: 500 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag) 55%, transparent);
}
.tag.solo { padding-right: 8px; }
.tag button { display: grid; place-items: center; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 2px; background: transparent; color: inherit; cursor: pointer; }
.tag button:hover { background: var(--tag); color: #fff; }
.tag button .ic { width: 11px; height: 11px; }
select.tag-add {
  width: auto; height: 26px; padding: 0 24px 0 8px; border-radius: 2px; border-style: dashed;
  font: 500 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  background-color: transparent; background-position: right 7px center; background-size: 11px;
}

.stamp {
  margin-left: auto; display: inline-grid; justify-items: center; gap: 1px; padding: 5px 12px 4px;
  color: var(--tone); border: 2.5px solid currentColor; border-radius: 3px;
  outline: 1px solid currentColor; outline-offset: 2px;
  font: 900 15px/1 var(--f-sans); font-stretch: 125%; letter-spacing: .1em; text-transform: uppercase;
  transform: rotate(-6deg); mix-blend-mode: var(--stamp-blend); opacity: .88;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp small { font: 600 9.5px var(--f-mono); letter-spacing: .12em; }

/* Itens */
.lines { list-style: none; margin: 0; padding: 2px 18px; }
.line {
  display: grid; grid-template-columns: 20px 58px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 13px 0; border-top: 1px dashed var(--rule-2);
}
.line:first-child { border-top: 0; }
.line.removed { opacity: .4; }
.line.removed .line-title { text-decoration: line-through; }
.line-no { font: 500 11px var(--f-mono); color: var(--muted); }
.thumb {
  display: block; width: 58px; height: 58px; object-fit: cover; border-radius: 2px;
  background: var(--slip-2); border: 1px solid var(--rule-2);
}
.line-info { min-width: 0; display: grid; gap: 4px; }
.line-title { font: 650 15px/1.25 var(--f-sans); overflow-wrap: anywhere; }
.line-meta { font: 400 11.5px var(--f-mono); letter-spacing: .03em; color: var(--muted); text-transform: uppercase; }
.line-meta .sep { margin: 0 6px; opacity: .6; }
.line-note { display: flex; align-items: center; gap: 6px; font: 500 12px var(--f-sans); color: var(--alert-ink); }
.line-note .ic { width: 13px; height: 13px; }
.qty {
  display: grid; place-items: center; min-width: 42px; height: 30px; padding: 0 8px; border-radius: 2px;
  font: 600 14px var(--f-mono); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule-2);
}
.qty.multi { background: var(--alert); color: var(--on-alert); box-shadow: none; }
.line-actions { display: flex; align-items: center; gap: 4px; }
.btn-supplier {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 13px 0 6px; border-radius: 3px;
  border: 1.5px solid var(--ink); background: var(--field); color: var(--ink); white-space: nowrap;
  font: 700 12px/1 var(--f-sans); font-stretch: 90%; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--pf); transition: transform .08s, box-shadow .08s;
}
.btn-supplier:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--pf); text-decoration: none; }
.btn-supplier:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-supplier > .ic { width: 14px; height: 14px; color: var(--muted); }
.btn-link-missing {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; border-radius: 3px; cursor: pointer;
  border: 1.5px dashed var(--alert); background: var(--alert-soft); color: var(--alert-ink);
  font: 700 12px/1 var(--f-sans); font-stretch: 90%; letter-spacing: .06em; text-transform: uppercase;
}
.btn-link-missing:hover { border-style: solid; }
.btn-link-missing .ic { width: 14px; height: 14px; }

/* Picote */
.tear { position: relative; height: 0; margin: 4px 0 0; border-top: 2px dashed var(--rule-2); }
.tear::before, .tear::after {
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-2);
}
.tear::before { left: -11px; }
.tear::after { right: -11px; }

.slip-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.foot { display: grid; gap: 8px; align-content: start; padding: 14px 18px 16px; min-width: 0; }
.foot + .foot { border-left: 1px solid var(--rule); }
.foot-title { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.foot-title .btn { margin-left: auto; height: 26px; padding: 0 9px; font-size: 10.5px; box-shadow: 2px 2px 0 var(--ink); }
.address { white-space: pre-line; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.notes-area {
  width: 100%; min-height: 76px; padding: 0 2px; border: 0; border-radius: 0; resize: vertical;
  font: 400 13px/24px var(--f-mono); color: var(--ink);
  background: repeating-linear-gradient(to bottom, transparent 0 23px, var(--rule-2) 23px 24px);
  background-attachment: local;
}
.notes-area:hover { border: 0; }
.notes-area:focus { box-shadow: none; background-color: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.tracking-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ═══════════════════════════ Produtos (livro-razão) ═══════════════════════════ */
.ledger { background: var(--slip); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow); }
.lrow {
  display: grid; grid-template-columns: 28px 54px minmax(200px, 1fr) minmax(330px, 1.25fr) auto;
  gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--rule);
}
.lrow:first-child { border-top: 0; }
.lrow:hover { background: var(--slip-2); }
.lrow .thumb { width: 54px; height: 54px; }
.l-info { min-width: 0; display: grid; gap: 5px; }
.l-supplier { display: grid; gap: 8px; min-width: 0; }
.url-cell { display: flex; align-items: center; gap: 8px; }
.url-cell .input-icon { flex: 1; }
.url-cell input { height: 36px; font: 400 12.5px var(--f-mono); }
.url-cell .btn-supplier { height: 36px; padding: 0 10px; box-shadow: 2px 2px 0 var(--pf); }
.saved-flash { animation: flash 1.4s ease; }
@keyframes flash { 0% { box-shadow: 2px 2px 0 var(--green); border-color: var(--green); } 100% { box-shadow: none; } }

/* ═══════════════════════════ Ajustes ═══════════════════════════ */
.settings { display: grid; gap: 18px; }
.panel { background: var(--slip); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--rule); }
.panel-no { font: 500 12px var(--f-mono); color: var(--accent-ink); }
.panel-head h2 { margin: 0; font: 800 18px/1.1 var(--f-sans); font-stretch: 115%; text-transform: uppercase; letter-spacing: .01em; }
.panel-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.panel-body { padding: 20px 22px 22px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.result { display: grid; gap: 8px; margin-top: 16px; padding: 12px 14px; border-radius: 2px; font-size: 13px; border-left: 4px solid; }
.result.ok { background: var(--green-soft); color: var(--green); }
.result.err { background: var(--red-soft); color: var(--red); }
.result.warn { background: var(--alert-soft); color: var(--alert-ink); }
.result.info { background: var(--slip-2); color: var(--ink-2); }
.result span { display: inline-flex; align-items: center; gap: 8px; }
.scope-list { display: flex; flex-wrap: wrap; gap: 5px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--rule-2); border-radius: 3px; background: var(--field); cursor: pointer; }
.switch-row span { display: grid; gap: 2px; }
.switch-row b { font-weight: 700; }
.switch-row small { color: var(--muted); font-size: 12px; }
.tag-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--rule-2); }
.tag-row:first-child { border-top: 0; }
input[type=color] { width: 34px; height: 34px; padding: 3px; border: 1px solid var(--rule-2); border-radius: 3px; background: var(--field); cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 1px; }
.tag-new { display: flex; gap: 10px; margin-top: 14px; }
code { font: 500 .92em var(--f-mono); padding: 1px 5px; border-radius: 2px; background: var(--slip-2); box-shadow: inset 0 0 0 1px var(--rule); }
.guide { margin: 0 0 20px; padding-left: 22px; display: grid; gap: 9px; color: var(--ink-2); line-height: 1.5; }
.guide li::marker { font: 600 12px var(--f-mono); color: var(--accent-ink); }
.db-change { margin-top: 14px; }
.db-change summary {
  cursor: pointer; width: max-content; padding: 4px 0; list-style: none;
  font: 500 11.5px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.db-change summary::-webkit-details-marker { display: none; }
.db-change[open] summary { margin-bottom: 14px; }
.tag-new input[type=text] { max-width: 280px; }

/* ═══════════════════════════ Estados ═══════════════════════════ */
.empty {
  display: grid; justify-items: center; gap: 8px; padding: 60px 20px; text-align: center;
  border: 1.5px dashed var(--rule-2); border-radius: var(--r); color: var(--ink-2);
}
.empty-icon {
  display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 8px; border-radius: 2px;
  background: var(--ink); color: var(--slip); transform: rotate(-5deg); box-shadow: 4px 4px 0 var(--accent);
}
.empty-icon .ic { width: 26px; height: 26px; }
.empty h3 { margin: 0; font: 900 22px/1.05 var(--f-sans); font-stretch: 125%; text-transform: uppercase; color: var(--ink); }
.empty p { margin: 0 0 10px; max-width: 420px; }

.skeleton { height: 230px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--slip); position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--slip-2), transparent); animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 24px; font: 500 12px var(--f-mono); letter-spacing: .08em; color: var(--muted); }
.spinner { display: inline-block; width: 13px; height: 13px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.warn-banner { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }

/* ═══════════════════════════ Barra em massa ═══════════════════════════ */
.bulkbar {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translateX(calc(-50% + 125px));
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100vw - 290px); padding: 10px 10px 10px 16px; border-radius: 3px;
  background: var(--rail); color: var(--rail-text); box-shadow: 6px 6px 0 var(--accent);
  animation: pop .2s ease both;
}
@keyframes pop { from { opacity: 0; } }
.bulkbar strong { margin-right: 8px; font: 600 12px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; }
.bulkbar .btn { background: transparent; border-color: var(--rail-rule); color: var(--rail-text); box-shadow: none; }
.bulkbar .btn:hover { background: var(--rail-2); transform: none; }
.bulkbar .btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bulkbar .btn-accent:hover { background: var(--accent); filter: brightness(1.08); }

/* ═══════════════════════════ Diálogo ═══════════════════════════ */
.dialog {
  width: min(600px, calc(100vw - 32px)); padding: 0; border: 1.5px solid var(--ink); border-radius: var(--r);
  background: var(--slip); color: var(--ink); box-shadow: 10px 10px 0 var(--ink);
}
.dialog[open] { animation: dlg .18s ease both; }
@keyframes dlg { from { opacity: 0; transform: translate(4px, 6px); } }
.dialog::backdrop { background: rgba(17, 16, 14, .6); }
.dialog form { display: grid; }
.dialog-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; background: var(--rail); color: var(--rail-text); }
.dialog-head .kicker { color: var(--accent); }
.dialog-head .icon-btn { color: var(--rail-muted); }
.dialog-head .icon-btn:hover { background: var(--rail-2); color: var(--rail-text); }
.dialog-title { flex: 1; min-width: 0; display: grid; gap: 6px; }
.dialog-title h2 { margin: 0; font: 800 19px/1.2 var(--f-sans); font-stretch: 110%; overflow-wrap: anywhere; }
.dialog-body { display: grid; gap: 18px; padding: 20px; }
.hint { display: flex; align-items: center; gap: 8px; margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.hint .ic { width: 15px; height: 15px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 20px 18px; border-top: 2px dashed var(--rule-2); }

/* ═══════════════════════════ Avisos ═══════════════════════════ */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 10px; justify-items: end; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 290px; max-width: min(460px, calc(100vw - 32px));
  padding: 11px 11px 11px 14px; border-radius: 2px; border-left: 5px solid var(--accent);
  background: var(--rail); color: var(--rail-text); box-shadow: 5px 5px 0 rgba(0, 0, 0, .22);
  font: 500 12.5px/1.4 var(--f-mono); animation: toast-in .22s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }
.toast > .ic { width: 16px; height: 16px; color: var(--accent); }
.toast.err { border-left-color: var(--red); }
.toast.err > .ic { color: var(--red); }
.toast button {
  margin-left: auto; height: 28px; padding: 0 11px; border: 1px solid var(--rail-rule); border-radius: 2px; cursor: pointer;
  background: transparent; color: var(--rail-text); font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
}
.toast button:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ═══════════════════════════ Responsivo ═══════════════════════════ */
@media (max-width: 1100px) {
  .lrow { grid-template-columns: 28px 54px minmax(0, 1fr) auto; }
  .lrow .l-supplier { grid-column: 3 / -1; grid-row: 2; }
  .slip-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fieldbox.total { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); grid-auto-flow: column; justify-content: space-between; align-items: center; padding-top: 10px; padding-bottom: 10px; }
  .fieldbox.total .kicker { display: none; }
  .fieldbox.total .badges { margin: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky; z-index: 30; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 12px 14px; padding: 12px 16px 0;
  }
  .brand-logo { width: 120px; }
  .brand-sub { display: none; }
  .nav { order: 3; width: calc(100% + 32px); margin: 0 -16px; display: flex; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--rail-rule); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav a:last-child { border: 0; padding: 12px 16px; font-size: 15px; white-space: nowrap; }
  .nav a.active::before { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 3px; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .ticket { display: block; padding: 0; border: 0; background: none; }
  .ticket::before, .ticket::after, .ticket-row { display: none; }
  .ticket .btn { width: auto; height: 34px; }
  .theme-toggle span { display: none; }
  .main { padding: 24px 16px 140px; }
  .bulkbar { transform: translateX(-50%); max-width: calc(100vw - 24px); bottom: 12px; }
}
@media (max-width: 640px) {
  .page-head { padding-bottom: 16px; }
  .page-aside { display: none; }
  .ticket .btn { width: 38px; padding: 0; }
  .ticket .btn span { display: none; }
  .ticket .btn .spinner { display: inline-block; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell { min-height: 96px; padding: 12px 14px; }
  .cell:nth-child(3) { border-left: 0; }
  .cell:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .cell-n { font-size: 36px; }
  .filters-row .select, .filters-row .select.wide, .date-extra input { flex: 1 1 140px; min-width: 0; width: auto; }
  .filters-row .search { flex-basis: 100%; }
  .slip { grid-template-columns: 22px minmax(0, 1fr); }
  .slip-band span { font-size: 9px; letter-spacing: .18em; }
  .slip-head { grid-template-columns: minmax(0, 1fr); }
  .slip-head > .fieldbox { border-left: 0; border-top: 1px solid var(--rule); padding: 12px 14px; }
  .slip-head > .fieldbox:first-child { border-top: 0; }
  .slip-steps { padding: 12px 14px; }
  .step-arrow { display: none; }
  .stamp { margin-left: 0; }
  .lines { padding: 2px 14px; }
  .line { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; }
  .line-no { display: none; }
  .thumb { width: 50px; height: 50px; }
  .line-actions { grid-column: 1 / -1; }
  .line-actions .btn-supplier, .line-actions .btn-link-missing { flex: 1; justify-content: center; }
  .slip-foot { grid-template-columns: minmax(0, 1fr); }
  .foot + .foot { border-left: 0; border-top: 1px solid var(--rule); }
  .lrow { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 12px 14px; gap: 12px; }
  .lrow .l-no { display: none; }
  .lrow .l-supplier { grid-column: 1 / -1; }
  .lrow .thumb { width: 48px; height: 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .platform-picker { grid-template-columns: repeat(2, 1fr); }
  .toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
}
