/* =====================================================================
   LLog Manager — estilos (responsivo, claro/escuro)
   ===================================================================== */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e7ee;
  --line-strong: #cbd3de;
  --text: #15202e;
  --text-2: #4a5768;
  --muted: #6b7889;
  --ink: #0b1620;          /* sidebar */
  --ink-2: #13222f;
  --ink-text: #c9d4df;
  --brand: #0f766e;        /* teal */
  --brand-strong: #0b5f58;
  --brand-soft: #e3f4f2;
  --accent: #f59e0b;       /* âmbar: ação principal */
  --accent-strong: #d97706;
  --accent-text: #1c1300;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --warn: #c2410c;
  --focus: #2563eb;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sidebar-w: 248px;

  /* Cores de status */
  --st-cinza-bg: #eef1f4;   --st-cinza-fg: #475467;   --st-cinza: #98a2b3;
  --st-amarelo-bg: #fef6db; --st-amarelo-fg: #8a5a00; --st-amarelo: #eab308;
  --st-azul-bg: #e5efff;    --st-azul-fg: #1d4ed8;    --st-azul: #3b82f6;
  --st-laranja-bg: #ffedde; --st-laranja-fg: #b54708; --st-laranja: #f97316;
  --st-verde-bg: #e3f6ea;   --st-verde-fg: #157f3d;   --st-verde: #22a35a;
  --st-verde-claro-bg: #ecfbe9; --st-verde-claro-fg: #3f7d1c; --st-verde-claro: #84cc16;
  --st-vermelho-bg: #fdeaea; --st-vermelho-fg: #b42318; --st-vermelho: #ef4444;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141c;
    --surface: #141e29;
    --surface-2: #18242f;
    --line: #243241;
    --line-strong: #33465a;
    --text: #e6edf3;
    --text-2: #b4c0cc;
    --muted: #8a99a8;
    --ink: #08111a;
    --ink-2: #0f1c27;
    --brand: #2bb3a6;
    --brand-strong: #46c7bb;
    --brand-soft: #12302e;
    --danger-soft: #3a1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --st-cinza-bg: #232e3a;   --st-cinza-fg: #b6c1cc;
    --st-amarelo-bg: #3a2f0c; --st-amarelo-fg: #fcd34d;
    --st-azul-bg: #142b4d;    --st-azul-fg: #93c5fd;
    --st-laranja-bg: #3f220f; --st-laranja-fg: #fdba74;
    --st-verde-bg: #11331f;   --st-verde-fg: #86efac;
    --st-verde-claro-bg: #22330f; --st-verde-claro-fg: #bef264;
    --st-vermelho-bg: #3d1515; --st-vermelho-fg: #fca5a5;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: inline-block; vertical-align: middle; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
.h2 { font-size: 1.3rem; } .h3 { font-size: 1.12rem; } .h4 { font-size: .95rem; margin: .25rem 0 .5rem; color: var(--text-2); }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Utilitários */
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.mono { font-family: var(--mono); font-size: .93em; letter-spacing: .01em; }
h1.mono { font-size: 1.45rem; }
.strong { font-weight: 600; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 1.25rem; }
.stack > * + * { margin-top: .9rem; }
.ico { width: 18px; height: 18px; flex: none; }
.ico-xs { width: 13px; height: 13px; }
[hidden] { display: none !important; }

/* ===================== Shell / sidebar ===================== */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; padding: 14px 12px;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1.08rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 700; }
.sidebar-cta { margin: 0 4px 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px;
  color: var(--ink-text); font-weight: 500; font-size: .94rem;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(43,179,166,.16); color: #fff; box-shadow: inset 3px 0 0 #2bb3a6; }
.nav a .ico { opacity: .85; }
.nav-count {
  margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 700;
  background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.sidebar-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; margin-top: 8px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--ink-text); padding: 4px; border-radius: 8px; }
.me:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.me-txt { display: flex; flex-direction: column; min-width: 0; }
.me-txt strong { color: #fff; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { font-size: .74rem; opacity: .75; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.sidebar .icon-btn { color: var(--ink-text); }
.sidebar .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.quick-search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; color: var(--muted); }
.quick-search input { border: 0; background: transparent; padding: 8px 0; width: 100%; color: var(--text); font: inherit; outline: none; }
.role-chip { margin-left: auto; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); white-space: nowrap; }
.role-master { background: #1f2937; color: #fbbf24; }
.role-gestor { background: var(--st-azul-bg); color: var(--st-azul-fg); }
.role-vendedor { background: var(--st-verde-bg); color: var(--st-verde-fg); }
.role-expedicao { background: var(--st-laranja-bg); color: var(--st-laranja-fg); }
.role-etiqueta { background: var(--st-amarelo-bg); color: var(--st-amarelo-fg); }
td .role-chip { margin-left: 0; }
.net-status { font-size: .75rem; font-weight: 700; background: var(--danger); color: #fff; border-radius: 6px; padding: 3px 8px; }

.content { padding: 24px 28px 40px; flex: 1; width: 100%; max-width: 1440px; }
.foot { padding: 14px 28px 24px; color: var(--muted); font-size: .78rem; }
.icon-btn { background: transparent; border: 0; padding: 7px; border-radius: 8px; cursor: pointer; color: var(--text-2); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.only-mobile { display: none; }
.backdrop { display: none; }

/* ===================== Cabeçalho de página ===================== */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: .25rem 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.head-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ===================== Botões ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 600 .9rem/1.2 var(--font); padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
  min-height: 38px;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn-ghost { background: transparent; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn-warn-ghost:hover { background: var(--st-laranja-bg); }
.btn-sm { padding: 5px 10px; font-size: .8rem; min-height: 30px; }
.btn-lg { padding: 11px 18px; font-size: .95rem; min-height: 44px; }
.btn-block { width: 100%; }

/* ===================== Badges ===================== */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-cinza { background: var(--st-cinza-bg); color: var(--st-cinza-fg); }
.badge-amarelo { background: var(--st-amarelo-bg); color: var(--st-amarelo-fg); }
.badge-azul { background: var(--st-azul-bg); color: var(--st-azul-fg); }
.badge-laranja { background: var(--st-laranja-bg); color: var(--st-laranja-fg); }
.badge-verde { background: var(--st-verde-bg); color: var(--st-verde-fg); }
.badge-verde-claro { background: var(--st-verde-claro-bg); color: var(--st-verde-claro-fg); }
.badge-vermelho { background: var(--st-vermelho-bg); color: var(--st-vermelho-fg); }

/* ===================== Cards / grids ===================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-attention { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.link { font-size: .85rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2, .card + .grid-2 { margin-top: 18px; }
.grid-wide-left { grid-template-columns: 1.6fr 1fr; }
.grid-wide-right { grid-template-columns: 1fr 1.6fr; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.detail-side { position: sticky; top: 70px; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow);
  border-top: 3px solid var(--line-strong); text-decoration: none !important; transition: transform .1s, box-shadow .1s;
}
a.stat:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(16,24,40,.25); }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.stat-hint { font-size: .75rem; color: var(--muted); }
.stat-cinza { border-top-color: var(--st-cinza); }
.stat-amarelo { border-top-color: var(--st-amarelo); }
.stat-azul { border-top-color: var(--st-azul); }
.stat-laranja { border-top-color: var(--st-laranja); }
.stat-verde { border-top-color: var(--st-verde); }
.stat-vermelho { border-top-color: var(--st-vermelho); }
.stat-destaque { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stat-destaque .stat-hint { color: var(--st-laranja-fg); font-weight: 700; }

/* ===================== Formulários ===================== */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.label-strong { font-size: .95rem !important; color: var(--text) !important; letter-spacing: .03em; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand); margin: 0; }
input[type="file"] { padding: 7px; }
.hint { font-size: .76rem; color: var(--muted); }
.field-error { font-size: .78rem; color: var(--danger); font-weight: 600; }
.is-invalid input, .is-invalid select, .is-invalid textarea, input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.check { display: flex; align-items: center; gap: 9px; font-size: .9rem; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.fieldset { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
.fieldset legend { font-weight: 700; font-size: .85rem; padding: 0 6px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 14px; align-items: start; }
.form-grid > * { grid-column: span 12; }
.col-2 { grid-column: span 2 !important; } .col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; }
.col-5 { grid-column: span 5 !important; } .col-6 { grid-column: span 6 !important; } .col-7 { grid-column: span 7 !important; }
.col-8 { grid-column: span 8 !important; } .col-12 { grid-column: span 12 !important; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.form-actions p { margin: 0 auto 0 0; }
.inline-form { display: flex; gap: 8px; margin: 0 0 12px; }
.inline-form input { min-height: 34px; padding: 6px 10px; }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { flex: 1 1 160px; }
.filters .field.grow { flex: 3 1 260px; }
.filters-actions { display: flex; gap: 8px; }
.filters-box summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--text-2); }
.filters-box summary::-webkit-details-marker { display: none; }
.filters-box[open] summary { margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 4px 11px; font-size: .8rem; font-weight: 600; cursor: pointer; font-family: var(--font); }
.chip:hover { text-decoration: none; border-color: var(--muted); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.off { text-decoration: line-through; opacity: .55; }
.chip-form { margin: 0; display: inline; }

/* ===================== Tabelas ===================== */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; margin: 0; }
.table-compact td { padding: 8px 10px; font-size: .85rem; }
.w-check { width: 34px; }
.row-muted { opacity: .55; }
.lock-note { color: var(--st-azul-fg); font-size: .76rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.audit-change .old { color: var(--st-vermelho-fg); text-decoration: line-through; text-decoration-thickness: 1px; }
.audit-change .new { color: var(--st-verde-fg); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; font-size: .85rem; flex-wrap: wrap; }
.pg-btns { display: flex; gap: 6px; }
.pagination-info { margin: 10px 0 0; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* ===================== Detalhe do pedido ===================== */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px 14px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); font-size: .82rem; font-weight: 600; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-cols { grid-template-columns: repeat(2, minmax(110px, auto) 1fr); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; max-height: 420px; overflow-y: auto; }
.checklist { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); font-size: .9rem; }
.checklist li + li { margin-top: 4px; }
.lock-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px;
  border-radius: var(--radius); background: var(--st-azul-bg); color: var(--st-azul-fg); border: 1px solid color-mix(in srgb, var(--st-azul) 35%, transparent);
}
.lock-banner.mine { background: var(--brand-soft); color: var(--brand-strong); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.lock-banner > span:not(.lock-actions) { display: flex; flex-direction: column; flex: 1; }
.lock-banner small { opacity: .85; }
.lock-actions { display: flex; gap: 6px; }
.lock-banner form { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 14px; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline li.tl-cancelamento::before { border-color: var(--danger); background: var(--danger); }
.timeline li.tl-devolucao::before { border-color: var(--st-laranja); }
.timeline li.tl-conclusao::before { background: var(--st-verde); border-color: var(--st-verde); }
.timeline time { font-size: .76rem; font-weight: 700; color: var(--muted); }
.timeline p { margin: 1px 0 0; font-size: .87rem; }

/* Filas */
.queue { list-style: none; margin: 0; padding: 0; }
.queue-item + .queue-item { border-top: 1px solid var(--line); }
.queue-link { display: flex; align-items: center; gap: 16px; padding: 12px 6px; color: var(--text); }
a.queue-link:hover { background: var(--surface-2); text-decoration: none; }
.queue-link form { margin: 0; }
.queue-main { display: flex; flex-direction: column; flex: 1; min-width: 0; color: var(--text); }
a.queue-main:hover { text-decoration: none; }
.queue-main strong { color: var(--brand); }
.queue-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .85rem; text-align: right; }
.queue-item.is-mine { background: color-mix(in srgb, var(--brand) 6%, transparent); border-radius: 8px; }
.queue-link > .ico { color: var(--muted); }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-list a { display: flex; align-items: center; justify-content: space-between; padding: 12px 6px; color: var(--text); }
.pick-list a:hover { background: var(--surface-2); text-decoration: none; }

/* Lote */
.lote-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; top: 62px; z-index: 10; padding: 10px 16px; }
.lote-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Barras */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); }
a.bars-row:hover { text-decoration: none; }
.bar { display: block; height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar-cinza > span { background: var(--st-cinza); } .bar-amarelo > span { background: var(--st-amarelo); }
.bar-azul > span { background: var(--st-azul); } .bar-laranja > span { background: var(--st-laranja); }
.bar-verde > span { background: var(--st-verde); } .bar-verde-claro > span { background: var(--st-verde-claro); }
.bar-vermelho > span { background: var(--st-vermelho); }

/* Operadores (config) */
.op-list { list-style: none; margin: 0; padding: 0; }
.op-list > li { border-top: 1px solid var(--line); padding: 12px 0; }
.op-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.op-head form { margin: 0; }
.op-list .chips { margin-bottom: 8px; }
.op-list .inline-form { margin: 0; max-width: 360px; }

/* ===================== Alertas / diálogos ===================== */
.alert { position: relative; padding: 11px 40px 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .9rem; border: 1px solid transparent; }
.alert-sucesso { background: var(--st-verde-bg); color: var(--st-verde-fg); border-color: color-mix(in srgb, var(--st-verde) 30%, transparent); }
.alert-erro { background: var(--st-vermelho-bg); color: var(--st-vermelho-fg); border-color: color-mix(in srgb, var(--st-vermelho) 30%, transparent); }
.alert-aviso { background: var(--st-amarelo-bg); color: var(--st-amarelo-fg); border-color: color-mix(in srgb, var(--st-amarelo) 35%, transparent); }
.alert .badge { margin-left: 4px; }
.alert-x { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 1.3rem; line-height: 1; color: inherit; cursor: pointer; opacity: .6; padding: 2px 6px; }
.dialog { border: 0; border-radius: 14px; padding: 22px; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 15, 24, .55); backdrop-filter: blur(2px); }

/* ===================== Auth ===================== */
body.guest { background: radial-gradient(1200px 500px at 10% -10%, #164e4a 0%, transparent 60%), linear-gradient(160deg, #0b1620 0%, #10202c 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 12px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card > .muted { margin: 4px 0 22px; }
.auth-alert { width: min(400px, 100%); margin: 0; }
.brand-lg { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; font-weight: 600; }
.brand-lg b { color: var(--accent-strong); }
.error-page { padding: 60px 16px; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--line-strong); line-height: 1; }

/* ===================== Responsivo ===================== */
@media (max-width: 1180px) {
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .kv-cols { grid-template-columns: minmax(120px, 34%) 1fr; }
}
@media (max-width: 980px) {
  .grid-2, .grid-wide-left, .grid-wide-right { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-grid; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: min(290px, 86vw); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(8,15,24,.5); z-index: 30; }
  .shell { margin-left: 0; }
  .topbar { padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
  .content { padding: 16px 14px 32px; }
  .foot { padding: 12px 14px 20px; }
  .role-chip { display: none; }
  td .role-chip { display: inline-flex; }
  h1 { font-size: 1.3rem; }
  .card { padding: 14px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form { flex: 1 1 auto; }
  .page-actions > form .btn { width: 100%; }
  .form-grid > [class*="col-"] { grid-column: span 12 !important; }
  .form-grid > .col-2, .form-grid > .col-3 { grid-column: span 6 !important; }
  .form-actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 1.45rem; }
  .kv, .kv-cols { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .queue-link { flex-wrap: wrap; gap: 8px; }
  .queue-meta { align-items: flex-start; text-align: left; width: 100%; }
  .queue-link > .ico { display: none; }

  /* Tabelas viram cartões */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  .table-cards td { border: 0; padding: 4px 0 4px 38%; position: relative; text-align: right; min-height: 28px; }
  .table-cards td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; max-width: 36%; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
  .table-cards td:not([data-label])::before { content: none; }
  .table-cards td.actions { padding-left: 0; padding-top: 8px; }
  .table-cards td.w-check { padding-left: 0; text-align: left; }
  .table-wrap { margin: 0; overflow: visible; }
  .lote-bar { top: 54px; }
}
@media print {
  .sidebar, .topbar, .page-actions, .foot, .lock-banner, form { display: none !important; }
  .shell { margin: 0; } .card { box-shadow: none; break-inside: avoid; }
}
