/* ==========================================================================
   Etiquetas JLF — mesmo design system do appvendas (JLF Vendas):
   tokens semânticos, tema claro/escuro, base 4/8, alvos de toque de 44px.
   ========================================================================== */
:root {
  --font-ui: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'Nunito', 'Fira Sans', system-ui, sans-serif;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --tap: 44px; --rail: 232px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 150ms; --t-med: 250ms;

  color-scheme: light;
  --bg: #f4f7fb; --surface: #ffffff; --surface-2: #eef2f8;
  --border: #d8e0ec; --border-strong: #b9c5d9;
  --text: #0f1b3d; --text-2: #3b4a6b; --muted-text: #55658a;
  --primary-500: #1d4ed8; --primary-hover: #1e40af; --on-primary: #ffffff; --primary-soft: #e3eafd;
  --success: #047857; --success-soft: #dcf5ea;
  --warning: #b45309; --warning-soft: #fdf0d8;
  --danger: #b91c1c;  --danger-soft: #fde4e4;
  --overlay: rgba(15, 27, 61, 0.45);
  --shadow: 0 1px 2px rgba(15, 27, 61, 0.06), 0 4px 16px -6px rgba(15, 27, 61, 0.12);
  --shadow-lg: 0 24px 60px -12px rgba(15, 27, 61, 0.35);
  --focus: #1d4ed8;
  --papel: #ffffff; --tinta: #000000; /* a etiqueta é sempre branca com tinta preta, em qualquer tema */
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a1020; --surface: #121a2f; --surface-2: #1a2440;
  --border: #2a3658; --border-strong: #3d4c78;
  --text: #eaf0ff; --text-2: #b7c3e0; --muted-text: #94a3c7;
  --primary-500: #7aa5ff; --primary-hover: #9bbcff; --on-primary: #0a1020; --primary-soft: #1b2b57;
  --success: #34d399; --success-soft: #11382f;
  --warning: #fbbf24; --warning-soft: #3d3010;
  --danger: #fb7185;  --danger-soft: #431a27;
  --overlay: rgba(2, 6, 18, 0.65);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  --focus: #9bbcff;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { cursor: pointer; font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--muted-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estrutura: menu lateral no desktop, inferior no celular ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 60px; padding: var(--s-2) var(--s-4); padding-top: calc(var(--s-2) + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--s-3); font-weight: 700; font-size: 1.0625rem; }
.brand-mark { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--primary-500); color: var(--on-primary); display: grid; place-items: center; }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); }
.user-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary-500); border: 1px solid var(--border); font-size: 0.8125rem; font-weight: 700; }
.nav {
  position: fixed; z-index: 30; bottom: 0; left: 0; width: 100%; height: calc(68px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: stretch;
}
.nav-item {
  position: relative; flex: 1; min-height: var(--tap); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; font-size: 0.75rem; font-weight: 600; color: var(--muted-text); transition: color var(--t-fast) var(--ease);
}
.nav-item:hover { color: var(--text); }
.nav-item[aria-current='page'] { color: var(--primary-500); }
.nav-item[aria-current='page']::before { content: ''; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; transform: translateX(-50%); border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--primary-500); }
.nav-item svg { width: 22px; height: 22px; }
.conteudo { flex: 1; padding: var(--s-4) var(--s-4) calc(84px + env(safe-area-inset-bottom, 0px)); }
.pagina { width: 100%; max-width: 1680px; margin: 0 auto; display: grid; gap: var(--s-4); }
.rail-brand { display: none; }

@media (min-width: 1024px) {
  .app { padding-left: var(--rail); }
  .nav { top: 0; bottom: 0; width: var(--rail); height: auto; padding: var(--s-5) var(--s-3); flex-direction: column; justify-content: flex-start; align-items: stretch; gap: var(--s-1); border-top: 0; border-right: 1px solid var(--border); background: var(--surface); backdrop-filter: none; }
  .rail-brand { display: flex; margin: 0 var(--s-3) var(--s-6); }
  .topbar .brand { display: none; }
  .topbar { justify-content: flex-end; }
  .nav-item { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: var(--s-3); min-height: 48px; padding: 0 var(--s-4); border-radius: var(--r-md); font-size: 0.9375rem; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item[aria-current='page'] { background: var(--primary-soft); }
  .nav-item[aria-current='page']::before { top: 50%; left: 0; width: 3px; height: 24px; transform: translateY(-50%); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
  .conteudo { padding: var(--s-6); }
}

/* ---------- Cartões, botões, campos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--s-4); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.card-head h2 { font-size: 1rem; display: flex; align-items: center; gap: var(--s-2); }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-text); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-4);
  background: var(--primary-500); color: var(--on-primary); border: 1px solid transparent; border-radius: var(--r-md); font-weight: 600; font-size: 0.9375rem;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn { white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--primary-hover); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-2 { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-2:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger); filter: brightness(0.92); }
:root[data-theme='dark'] .btn-danger { color: #1a0710; }
.btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: 0.875rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--r-md); color: var(--text-2); background: none; border: 0; transition: background-color var(--t-fast) var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.lbl { display: block; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-2); margin-bottom: 6px; }
.input, .select {
  width: 100%; min-height: var(--tap); padding: 10px var(--s-3); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  color: var(--text); font: inherit; font-size: 1rem; outline: none; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder { color: var(--muted-text); opacity: 1; }
.input:focus, .select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input.sm, .select.sm { min-height: 36px; padding: 6px var(--s-2); font-size: 0.875rem; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.campo { display: grid; gap: 0; min-width: 0; }
.grade-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.erro { color: var(--danger); font-size: 0.875rem; font-weight: 600; min-height: 1.3em; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; font-size: 0.75rem; font-weight: 700; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.badge-warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge-bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge-acc { background: var(--primary-soft); color: var(--primary-500); border-color: color-mix(in srgb, var(--primary-500) 35%, transparent); }

/* Controle segmentado (tipo de busca, rotação...) */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg button { min-height: 36px; padding: 0 var(--s-3); background: none; border: 0; border-radius: var(--r-sm); font-weight: 600; font-size: 0.875rem; color: var(--text-2); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--primary-500); box-shadow: var(--shadow); }
/* Interruptor */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 40px; font-weight: 500; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .trilho { position: relative; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--border-strong); transition: background-color var(--t-fast) var(--ease); flex: none; }
.switch .trilho::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--t-fast) var(--ease); }
.switch input:checked + .trilho { background: var(--primary-500); }
.switch input:checked + .trilho::after { transform: translateX(18px); }
.switch input:focus-visible + .trilho { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Quantidade */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.qty button { background: none; border: 0; min-width: 36px; min-height: 36px; display: grid; place-items: center; transition: background-color var(--t-fast) var(--ease); }
.qty button:hover { background: var(--surface-2); }
.qty input { width: 56px; min-height: 36px; border: 0; border-inline: 1px solid var(--border); text-align: center; background: var(--surface); color: var(--text); font: 700 0.9375rem var(--font-num); -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus-visible { outline-offset: -2px; }

/* ---------- Foto de produto ---------- */
.foto { position: relative; width: 56px; height: 56px; flex: none; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; color: var(--muted-text); }
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto.grande { width: 88px; height: 88px; }
.foto.mini { width: 40px; height: 40px; }
.foto.zoom { cursor: zoom-in; }

/* ---------- Buscar e resultados ---------- */
.busca-linha { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.busca-campo { position: relative; flex: 1 1 280px; }
.busca-campo svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-text); pointer-events: none; }
.busca-campo .input { padding-left: 42px; }
.resultados { display: grid; gap: var(--s-3); grid-template-columns: minmax(0, 1fr); margin-top: var(--s-3); }
@media (min-width: 720px) { .resultados { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.produto { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); padding: var(--s-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--t-fast) var(--ease); }
.produto:hover { border-color: var(--border-strong); }
.produto.na-fila { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.produto-info { min-width: 0; display: grid; gap: 2px; align-content: start; }
.produto-nome { font-weight: 600; font-size: 0.9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.produto-meta { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); font-size: 0.8125rem; color: var(--muted-text); }
.produto-meta b { color: var(--text-2); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.produto-acoes { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.preco { font: 800 1.125rem var(--font-num); font-variant-numeric: tabular-nums; }
.vazio { padding: var(--s-6) var(--s-4); text-align: center; color: var(--muted-text); display: grid; gap: var(--s-2); justify-items: center; }
.skeleton { border-radius: var(--r-md); min-height: 96px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Layout da página Etiquetas ---------- */
.etq { display: grid; gap: var(--s-4); align-items: start; }
.etq-esq { display: grid; gap: var(--s-4); min-width: 0; }
.etq-dir { display: grid; gap: var(--s-4); min-width: 0; }
@media (min-width: 1180px) { .etq { grid-template-columns: minmax(0, 1fr) 380px; } .etq-dir { position: sticky; top: 76px; } }

/* ---------- Grade (tabela) da fila ---------- */
.tabela-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
table.grade { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.grade th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-2); padding: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grade th button { width: 100%; display: flex; align-items: center; gap: 4px; padding: 10px var(--s-3); background: none; border: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; text-align: left; }
.grade th.d { text-align: right; } .grade th.d button { justify-content: flex-end; }
.grade th button:hover { color: var(--text); }
.grade td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.grade tbody tr:last-child td { border-bottom: 0; }
.grade tbody tr:hover { background: var(--surface-2); }
.grade td.d { text-align: right; }
.grade .nome-cel { min-width: 220px; max-width: 420px; overflow-wrap: anywhere; font-weight: 600; }
.grade .nome-cel small { display: block; font-weight: 400; color: var(--muted-text); }
.grade tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.tabela-barra { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.totais { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- Painel de impressão e prévia da bobina ---------- */
.opcoes { display: grid; gap: var(--s-1); }
.opcoes hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-2) 0; width: 100%; }
.bobina { display: grid; gap: var(--s-2); max-height: 420px; overflow: auto; padding: var(--s-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.bobina-linha { display: flex; gap: 3px; width: max-content; padding: 3px; background: color-mix(in srgb, var(--border-strong) 55%, var(--surface-2)); border-radius: 4px; }
.etq-prev.repetida { opacity: 0.55; outline: 2px dashed var(--warning); outline-offset: -2px; }

/* A etiqueta desenhada na tela (prévia e editor): sempre papel branco e tinta preta */
.etq-prev { position: relative; flex: none; background: var(--papel); color: var(--tinta); overflow: hidden; font-family: Helvetica, Arial, 'Liberation Sans', sans-serif; }
.etq-prev .el { position: absolute; overflow: hidden; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.etq-prev .el.barras { line-height: 1; }
.etq-prev .el.barras svg { display: block; width: 100%; }
.etq-prev .el.barras .num-cb { text-align: center; line-height: 1.1; }

/* ---------- Editor de modelos ---------- */
.ed { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 1100px) { .ed { grid-template-columns: 260px minmax(0, 1fr) 320px; } }
.lista-modelos { display: grid; gap: var(--s-2); }
.modelo-item { display: grid; gap: 2px; text-align: left; padding: var(--s-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.modelo-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.modelo-item[aria-current='true'] { border-color: var(--primary-500); background: var(--primary-soft); }
.modelo-item b { font-size: 0.9375rem; }
.modelo-item span { font-size: 0.8125rem; color: var(--muted-text); }
.palco-barra { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.palco-barra .grow { flex: 1; }
.palco { overflow: auto; padding: var(--s-6); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  background-image: radial-gradient(color-mix(in srgb, var(--border-strong) 70%, transparent) 1px, transparent 1px); background-size: 16px 16px; display: grid; place-items: center; min-height: 320px; }
.palco-etq { position: relative; box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-lg); touch-action: none; user-select: none; }
.palco-etq .guia { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(29,78,216,.10) 1px, transparent 1px), linear-gradient(to bottom, rgba(29,78,216,.10) 1px, transparent 1px); }
.palco-etq .el { cursor: grab; outline: 1px dashed rgba(29,78,216,.45); outline-offset: -1px; }
.palco-etq .el.escondido { opacity: 0.25; }
.palco-etq .el.sel { outline: 2px solid var(--primary-500); outline-offset: -1px; z-index: 2; }
.palco-etq .el.arrastando { cursor: grabbing; }
.moldura { position: absolute; z-index: 4; pointer-events: none; }
.moldura .alca { pointer-events: auto; }
.alca { position: absolute; width: 12px; height: 12px; background: var(--primary-500); border: 2px solid #fff; border-radius: 3px; z-index: 3; touch-action: none; }
.alca.d { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.alca.b { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.alca.db { right: -6px; bottom: -6px; cursor: nwse-resize; }
.camadas { display: grid; gap: 4px; }
.camada { display: flex; align-items: center; gap: var(--s-2); padding: 4px var(--s-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.camada[aria-current='true'] { border-color: var(--primary-500); background: var(--primary-soft); }
.camada button.nome { flex: 1; text-align: left; background: none; border: 0; min-height: 32px; font-weight: 600; font-size: 0.875rem; }
.add-comp { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.inspetor { display: grid; gap: var(--s-3); }
.inspetor h3 { font-size: 0.9375rem; }
.inspetor .grade-campos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stepper { display: flex; align-items: stretch; gap: 4px; }
.stepper .input { text-align: center; min-width: 0; }

/* ---------- Modal e toast ---------- */
.modal-fundo { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--s-4); background: var(--overlay); backdrop-filter: blur(4px); animation: fade var(--t-med) var(--ease); }
.modal { width: 100%; max-width: 520px; max-height: 90dvh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-lg); animation: rise-in 300ms var(--ease) both; display: grid; gap: var(--s-4); }
.modal.largo { max-width: 1100px; }
.modal-topo { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.modal-acoes { display: flex; justify-content: flex-end; gap: var(--s-2); flex-wrap: wrap; }
.pdf-frame { width: 100%; height: 62dvh; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.toasts { position: fixed; z-index: 150; top: calc(var(--s-4) + env(safe-area-inset-top, 0px)); left: 0; right: 0; display: grid; justify-items: center; gap: var(--s-2); pointer-events: none; padding: 0 var(--s-4); }
.toast { pointer-events: auto; width: 100%; max-width: 460px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary-500); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: 0.9375rem; font-weight: 600; animation: rise-in 250ms var(--ease) both; }
.toast.ok { border-left-color: var(--success); } .toast.erro { border-left-color: var(--danger); } .toast.aviso { border-left-color: var(--warning); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-4); }
.login-card { width: 100%; max-width: 400px; padding: var(--s-8) var(--s-6); display: grid; gap: var(--s-5); animation: rise-in 500ms var(--ease) both; }
.login-brand { display: grid; gap: var(--s-2); justify-items: center; text-align: center; }
.login-brand .brand-mark { width: 52px; height: 52px; }
.login-brand h1 { font-size: 1.5rem; }
.spin { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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