:root {
  --bg: #f6f7f9; --surface: #fff; --ink: #1f2430; --muted: #667085; --line: #d9dde3;
  --accent: #2f5fd0; --danger: #c62828; --warn-bg: #fff7dc; --warn-ink: #6b5300;
  --orcamento: #6d5bd0; --aguardando: #8a63c7; --preparar_nest: #3f6fd8;
  --para_cortar: #0f9d6b; --para_dobrar: #f5c400; --em_espera: #c96a10; --finalizado: #1a7fe0;
  --na_tiger: #0f9d8f; --nao_aprovado: #e53935;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--ink);
  font: 14px/1.4 "Segoe UI", system-ui, Roboto, Arial, sans-serif; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 6px 16px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; font-weight: 600; }
.notice button { margin-left: auto; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  cursor: pointer; font-weight: 600; }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  cursor: pointer; font-weight: 600; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.go { background: var(--para_cortar); border-color: var(--para_cortar); color: #fff; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
.spacer { flex: 1; }
main { flex: 1; min-height: 0; overflow: auto; }

.board { display: flex; gap: 10px; padding: 14px 16px; height: 100%; min-width: min-content; }
.column { flex: 0 0 236px; display: flex; flex-direction: column; min-height: 0; border-radius: 10px;
  background: color-mix(in srgb, var(--stage) 9%, #fff); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px; }
.pill { padding: 2px 9px; border-radius: 6px; background: var(--stage); color: var(--on, #fff);
  font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.count { color: var(--muted); font-weight: 700; }
.column-body { flex: 1; min-height: 40px; overflow-y: auto; padding: 0 8px 8px; display: flex;
  flex-direction: column; gap: 8px; }
.card { flex: none; height: 172px; padding: 10px 11px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; position: relative; }
.card:hover { border-color: #aab2bf; }
.card-title { all: unset; flex: none; height: 40px; line-height: 20px; font-weight: 600; cursor: pointer;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.card-title:hover { text-decoration: underline; }
.card-title:focus-visible { outline: 2px solid var(--accent); }
.chips { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start; overflow: hidden; }
.chip { padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.hold { background: #fdf0e2; border-color: #eccba6; color: #8a4708; font-weight: 700; }
.chip.note { background: var(--warn-bg); border-color: #eadfae; color: var(--warn-ink); font-weight: 600; }
.chip.live { background: var(--para_cortar); border-color: var(--para_cortar); color: #fff; font-weight: 700; }
.chip.over { color: var(--danger); border-color: #eec5c2; font-weight: 700; }
.card-actions { flex: none; display: flex; gap: 5px; align-items: center; }
.move { flex: 1; padding: 6px 4px; border: 1px solid var(--stage); border-radius: 6px; background: var(--stage);
  color: var(--on, #fff); font-size: 12.5px; font-weight: 650; cursor: pointer; }
.move.alt { background: var(--surface); color: var(--ink); border-color: var(--line); }
.arrow { width: 30px; padding: 5px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.hint { color: var(--muted); font-size: 12px; }

.column.prod-column { flex: 1 0 340px; }
.column.drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-drag-id] { cursor: grab; }
.dragging { opacity: .45; }
.order { flex: none; height: 118px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.order:hover { border-color: #aab2bf; }
.order .card-title { height: auto; -webkit-line-clamp: 1; font-size: 15px; }
.running-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 16px; background: #e4f5ee; color: #0b5f41; font-weight: 600; border-bottom: 1px solid #bfe5d5; }
.work-nests { margin-top: 8px; }
.drop-zone { display: block; margin-top: 10px; padding: 14px; border: 2px dashed #b8c0cc; border-radius: 10px; background: #f7f8fa; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; }
.drop-zone strong { display: block; color: var(--ink); font-size: 14px; }
.drop-zone:hover { background: #eef2fb; }
.file-over, .drop-zone.file-over { outline: 2px dashed #234aa8; outline-offset: -2px; background: #e3ebfb; }
.drop-msg { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.hist-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.hist-filters .field { margin: 0; }
td.wrap { white-space: normal; min-width: 220px; }
.hold-note { margin: 0 0 8px; padding: 6px 10px; background: #fdf0e2; color: #8a4708; border-radius: 6px; font-weight: 600; }
.order.next { border: 2px solid var(--para_cortar); }
.order-head { display: flex; gap: 8px; align-items: center; min-width: 0; }
.next-tag { padding: 1px 8px; border-radius: 6px; background: var(--para_cortar); color: #fff; font-size: 12px; font-weight: 700; }
.nest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #eceef2; }
.nest-name { flex: 1 1 220px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.nest-state { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.timer { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: #0b7c54; }
.download { padding: 4px 9px; border-radius: 6px; background: #eef2fb; color: #234aa8; font-size: 13px; font-weight: 600; text-decoration: none; }
.download:hover { background: #dfe7f8; }
.done-mark { color: #0b7c54; font-weight: 700; }
.manual-tag { padding: 0 6px; border-radius: 5px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 30px; }

.summary { max-width: 980px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile span { display: block; color: var(--muted); font-size: 13px; }
.tile strong { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.panel h2 { margin: 0 0 8px; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; }
th, td { padding: 6px 8px; border-bottom: 1px solid #eceef2; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 18px; border: 0;
  border-radius: 12px; color: var(--ink); box-shadow: 0 16px 48px rgba(15,20,30,.28); }
dialog::backdrop { background: rgba(15,20,30,.45); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
dialog h3 { margin: 14px 0 6px; font-size: 14px; }
dialog .sub { margin: 0 0 12px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--ink); font-size: 14px; font-weight: 400; width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.alert { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 6px 16px;
  background: #fdecea; color: #8e1c1c; font-weight: 600; border-bottom: 1px solid #f3cfcb; }
.op-note { margin: 0 0 8px; padding: 6px 10px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; font-weight: 600; }
.partial-list { margin: 0 0 6px; padding-left: 18px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; }
.choice:hover { border-color: #aab2bf; }
.choice[aria-pressed="true"] { background: #e8eefc; border-color: var(--accent); color: #1c3f96; }
.choice[aria-pressed="true"]::before { content: "✓ "; }
.quick-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 10px; }
.quick-row .field { flex: 0 1 220px; }
.net { margin: 12px 0 0; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-weight: 600; }
.error { margin: 10px 0 0; color: var(--danger); font-weight: 600; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; gap: 14px; align-items: center;
  max-width: calc(100vw - 32px); padding: 10px 14px; background: #1f2430; color: #fff; border-radius: 9px; z-index: 10; }
.toast[hidden] { display: none; }
.toast button { border: 0; background: none; color: #9dbcff; font-weight: 700; cursor: pointer; padding: 0; }
@media (max-width: 600px) { .notice button { margin-left: 0; } }
/* ---------- Quadro real: login, conexao e configuracoes ---------- */
.app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.login-screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 28px rgba(15,20,30,.08); }
.login-box h1 { margin: 0; font-size: 20px; text-align: center; }
.login-q { margin: 4px 0 0; font-weight: 600; text-align: center; }
.login-msg { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; font-size: 13px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-btn { padding: 18px 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 16px; font-weight: 700; cursor: pointer; }
.role-btn:hover { border-color: #aab2bf; }
.role-btn[aria-pressed="true"] { border-color: var(--accent); background: #e8eefc; color: #1c3f96; }
.login-go { width: 100%; margin-top: 10px; padding: 10px; }
.who { padding: 3px 10px; border-radius: 999px; background: #eef2fb; color: #234aa8; font-size: 13px; font-weight: 700; }
.net-status { padding: 6px 16px; background: #fdecea; color: #8e1c1c; font-weight: 600; border-bottom: 1px solid #f3cfcb; }
.btn.danger { color: var(--danger); }
.ok-msg { margin: 10px 0 0; color: #0b7c54; font-weight: 600; }
.config-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.config-row .field { flex: 0 1 200px; margin: 0; }
.panel p { margin: 6px 0; }
code { padding: 1px 5px; border-radius: 4px; background: var(--bg); font-size: 13px; overflow-wrap: anywhere; }a.btn { display: inline-block; text-decoration: none; color: inherit; }
.session-timer { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.session-timer.ending { padding: 3px 10px; border-radius: 999px; background: #fdecea; color: #8e1c1c; font-size: 14px; font-weight: 700; }
.btn.renew { background: var(--danger); border-color: var(--danger); color: #fff; }
