:root {
  --bg: #f5f6f8; --card: #fff; --txt: #1f2430; --mut: #6b7280; --line: #e3e6eb;
  --pri: #2563eb; --pri-d: #1d4ed8; --ok: #16a34a; --err: #dc2626; --warn: #d97706;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--txt); }
header { background: #111827; }
nav { max-width: 1000px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
nav .logo { color: #fff; font-weight: 700; padding: 14px 12px 14px 0; }
nav a { color: #cbd5e1; text-decoration: none; padding: 14px 12px; }
nav a:hover, nav a.on { color: #fff; background: #1f2937; }
main { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi small { color: var(--mut); display: block; }
.kpi strong { font-size: 22px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f9fafb; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--mut); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 3px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 7px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--pri); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 12px; }
button, .btn { display: inline-block; background: var(--pri); color: #fff; border: 0; border-radius: 7px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--pri-d); }
.btn.sec, button.sec { background: #e5e7eb; color: var(--txt); }
.btn.sec:hover, button.sec:hover { background: #d1d5db; }
.btn.red, button.red { background: transparent; color: var(--err); padding: 4px 8px; }
.btn.red:hover, button.red:hover { background: #fee2e2; }
button.sm, .btn.sm { padding: 4px 10px; font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.erro { background: #fee2e2; color: #991b1b; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; background: #e5e7eb; }
.tag.a_imprimir { background: #fef3c7; color: #92400e; }
.tag.em_producao { background: #dbeafe; color: #1e40af; }
.tag.finalizado { background: #dcfce7; color: #166534; }

/* quadro kanban */
.board { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(240px, 1fr)); align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: #e9ecf1; border-radius: 14px; padding: 12px; min-height: 220px; }
.col.over { outline: 2px dashed var(--pri); background: #dbe6fb; }
.col header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 2px; background: none; }
.col header h2 { margin: 0; font-size: 15px; }
.col .count { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; font-size: 12.5px; font-weight: 600; color: var(--mut); }
.col.c-a_imprimir header h2 { color: #92400e; }
.col.c-em_producao header h2 { color: #1e40af; }
.col.c-finalizado header h2 { color: #7c3aed; }
.col.c-entregue header h2 { color: #166534; }
dialog { border: 0; border-radius: 12px; padding: 20px; max-width: 380px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); cursor: grab; }
.kcard:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.kcard.dragging { opacity: .4; }
.kcard .top { display: flex; justify-content: space-between; gap: 8px; }
.kcard .cli { font-weight: 600; color: var(--txt); text-decoration: none; }
.kcard .num { color: var(--mut); font-size: 12.5px; }
.kcard .sub { font-size: 12.5px; color: var(--mut); margin-top: 2px; }
.kcard .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.kcard .acoes { display: flex; gap: 6px; margin-top: 8px; }
.timer { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #e5e7eb; color: #4b5563; }
.timer.warn { background: #fde68a; color: #92400e; }
.timer.late { background: #fecdd3; color: #9f1239; }
.prazo-atrasado { color: var(--err); font-weight: 600; }
.vazio { text-align: center; color: #9ca3af; font-size: 13px; padding: 18px 0; }
.entrega summary { cursor: pointer; list-style: none; display: inline-block; background: #e5e7eb; color: var(--txt); }
.entrega[open] summary { background: #d1d5db; }
.item-row { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.item-top { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.item-top > div { min-width: 90px; }
.estoque-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.kitem { font-size: 12.5px; color: var(--mut); margin-top: 3px; padding-left: 8px; border-left: 3px solid #e5e7eb; }
.kitem strong { color: var(--txt); }
.onlyprint { display: none; }
@media print {
  header, .noprint { display: none !important; }
  .onlyprint { display: block; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card { border: 0; padding: 4px 0; }
  .tbl-wrap { overflow: visible; }
}
@media (max-width: 860px) { .board { grid-template-columns: repeat(4, 82vw); } }
.tag.pago { background: #dcfce7; color: #166534; }
.tag.aberto { background: #fee2e2; color: #991b1b; }
.tag.parcial { background: #fef3c7; color: #92400e; }
.mut { color: var(--mut); }
.ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); }
.inline { display: inline; }
.bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.bar .sp { flex: 1; }
.mat-row { display: grid; gap: 8px; grid-template-columns: 1.2fr 1.2fr .8fr auto; margin-bottom: 8px; align-items: end; }
.custo-box td:first-child { color: var(--mut); }
.custo-box tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
@media (max-width: 560px) { .mat-row { grid-template-columns: 1fr 1fr; } }
