:root {
  --ink: #232A33;
  --text: #2B323B;
  --muted: #69737F;
  --line: #D8DEE5;
  --bg: #EDF0F3;
  --paper: #FFFFFF;
  --cyan: #0086BF;
  --cyan-soft: #E2F2F9;
  --magenta: #C2185B;
  --magenta-soft: #FBE8F0;
  --yellow: #E2A800;
  --yellow-soft: #FDF4D6;
  --green: #22804A;
  --green-soft: #E2F2E8;
  --r: 6px;
  --sans: "Barlow", "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 100vh;
}
a { color: var(--cyan); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ---------- barra lateral ---------- */
.side { background: var(--ink); color: #fff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.reg { display: flex; height: 6px; }
.reg i { flex: 1; }
.reg i:nth-child(1) { background: #00A3E0; }
.reg i:nth-child(2) { background: #E6007E; }
.reg i:nth-child(3) { background: #FFE600; }
.reg i:nth-child(4) { background: #000; }
.sys-logo { display: block; padding: 18px 16px 4px; }
.sys-logo img { width: 100%; max-width: 178px; display: block; }
.brand { font-family: var(--cond); font-weight: 600; font-size: 18px; line-height: 1.15; padding: 12px 20px 16px; color: #DDE3E9; }
.brand-logo { display: block; background: #fff; border-radius: var(--r); padding: 8px; margin-bottom: 10px; text-align: center; }
.brand-logo img { max-width: 100%; max-height: 56px; display: inline-block; vertical-align: middle; }
.logo-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-prev { width: 180px; height: 96px; border: 1px dashed #B9C3CD; border-radius: var(--r); display: flex; align-items: center; justify-content: center; padding: 8px; background: #fff; }
.logo-prev img { max-width: 100%; max-height: 100%; }
.side nav { display: flex; flex-direction: column; padding: 0 10px; gap: 2px; }
.side nav a { color: #C9D1DA; text-decoration: none; padding: 9px 12px; border-radius: var(--r); font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.on { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 #00A3E0; }

.quem { margin-top: auto; padding: 14px 20px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.quem-nome { width: 100%; font-weight: 600; color: #fff; }
.quem a { color: #AEB8C3; }
.quem a:hover { color: #fff; }
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.perms label { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.perms.desligado { opacity: .45; pointer-events: none; }
body.tela-acesso { background: #232A33; display: block; }
.acesso-logo { width: min(340px, 86%); display: block; margin: 0 auto 22px; }
.acesso { flex-direction: column; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; grid-column: 1 / -1; }
.acesso .card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; width: min(400px, 100%); overflow: hidden; }
.acesso .corpo { padding: 26px 28px 28px; display: flex; flex-direction: column; gap: 14px; }
.acesso h1 { font-size: 28px; }
.acesso .btn { justify-content: center; padding: 11px 14px; font-size: 15px; }

/* ---------- área principal ---------- */
main { padding: 26px 32px 60px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-family: var(--cond); font-weight: 600; font-size: 32px; margin: 0; color: var(--ink); line-height: 1.1; }
h2 { font-family: var(--cond); font-weight: 600; font-size: 21px; margin: 0 0 12px; color: var(--ink); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }

.flash { padding: 11px 14px; border-radius: var(--r); margin-bottom: 16px; background: var(--green-soft); color: #1B5E37; border-left: 4px solid var(--green); }
.flash.erro { background: var(--magenta-soft); color: #8E1243; border-left-color: var(--magenta); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 16px 20px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #AEB8C3; }
.btn.pri { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.pri:hover { background: #00739F; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--magenta); }
.btn.danger:hover { border-color: var(--magenta); }
.btn.sm { padding: 4px 9px; font-size: 13px; font-weight: 500; }
.btn:disabled { opacity: .55; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--magenta); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

/* ---------- tabelas ---------- */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #F7F9FA; white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid #EEF1F4; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #FAFBFC; }
.t .acoes { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.t td.num, .t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.vazio { padding: 34px 20px; text-align: center; color: var(--muted); }
.vazio p { margin: 0 0 12px; }

/* ---------- etiquetas ---------- */
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.b-cyan { background: var(--cyan-soft); color: #005F87; }
.b-green { background: var(--green-soft); color: #1B6139; }
.b-magenta { background: var(--magenta-soft); color: #9C1249; }
.b-yellow { background: var(--yellow-soft); color: #7A5B00; }
.b-gray { background: #EDEFF2; color: #59626D; }

/* ---------- filtros ---------- */
.filtros { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 4px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; }
.busca { display: flex; gap: 6px; }

/* ---------- formulários ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; }
.c5 { grid-column: span 5; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; }
.c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; font-weight: 400; color: var(--text); padding: 8px 10px; border: 1px solid #C9D1DA; border-radius: var(--r); background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: 2px solid var(--cyan-soft); }
input[readonly] { background: #F3F5F7; color: #9AA3AD; }
textarea { min-height: 84px; resize: vertical; }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; }
.hint { font-size: 13px; font-weight: 500; margin-top: 2px; color: var(--muted); }
.hint.ok { color: var(--green); }
.hint.err { color: var(--magenta); }
.seg { display: inline-flex; border: 1px solid #C9D1DA; border-radius: var(--r); overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; }
.seg span { display: block; padding: 8px 16px; font-weight: 600; color: var(--muted); background: #fff; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: -3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 4px; }
.so-pj { display: none; }
.is-pj .so-pj { display: flex; }
.is-pj .so-pf { display: none; }

/* ---------- itens do orçamento ---------- */
table.itens { width: 100%; border-collapse: collapse; min-width: 980px; }
.itens th { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 6px 6px; white-space: nowrap; }
.itens td { padding: 4px 6px; vertical-align: middle; }
.itens td input, .itens td select { padding: 7px 8px; font-size: 14px; }
.itens .w-prod { width: 210px; }
.itens .w-un { width: 78px; }
.itens .w-med { width: 82px; }
.itens .w-preco { width: 100px; }
.itens .i-area, .itens .i-sub { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.itens .i-area { color: var(--muted); font-size: 14px; }
.itens .i-sub { font-weight: 600; }
.itens .x { border: 0; background: none; font-size: 22px; line-height: 1; color: #A0A9B3; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.itens .x:hover { color: var(--magenta); background: var(--magenta-soft); }
.totais { display: grid; grid-template-columns: 1fr auto; gap: 6px 22px; margin-left: auto; max-width: 340px; font-variant-numeric: tabular-nums; }
.totais .v { text-align: right; }
.totais .grande { font-family: var(--cond); font-weight: 600; font-size: 28px; color: var(--ink); }

/* ---------- arte ---------- */
.artes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.arte { position: relative; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.arte img { width: 100%; height: 150px; object-fit: contain; background: repeating-conic-gradient(#F1F3F5 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: 4px; }
.arte input { font-size: 13.5px; padding: 6px 8px; }
.arte-x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.arte-x:hover { color: var(--magenta); border-color: var(--magenta); }
.arte-add { border: 2px dashed #B9C3CD; border-radius: var(--r); min-height: 206px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; text-align: center; }
.arte-add.arrastando { border-color: var(--cyan); background: var(--cyan-soft); }
.cortador { border: 0; border-radius: 8px; padding: 0; width: min(1000px, 96vw); max-height: 94vh; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.cortador::backdrop { background: rgba(20, 26, 33, .7); }
.cortador[open] { display: flex; flex-direction: column; }
.cort-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; gap: 12px; }
.cort-top h2 { margin: 0; }
.cort-pag { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cort-area { height: min(62vh, 640px); display: flex; justify-content: center; align-items: center; background: #2B323B; padding: 12px; overflow: hidden; }
.cort-area canvas { display: block; max-width: 100%; cursor: crosshair; touch-action: none; }
.cort-dica { margin: 8px 18px 0; }
.cort-acoes { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px 16px; }
.cort-esp { flex: 1; }

/* ---------- painel ---------- */
.meta {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 2px;
  padding: 26px 28px; margin: 10px 10px 28px;
}
.meta::before, .meta::after, .meta .cm::before, .meta .cm::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-color: #9AA5B1; border-style: solid;
}
.meta::before { top: -10px; left: -10px; border-width: 0 1px 1px 0; }
.meta::after { top: -10px; right: -10px; border-width: 0 0 1px 1px; }
.meta .cm::before { bottom: -10px; left: -10px; border-width: 1px 1px 0 0; }
.meta .cm::after { bottom: -10px; right: -10px; border-width: 1px 0 0 1px; }
.meta .lin { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.meta .valor { font-family: var(--cond); font-weight: 600; font-size: 52px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.meta .de { color: var(--muted); font-size: 16px; margin-top: 6px; }
.meta .pct { font-family: var(--cond); font-size: 40px; font-weight: 600; color: var(--cyan); line-height: 1; }
.barra { height: 14px; background: #E6EAEE; border-radius: 2px; margin: 18px 0 12px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--cyan); }
.barra.ok i { background: var(--green); }
.meta .info { display: flex; gap: 26px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.meta .info b { color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.kpi:hover { border-color: #AEB8C3; }
.kpi .l { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.kpi .n { font-family: var(--cond); font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 13px; color: var(--muted); }
.kpi.alerta { border-left: 4px solid var(--magenta); }
.kpi.alerta .n { color: var(--magenta); }

.cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; }
.cols > .panel { margin-bottom: 0; }
.cols + .cols, .cols + .panel { margin-top: 18px; }

.chart .plot { display: flex; align-items: flex-end; gap: 14px; height: 160px; position: relative; border-bottom: 1px solid var(--line); }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .bar { width: 100%; max-width: 54px; background: #C7D2DC; border-radius: 2px 2px 0 0; min-height: 2px; }
.chart .col.atual .bar { background: var(--cyan); }
.chart .val { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.chart .meses { display: flex; gap: 14px; margin-top: 6px; }
.chart .meses span { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.chart .meses span.atual { color: var(--ink); }
.chart .linha-meta { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--magenta); pointer-events: none; z-index: 1; }
.chart .linha-meta span { position: absolute; left: 0; top: -19px; font-size: 12px; color: var(--magenta); font-weight: 600; background: var(--paper); padding: 0 4px; }

.lista-mini { list-style: none; margin: 0; padding: 0; }
.lista-mini li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #EEF1F4; align-items: center; }
.lista-mini li:last-child { border-bottom: 0; }
.lista-mini .d { font-size: 13px; color: var(--muted); }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .acts .btn { padding: 7px 11px; }
  .meta { margin: 10px 6px 24px; padding: 20px 18px; }
  .meta .pct { font-size: 32px; }
  .side { position: static; height: auto; }
  .sys-logo { padding: 12px 16px 0; }
  .sys-logo img { max-width: 150px; }
  .brand { padding: 6px 16px 6px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
  .brand-logo { margin: 0; padding: 4px 6px; }
  .brand-logo img { max-height: 30px; }
  .quem { margin: 0; padding: 6px 16px 10px; border: 0; }
  .quem-nome { width: auto; }
  .side nav { flex-direction: row; overflow-x: auto; padding: 0 8px 8px; }
  .side nav a { white-space: nowrap; padding: 7px 11px; }
  .side nav a.on { box-shadow: inset 0 -3px 0 #00A3E0; }
  main { padding: 18px 14px 50px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .kpis > *, .cols > * { min-width: 0; }
  .kpi .n { font-size: 22px; }
  .grid > * { grid-column: span 12; }
  .meta .valor { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
