* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f5f5; --surface: #ffffff; --surface2: #f8f8f8;
  --border: #e8e8e8; --border2: #d4d4d4;
  --text: #111111; --text2: #555555; --text3: #999999;
  --accent: #1D9E75; --accent-dark: #178a65; --accent-bg: #E7F5EF;
  --green: #3B6D11; --green-bg: #EAF3DE;
  --amber: #854F0B; --amber-bg: #FAEEDA; --amber-txt: #BA7517;
  --red: #A32D2D; --red-bg: #FCEBEB;
  --blue: #185FA5; --blue-bg: #E6F1FB;
  --radius: 8px; --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; }
button, input, select, textarea { font-family: inherit; }

/* ── Topbar ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; position: sticky; top: 0; z-index: 100; }
.topbar-left { display: flex; align-items: center; height: 52px; min-width: 0; }
.topbar-title { font-size: 15px; font-weight: 600; margin-right: 1.5rem; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { height: 52px; padding: 0 14px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; color: var(--text2); cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab-btn:hover:not(:disabled) { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-btn:disabled { color: var(--text3); cursor: default; }
/* Menus do topo */
.tabs { overflow: visible; }
.menu { position: relative; height: 100%; display: flex; }
.caret { font-size: 11px; margin-left: 6px; opacity: .8; display: inline-block; transition: transform .15s; }
.menu.open .caret { transform: rotate(180deg); }
.menu-pop { display: none; position: absolute; top: calc(100% - 4px); left: 0; min-width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 6px; z-index: 200; }
.menu.open .menu-pop { display: block; }
.menu-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface2); outline: none; }
.menu-item.active { background: var(--accent-bg); }
.menu-item.active b { color: var(--accent); }
.mi-ic { font-size: 17px; width: 24px; text-align: center; line-height: 1.3; }
.menu-item b { display: block; font-size: 13px; font-weight: 600; }
.menu-item small { display: block; font-size: 11px; color: var(--text3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-config { width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: none; font-size: 18px; cursor: pointer; color: var(--text2); }
.btn-config:hover { background: var(--surface2); }
.btn-config.active { color: var(--accent); background: var(--accent-bg); border-color: #cfe9dd; }
.tab-soon { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface2); border: 1px solid var(--border); color: var(--text3); padding: 1px 5px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.salvo-status { font-size: 11px; color: var(--text3); white-space: nowrap; }
.salvo-status.ok { color: var(--green); }
.salvo-status.aviso { color: var(--amber-txt); }

/* ── Layout ── */
.main { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 2px; }
.page-sub { font-size: 13px; color: var(--text2); }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card-title { font-size: 12px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 12px; margin-bottom: 1.25rem; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.metric-label { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.metric-value { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -0.5px; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-value.red { color: var(--red); } .metric-value.amber { color: var(--amber-txt); } .metric-value.green { color: var(--green); } .metric-value.accent { color: var(--accent); }
.metric-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── Botões ── */
.btn { font-size: 12px; padding: 7px 14px; border: 1px solid var(--border2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn-primario { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primario:hover { background: var(--accent-dark); }
.btn-perigo { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.btn-perigo:hover { background: #fde2e2; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 4px; }
.btn-link:hover { background: var(--accent-bg); }
.icon-btn { width: 26px; height: 26px; border: 1px solid transparent; background: none; border-radius: 5px; color: var(--text3); cursor: pointer; font-size: 12px; flex-shrink: 0; }
.icon-btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--border); color: var(--text); }
.icon-btn.perigo:hover:not(:disabled) { color: var(--red); background: var(--red-bg); border-color: #f5c6c6; }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ── Banner do arquivo ── */
.banner { border-radius: var(--radius); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: 13px; }
.banner-titulo { font-weight: 600; margin-bottom: 2px; }
.banner-texto { font-size: 12px; opacity: .9; }
.banner.amber { background: var(--amber-bg); border: 1px solid #f0d3a6; color: var(--amber); }
.banner.blue  { background: var(--blue-bg); border: 1px solid #b5d4f4; color: var(--blue); }
.banner.red   { background: var(--red-bg); border: 1px solid #f7c1c1; color: var(--red); }
.banner.gray  { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); }

/* ── Tabelas ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--surface2); padding: 8px 10px; text-align: left; font-size: 11px; color: var(--text2); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
.td-right { text-align: right !important; } .td-center { text-align: center; }

/* ── Edição inline ── */
.inp-inline { width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 5px; font-size: 13px; color: var(--text); }
.inp-inline:hover { border-color: var(--border); background: var(--surface); }
.inp-inline:focus { border-color: var(--accent); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(29,158,117,.12); }
.inp-inline::placeholder { color: var(--text3); }
.inp-num { text-align: right; font-variant-numeric: tabular-nums; min-width: 90px; }
.inp-un { width: 70px; }

/* ── Orçamento ── */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inp-busca { padding: 7px 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-size: 12px; background: var(--surface); width: 240px; max-width: 100%; outline: none; }
.inp-busca:focus { border-color: var(--accent); }
.orc-linha { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.orc-linha-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.orc-linha-head:hover { background: var(--surface2); }
.orc-linha.aberta .orc-linha-head { border-bottom: 1px solid var(--border); background: var(--surface2); }
.orc-toggle { transition: transform .15s; }
.orc-linha.aberta .orc-toggle { transform: rotate(90deg); }
.orc-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.orc-nome { font-weight: 600; font-size: 14px; flex: 1; min-width: 140px; }
.orc-meta { font-size: 11px; color: var(--text3); white-space: nowrap; }
.orc-valor { font-weight: 700; min-width: 140px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.orc-linha-acoes { display: flex; gap: 2px; }
.orc-linha-body { display: none; padding: 10px 12px 8px; }
.orc-linha.aberta .orc-linha-body { display: block; }
table.orc-itens td { padding: 3px 4px; }
.td-total { font-weight: 600; white-space: nowrap; padding-right: 10px !important; font-variant-numeric: tabular-nums; }
.orc-add { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.orc-rodape { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); padding: 14px 18px; margin-top: 4px; }
.orc-rodape-label { font-size: 13px; font-weight: 600; color: var(--text2); }
.orc-rodape-valor { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.vazio { text-align: center; padding: 3rem 1.5rem; color: var(--text2); font-size: 13px; line-height: 1.7; background: var(--surface); border: 1px dashed var(--border2); border-radius: var(--radius); }
.vazio-mini { text-align: center; padding: 14px; color: var(--text3); font-size: 12px; }
.dica { font-size: 11px; color: var(--text3); margin-top: 10px; line-height: 1.6; }
kbd { font-family: inherit; font-size: 10px; background: var(--surface2); border: 1px solid var(--border2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; }

/* ── Painel ── */
.barra { height: 12px; border-radius: 6px; background: var(--border); overflow: hidden; }
.barra > div { height: 100%; border-radius: 6px; transition: width .4s; }
.dist-row { display: grid; grid-template-columns: minmax(120px,240px) 1fr 130px 56px; gap: 12px; align-items: center; padding: 6px 0; font-size: 12px; }
.dist-nome { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-bar { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.dist-bar > div { height: 100%; background: var(--accent); border-radius: 4px; }
.dist-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dist-pct { text-align: right; color: var(--text3); font-variant-numeric: tabular-nums; }
.fases { list-style: none; display: grid; gap: 6px; font-size: 13px; }
.fases li { display: flex; gap: 10px; align-items: center; color: var(--text2); }
.fase-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; color: var(--text3); }
.fases li.feita { color: var(--text); }
.fases li.feita .fase-dot { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Formulários ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.campo label { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-size: 13px; background: #fff; color: var(--text); outline: none; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,158,117,.12); }
.campo textarea { min-height: 80px; resize: vertical; }
.campo .ajuda { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.campo .erro { font-size: 11px; color: var(--red); margin-top: 4px; }
.campo-largo { grid-column: 1 / -1; }
.valor-fixo { padding: 8px 10px; border: 1px dashed var(--border2); border-radius: var(--radius-sm); background: var(--surface2); font-size: 13px; font-weight: 700; color: var(--accent); }
.lista-bkp { list-style: none; font-size: 12px; }
.lista-bkp li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text2); }
.lista-bkp li:last-child { border-bottom: none; }

/* ── Toast ── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1C1A17; color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25); display: flex; align-items: center; gap: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 3000; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.erro { background: #7A1C1C; }
.toast button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 5px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ── Badges / tabelas de listagem ── */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; white-space: nowrap; }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.tbl td { padding: 9px 10px; }
.tbl tfoot td { padding: 9px 10px; font-size: 12px; font-weight: 600; background: var(--surface2); border-top: 1px solid var(--border2); }
.tbl tr.clicavel { cursor: pointer; }
.tbl tr.clicavel:hover td { background: var(--surface2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sort-asc::after { content: ' ↑'; color: var(--accent); }
th.sort-desc::after { content: ' ↓'; color: var(--accent); }
.td-titulo { font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.td-linha { font-size: 12px; color: var(--text2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select { padding: 7px 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-size: 12px; background: var(--surface); color: var(--text); max-width: 230px; outline: none; }
.filters select:focus { border-color: var(--accent); }
.seg { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; margin-bottom: 1rem; }
.seg button { border: none; background: none; padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--text2); cursor: pointer; }
.seg button.active { background: var(--accent-bg); color: var(--accent); }
.seg-n { font-size: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; margin-left: 4px; color: var(--text3); }
.secao-label { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: .07em; text-transform: uppercase; margin-bottom: 8px; }
.orc-comp { font-size: 11px; color: var(--blue); white-space: nowrap; }
.orc-comp.estouro { color: var(--red); font-weight: 600; }

/* ── Modal ── */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1500; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-fundo[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 880px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface2); border-radius: 0 0 10px 10px; }
.secao-titulo { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.secao-titulo::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.gerador { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text2); background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.gerador input, .gerador select, .tbl-parc input, .tbl-parc select { padding: 5px 7px; border: 1px solid var(--border2); border-radius: 5px; font-size: 12px; background: #fff; color: var(--text); outline: none; }
.gerador input:focus, .gerador select:focus, .tbl-parc input:focus, .tbl-parc select:focus { border-color: var(--accent); }
.tbl-parc td { padding: 5px 6px; }
.tbl-parc .inp-num { width: 110px; min-width: 0; }
.tbl-parc tr.parc-paga td { background: #F4FAEE; }
.resumo-parc { font-size: 12px; color: var(--text2); }
.txt-ok { color: var(--green); font-weight: 600; }
.txt-aviso { color: var(--amber-txt); font-weight: 600; }
.txt-erro { color: var(--red); font-weight: 600; }
.campo label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; margin: 0; }
.campo label.check input { width: auto; }
.nota { background: var(--blue-bg); border: 1px solid #b5d4f4; color: var(--blue); border-radius: 6px; padding: 10px 12px; font-size: 12px; margin-top: 18px; line-height: 1.5; }

/* ── Painel: visão rápida ── */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
.hero-card, .mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.hero-label { font-size: 12px; color: var(--text2); font-weight: 500; margin-bottom: 4px; }
.hero-valor { font-size: 30px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin-bottom: 14px; line-height: 1.15; }
.hero-nota { font-size: 11px; color: var(--text3); margin-top: 10px; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; background: #E3E6EA; overflow: hidden; }
.stack-bar > div { height: 100%; transition: width .4s; }
.legenda { display: flex; gap: 8px 20px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text2); }
.legenda b { color: var(--text); font-weight: 600; margin-left: 5px; font-variant-numeric: tabular-nums; }
.legenda small { color: var(--text3); margin-left: 4px; font-size: 11px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-top: 1px solid var(--border); color: var(--text2); }
.kv b { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.mini-card { padding: 14px 18px; cursor: pointer; transition: border-color .15s; }
.mini-card:hover { border-color: var(--border2); }
.mc-valor { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mc-sub { font-size: 12px; color: var(--text3); margin-top: 3px; }
.ritmo-row { display: grid; grid-template-columns: 76px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; color: var(--text2); margin-top: 6px; }
.ritmo-row b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.ritmo-bar { height: 6px; background: #E3E6EA; border-radius: 3px; overflow: hidden; }
.ritmo-bar > div { height: 100%; border-radius: 3px; }
.alertas { display: grid; gap: 6px; margin-bottom: 12px; }
.alerta { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.alerta.red { background: var(--red-bg); color: var(--red); }
.alerta.amber { background: var(--amber-bg); color: var(--amber); }
.alerta .ver { margin-left: auto; font-weight: 600; white-space: nowrap; }

/* ── Financeiro ── */
.comp-row { display: grid; grid-template-columns: minmax(170px, 1.1fr) 1fr auto; gap: 14px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.comp-row b { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 120px; }
.comp-bar { height: 8px; background: #F0F2F4; border-radius: 4px; overflow: hidden; }
.comp-bar > div { height: 100%; border-radius: 4px; }
.grafico-wrap { overflow-x: auto; }
.grafico { width: 100%; min-width: 640px; height: auto; display: block; }
.g-eixo { font-size: 11px; fill: #7A838D; font-family: var(--font); }
.link-sutil { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600; }
.link-sutil:hover { text-decoration: underline; }

/* ── Controle por linha (Painel) ── */
.pn-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sel-pn { padding: 7px 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-size: 12px; background: var(--surface); color: var(--text); outline: none; }
.mini-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin: 4px 0 0 auto; max-width: 140px; }
.mini-bar > div { height: 100%; border-radius: 2px; }
.resumo-linha { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid #5B4FCF; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.rl-num { display: flex; flex-direction: column; font-size: 12px; }
.rl-num span { color: var(--text3); font-size: 11px; }
.rl-num b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rl-num small { color: var(--text3); font-size: 11px; }

/* ── Pagamentos ── */
.semana-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 1.25rem; }
.sn-info { flex: 1; min-width: 200px; }
.sn-titulo { font-size: 16px; font-weight: 600; }
.btn-mini { font-size: 11px; padding: 3px 8px; border: 1px solid var(--border2); border-radius: 5px; background: var(--surface); color: var(--text2); cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn-mini:hover { background: var(--surface2); color: var(--text); }
.btn-mini.pagar { background: var(--green-bg); border-color: #c4e0a0; color: var(--green); font-weight: 600; }
.btn-mini.pagar:hover { background: #d4ebba; }
.btn-anexo { background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 2px; }
.tbl .col-sel { width: 34px; text-align: center; }
.tbl tr.linha-paga td { color: var(--text3); }
.tbl tr.selecionada td { background: #FFF8EC; }
.barra-acoes { position: sticky; bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #1C1A17; color: #fff; border-radius: 10px; padding: 10px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); margin: 12px 0; font-size: 13px; }
.barra-acoes input[type=date] { padding: 5px 7px; border-radius: 5px; border: none; font-size: 12px; }
.barra-acoes .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.barra-acoes .btn:hover { background: rgba(255,255,255,.1); }
.barra-acoes .btn-primario { background: var(--accent); border-color: var(--accent); }
.tab-count { display: inline-block; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: 5px; vertical-align: middle; }
.sem-row { display: grid; grid-template-columns: 170px 1fr 90px 130px; gap: 12px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.sem-row:hover { background: var(--surface2); }
.sem-row.atual { background: var(--accent-bg); }
.sem-bar { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.sem-bar > div { height: 100%; background: var(--amber-txt); border-radius: 4px; }
.bloco-titulo { font-size: 13px; font-weight: 600; margin: 4px 0 8px; display: flex; align-items: center; gap: 8px; }

/* ── Anexos e dados de pagamento ── */
.dropzone { border: 2px dashed var(--border2); border-radius: 8px; padding: 16px; text-align: center; font-size: 13px; color: var(--text2); cursor: pointer; background: var(--surface2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.arrastando { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.lista-anexos { display: grid; gap: 6px; margin-top: 10px; }
.anexo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fff; }
.anexo-ic { font-size: 18px; }
.anexo-info { flex: 1; min-width: 160px; }
.anexo-nome { background: none; border: none; padding: 0; color: var(--blue); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; word-break: break-all; }
.anexo-nome:hover:not(:disabled) { text-decoration: underline; }
.anexo-nome:disabled { color: var(--text); cursor: default; }
.anexo select { padding: 5px 7px; border: 1px solid var(--border2); border-radius: 5px; font-size: 12px; background: #fff; color: var(--text); }
.inp-copiar { display: flex; gap: 6px; align-items: center; }
.inp-copiar input { flex: 1; min-width: 0; }
.tbl-parc tr.sub-parc td { padding-top: 0; }
.tbl-parc tr.tem-sub td { border-bottom: none; }

@media (max-width: 760px) {
  .modal-fundo { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .filters select { max-width: 100%; flex: 1 1 45%; }
  .sem-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .sem-bar { grid-column: 1 / -1; grid-row: 2; }
  .sem-row .sem-n { display: none; }
  .topbar { flex-wrap: wrap; padding: 0 16px; gap: 0; }
  .topbar-left { width: 100%; flex-direction: column; align-items: flex-start; height: auto; padding-top: 10px; }
  .topbar-title { margin: 0 0 2px; max-width: 100%; }
  .tabs { width: 100%; height: 44px; }
  .tab-btn { height: 44px; padding: 0 10px; }
  .menu { position: static; }
  .menu-pop { left: 12px; right: 12px; top: 100%; min-width: 0; }
  .topbar-right { position: absolute; top: 8px; right: 12px; }
  .salvo-status { padding: 0 0 8px; }
  .main { padding: 1rem 16px; }
  .orc-linha-head { flex-wrap: wrap; }
  .orc-valor { min-width: 0; margin-left: auto; }
  .dist-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .dist-bar { grid-column: 1 / -1; grid-row: 2; }
  .dist-pct { display: none; }
  .hero, .mini-cards { grid-template-columns: 1fr; }
  .hero-valor { font-size: 26px; }
  .comp-row { grid-template-columns: 1fr auto; }
  .comp-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ════════ Site (login, lista de obras, conta, histórico) ════════ */
.salvo-status.erro { color: var(--red); font-weight: 600; }
.topbar-voltar { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-right: 6px; border-radius: 7px; color: var(--text2); text-decoration: none; font-size: 16px; flex-shrink: 0; }
.topbar-voltar:hover { background: var(--surface2); color: var(--text); }
.menu-obra { margin-right: 1rem; align-items: center; }
button.topbar-title { background: none; border: none; cursor: pointer; color: var(--text); padding: 6px 8px; border-radius: 7px; margin-right: 0; text-align: left; }
button.topbar-title::after { content: ' ▾'; font-size: 11px; color: var(--text3); }
button.topbar-title:hover { background: var(--surface2); }
.menu-obra .menu-pop { top: calc(100% + 2px); }
.menu-pop-direita { left: auto; right: 0; top: calc(100% + 6px); min-width: 250px; }
.menu-usuario { height: auto; }
.btn-usuario { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; font-size: 16px; }
.btn-usuario:hover { border-color: var(--border2); }
.menu-cab { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-cab b { display: block; font-size: 13px; }
.menu-cab small { display: block; font-size: 11px; color: var(--text3); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
a.menu-item { text-decoration: none; }
.menu-item.atual { background: var(--accent-bg); }
.menu-item.atual b { color: var(--accent); }

/* Login */
.tela-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px 28px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.login-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-marca img { max-height: 40px; max-width: 160px; }
.login-logo { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.login-titulo { font-size: 17px; font-weight: 650; }
.login-sub { font-size: 12px; color: var(--text3); }
.login-box .campo { margin-bottom: 14px; }
.login-box .btn-primario { width: 100%; padding: 10px; font-size: 13px; }
.login-erro { background: var(--red-bg); color: var(--red); border-radius: 6px; padding: 9px 12px; font-size: 12px; margin-bottom: 14px; }
.login-ok { background: var(--green-bg); color: var(--green); border-radius: 6px; padding: 9px 12px; font-size: 12px; margin-bottom: 14px; }
.login-rodape { text-align: center; margin-top: 14px; }

/* Lista de obras */
.obras-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 1.5rem; }
.obra-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s; text-decoration: none; color: inherit; display: block; position: relative; }
.obra-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(29,158,117,.10); }
.obra-card-nome { font-size: 15px; font-weight: 650; margin-bottom: 2px; padding-right: 30px; }
.obra-card-cliente { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.obra-card .kv { font-size: 12px; padding: 5px 0; }
.obra-card-menu { position: absolute; top: 10px; right: 10px; }
.obra-card .barra { height: 6px; margin: 4px 0 8px; }
.obra-nova { border: 2px dashed var(--border2); background: transparent; display: flex; align-items: center; justify-content: center; min-height: 150px; color: var(--accent); font-weight: 600; font-size: 14px; }
.obra-nova:hover { background: var(--accent-bg); }
.cab-empresa { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cab-empresa img { max-height: 32px; max-width: 140px; }

/* Histórico */
.hist { display: grid; gap: 6px; }
.hist-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.hist-item > summary { display: flex; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; font-size: 13px; list-style: none; flex-wrap: wrap; }
.hist-item > summary::-webkit-details-marker { display: none; }
.hist-item[open] > summary { border-bottom: 1px solid var(--border); }
.hist-item > .table-wrap { border: none; border-radius: 0 0 8px 8px; }
.hist-quando { font-size: 12px; color: var(--text3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-resumo { flex: 1; min-width: 200px; }
.hist-quem { font-size: 12px; color: var(--text2); font-weight: 600; }
.hist-campo { font-size: 12px; color: var(--text2); margin-top: 2px; }
.hist-de { text-decoration: line-through; color: var(--text3); }
