:root {
  --bg: #F4F8FC; --card: #FFFFFF; --ink: #09264C; --ink2: #274666; --mute: #637C97; --line: #DCE7F1; --line2: #EFF4F8;
  --side: #00477F; --side2: #07588F; --side-txt: #F1F7FC; --side-mute: #BED8EC; --yellow: #FFBF10;
  --venc: #912018; --venc-bg: #FEF3F2;
  --red: #D92D20; --red-bg: #FEF3F2;
  --amb: #F79009; --amb-ink: #B54708; --amb-bg: #FFFAEB;
  --teal: #079455; --teal-ink: #067647; --teal-bg: #ECFDF3;
  --gray: #98A2B3; --gray-bg: #F2F4F7;
  --blue: #005B9C; --sel: #F0F7FD;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 22px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.mute { color: var(--mute); } .erro { color: var(--red); font-size: 13px; }
a { color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--mute); }
.vazio { padding: 24px; text-align: center; }

.btn, .btn-sec { border: 0; border-radius: 8px; height: 38px; padding: 0 14px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn { background: var(--ink); color: #fff; } .btn:hover { background: #1D2939; } .btn:disabled { opacity: .5; }
.btn-sec { background: var(--card); color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); } .btn-sec:hover { background: var(--line2); }
.btn-largo { width: 100%; height: 42px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 100%; max-width: 360px; display: grid; gap: 14px; box-shadow: 0 12px 32px rgba(16, 24, 40, .06); }
.login-card h1 { font-size: 22px; } .login-card p { margin: -8px 0 4px; } .login-card .btn { height: 40px; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink2); }
input, select { font: 14px Inter, system-ui, sans-serif; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; width: 100%; }
input:focus, select:focus { outline: 3px solid #D1E0FF; border-color: #84ADFF; }

/* estrutura */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.lateral { position: sticky; top: 0; height: 100vh; background: var(--side); color: #fff; display: flex; flex-direction: column; gap: 4px; padding: 24px 16px; }
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.marca-ic { width: 32px; height: 32px; border-radius: 8px; background: #12A37F; display: grid; place-items: center; }
.marca-ic svg { color: #fff; width: 17px; height: 17px; }
.marca b { display: block; font-size: 14px; } .marca small { color: var(--side-mute); font-size: 12px; }
.nav { display: grid; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--side-txt); font: 500 13px Inter, system-ui, sans-serif; cursor: pointer; text-align: left; }
.nav button svg { color: var(--side-mute); }
.nav button span { flex: 1; }
.nav button em { font-style: normal; font-size: 12px; color: var(--side-mute); }
.nav button:hover { background: #1D29398C; }
.nav button.ativo { background: var(--side2); color: #fff; font-weight: 600; } .nav button.ativo svg { color: #fff; }
.lateral-pe { margin-top: auto; display: grid; gap: 8px; }
.leitura { padding: 12px; border-radius: 8px; background: var(--side2); display: grid; gap: 2px; }
.leitura b { font-size: 12px; } .leitura small { font-size: 11px; color: var(--side-mute); }
.sair { border: 0; background: none; color: var(--side-mute); font: 500 12px Inter, system-ui, sans-serif; text-align: left; padding: 6px 12px; cursor: pointer; }
.sair:hover { color: #fff; }

.principal { padding: 32px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cabeca { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cabeca > div { display: grid; gap: 6px; }
.cabeca p { margin: 0; font-size: 14px; }
.busca { display: flex; flex-direction: row; align-items: center; gap: 8px; width: 260px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--gray); font-weight: 400; }
.busca input { border: 0; height: 100%; padding: 0; outline: 0; background: none; }
.busca:focus-within { outline: 3px solid #D1E0FF; border-color: #84ADFF; }

.corpo { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.corpo:has(.det[hidden]) { grid-template-columns: minmax(0, 1fr); }

/* visão geral */
.geral { display: grid; gap: 16px; }
.g-topo { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 16px; }
.hero { background: var(--side); color: #fff; border-radius: 14px; padding: 24px; display: grid; gap: 14px; align-content: start; }
.h-k { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--side-mute); }
.h-n { display: flex; align-items: flex-end; gap: 16px; }
.h-n > b { font-size: 56px; line-height: .9; font-weight: 700; letter-spacing: -.03em; }
.h-n > div { display: grid; gap: 2px; padding-bottom: 4px; }
.h-n strong { font-size: 15px; } .h-n small { font-size: 13px; color: var(--side-txt); }
.h-bt { display: flex; gap: 8px; flex-wrap: wrap; }
.h-bt button { height: 36px; padding: 0 14px; border: 0; border-radius: 8px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; }
.h-pri { background: #fff; color: var(--ink); } .h-pri:hover { background: #F2F4F7; }
.h-sec { background: #FFFFFF1A; color: #fff; } .h-sec:hover { background: #FFFFFF2E; }
.h-v { font-size: 12px; font-weight: 600; color: #FDA29B; }
.kpis { display: grid; grid-auto-rows: 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.kpi-l { --c: var(--gray); display: flex; align-items: center; gap: 14px; padding: 0 20px; min-height: 52px; border: 0; border-bottom: 1px solid var(--line2); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.kpi-l:last-child { border-bottom: 0; } .kpi-l:hover { background: #FCFCFD; }
.kpi-l i { width: 4px; height: 24px; border-radius: 2px; background: var(--c); flex: none; }
.k-n { flex: 1; font-weight: 600; color: var(--ink2); }
.k-s { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-l b { min-width: 28px; text-align: right; font-size: 22px; font-weight: 700; color: var(--c); }
.cartao-g { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.cg-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cg-cab h3 { margin: 0; font-size: 15px; } .cg-cab .mute { font-size: 12px; }
.t-linha { display: grid; grid-template-columns: 64px 150px minmax(0, 1fr); gap: 10px; align-items: end; }
.t-rot { font-size: 12px; font-weight: 700; color: var(--ink); padding-bottom: 28px; }
.t-venc { display: flex; flex-wrap: wrap; align-content: flex-end; gap: 4px; padding-bottom: 28px; min-height: 22px; }
.t-venc .pil.pil-v { position: static; transform: none; width: auto; padding: 0 8px; }
.t-venc .pil.pil-v:hover { transform: scale(1.05); }
.t-nada { font-size: 11px; }
.tempo { --t-base: 30px; position: relative; margin: 0 4px; }
.tempo.sem-meses { --t-base: 4px; }
.tempo.sem-meses .t-mes { display: none; }
.tempo.sem-meses .t-eixo, .tempo.sem-meses .t-jan, .tempo.sem-meses .t-hoje { bottom: 0; }
.tempo:not(.sem-meses) .t-hoje span { display: none; }
.t-linha:has(.sem-meses) .t-rot, .t-linha:has(.sem-meses) .t-venc { padding-bottom: 4px; }
.t-jan { position: absolute; top: 0; bottom: 24px; background: #FFF6F5; border-radius: 6px; }
.t-hoje { position: absolute; top: 0; bottom: 24px; width: 2px; background: var(--ink); }
.t-hoje span { position: absolute; top: 0; left: 4px; font-size: 10px; font-weight: 700; color: #fff; background: var(--ink); border-radius: 4px; padding: 1px 5px; }
.t-eixo { position: absolute; left: 0; right: 0; bottom: 24px; height: 1px; background: var(--line); }
.t-mes { position: absolute; bottom: 0; font-size: 11px; color: var(--mute); padding-left: 4px; border-left: 1px solid var(--line); line-height: 20px; }
.pil { position: absolute; transform: translateX(-50%); width: 34px; height: 22px; border: 0; border-radius: 11px; font: 700 10px Inter, system-ui, sans-serif; color: #fff; cursor: pointer; }
.pil:hover { filter: brightness(1.1); transform: translateX(-50%) scale(1.08); }
.p-venc { background: var(--venc); } .p-verm { background: var(--red); } .p-verde { background: var(--teal); }
.g-baixo { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; }
.semana { display: grid; }
.acao { display: flex; align-items: center; gap: 12px; padding: 10px 0; border: 0; border-top: 1px solid var(--line2); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.acao:first-child { border-top: 0; }
.acao:hover .a-t b { text-decoration: underline; text-underline-offset: 2px; }
.a-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--gray-bg); display: grid; place-items: center; color: var(--ink2); flex: none; }
.a-t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.a-t b { font-weight: 600; } .a-t small { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-seta { color: var(--gray); }
.funil-c { display: flex; flex-direction: column; }
.funil { flex: 1; min-height: 180px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.f-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; border: 0; background: none; font: inherit; cursor: pointer; padding: 0; }
.f-col b { font-size: 16px; } .f-col small { font-size: 11px; color: var(--mute); white-space: nowrap; }
.f-bar { width: 100%; max-width: 56px; border-radius: 6px 6px 0 0; background: var(--line); min-height: 3px; }
.f-aviso .f-bar { background: var(--red); } .f-pedido .f-bar { background: var(--amb); }
.f-assinatura_sesc .f-bar, .f-assinatura_easy .f-bar { background: var(--blue); } .f-renovado .f-bar { background: var(--teal); }

/* lista */
.lista { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.g-cab { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--line); background: #FCFCFD; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.g-cab:disabled { cursor: default; }
.g-cab i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.g-cab b { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.g-cab span { font-size: 12px; color: var(--mute); }
.g-cab small { font-size: 12px; color: var(--mute); margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-cab .seta { width: 14px; height: 14px; color: var(--mute); transition: transform .15s; transform: rotate(90deg); }
.fechado .seta { transform: none; }
.grupo:last-child .linha:last-child, .grupo.fechado:last-child .g-cab { border-bottom: 0; }

.linha { --c: var(--gray); display: grid; grid-template-columns: 36px minmax(150px, 220px) minmax(160px, 1fr) 112px 150px; align-items: center; gap: 16px; min-height: 60px; padding: 8px 20px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.linha:hover { background: #FCFCFD; }
.linha.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--blue); }
.linha:focus-visible { outline: 2px solid #84ADFF; outline-offset: -2px; }
.c-venc { --c: var(--venc); } .c-verm { --c: var(--red); } .c-amb { --c: var(--amb); } .c-verde { --c: var(--teal); } .c-cinza { --c: var(--gray); }
.uf { width: 36px; height: 28px; border-radius: 7px; background: var(--gray-bg); color: var(--ink2); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; }
.uf.p { width: 30px; height: 22px; font-size: 11px; border-radius: 6px; }
.l-nome { min-width: 0; display: grid; }
.l-nome b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-nome small { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-val { display: grid; gap: 6px; min-width: 0; }
.l-val-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink2); white-space: nowrap; }
.conf { display: inline-flex; align-items: center; gap: 5px; color: var(--amb-ink); font-size: 11px; }
.conf i { width: 6px; height: 6px; border-radius: 50%; background: var(--amb); }
.trilho { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.trilho span { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.l-dias { display: flex; justify-content: flex-end; }
.l-acao { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.l-acao .et { font-size: 11px; color: var(--blue); white-space: nowrap; }
.btn-linha { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); font: 600 12px Inter, system-ui, sans-serif; color: var(--ink2); cursor: pointer; white-space: nowrap; }
.btn-linha:hover { background: var(--line2); border-color: #D0D5DD; }
.feito { font-size: 12px; font-weight: 600; color: var(--teal-ink); }

.badge { display: inline-flex; justify-content: center; align-items: center; height: 24px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-venc { background: var(--venc-bg); color: var(--venc); } .b-verm { background: var(--red-bg); color: var(--red); } .b-amb { background: var(--amb-bg); color: var(--amb-ink); }
.b-verde { background: var(--teal-bg); color: var(--teal-ink); } .b-cinza { background: var(--gray-bg); color: var(--mute); }

/* detalhe */
.det { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.det .kicker { display: block; margin-bottom: 4px; }
.fechar { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; font-size: 22px; line-height: 1; color: var(--mute); cursor: pointer; }
.fechar:hover { background: var(--line2); }
.det { position: sticky; }
#detalhe { display: grid; gap: 16px; }
#detalhe h2 { padding-right: 30px; margin-top: -12px; }
.prazo { --c: var(--gray); --cbg: var(--gray-bg); display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 10px; background: var(--cbg); }
.prazo.c-venc { --cbg: var(--red-bg); --c: var(--venc); } .prazo.c-verm { --cbg: var(--red-bg); --c: var(--red); } .prazo.c-amb { --cbg: var(--amb-bg); --c: var(--amb-ink); } .prazo.c-verde { --cbg: var(--teal-bg); --c: var(--teal-ink); }
.p-n { display: grid; text-align: center; min-width: 56px; }
.p-n b { font-size: 32px; line-height: 1; font-weight: 700; color: var(--c); letter-spacing: -.02em; }
.p-n small { font-size: 12px; color: var(--c); }
.p-t { display: grid; gap: 2px; } .p-t b { font-size: 14px; } .p-t small { font-size: 12px; color: var(--ink2); }
.d-tit { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-bottom: -6px; }
.passos { list-style: none; margin: 0; padding: 0; display: grid; }
.passos li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.passos li:not(:last-child)::after { content: ""; position: absolute; left: 9px; top: 22px; bottom: 2px; width: 2px; background: var(--line); }
.passos li.feito:not(:last-child)::after { background: var(--teal); }
.passos i { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; }
.passos li.feito i { background: var(--teal); border-color: var(--teal); }
.passos li.feito i::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.passos li.atual i { border-color: var(--blue); box-shadow: 0 0 0 3px #D1E0FF; }
.passos div { display: grid; gap: 1px; }
.passos b { font-size: 13px; font-weight: 600; } .passos li:not(.feito):not(.atual) b { color: var(--gray); font-weight: 500; }
.passos small { font-size: 12px; color: var(--mute); } .passos li.atual small { color: var(--blue); }
.d-sec { border-top: 1px solid var(--line); padding-top: 14px; }
.d-sec summary { list-style: none; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.d-sec summary::-webkit-details-marker { display: none; }
.d-sec summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border: solid var(--mute); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.d-sec[open] summary::after { transform: rotate(-135deg); }
.d-sec[open] > *:not(summary) { margin-top: 12px; }
.ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--amb); }
.d-sec p { margin: 0; }
.ok-txt { font-size: 12px; color: var(--teal-ink); }
.aviso { background: var(--amb-bg); color: #7A2E0E; border: 1px solid #FEDF89; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.form-doc, .pilha { display: grid; gap: 12px; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.linha-btn { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.arq { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; padding-top: 8px; border-top: 1px dashed var(--line); }
.arq a { text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .arq a:hover { text-decoration: underline; }
.arq span { flex: none; }
.d-sub { font-size: 12px; font-weight: 600; color: var(--mute); }
.hist { font-size: 12px; color: var(--mute); padding: 3px 0; }

.aba-intro { margin: 0 0 16px; font-size: 13px; }

/* histórico geral */
.hist-lista { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hist-linha { display: grid; grid-template-columns: 30px minmax(0, 1fr) 160px 130px; gap: 14px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line2); font-size: 13px; }
.hist-linha:last-child { border-bottom: 0; }
.h-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-quem, .h-quando { color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.det-fundo { display: none; }

@media (max-width: 1300px) {
  .linha { grid-template-columns: 36px minmax(120px, 1fr) minmax(120px, 1fr) 104px; }
  .l-acao { display: none; }
}
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .marca { padding: 0 8px 0 0; }
  .nav { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .marca div { display: none; }
  .nav button { width: auto; white-space: nowrap; }
  .nav button svg { display: none; }
  .lateral-pe { margin: 0; display: flex; align-items: center; }
  .leitura { display: none; }
  .principal { padding: 20px 16px; }
  h1 { font-size: 22px; }
  .busca { width: 100%; }
  .corpo, .corpo:has(.det[hidden]) { grid-template-columns: 1fr; }
  .det { position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(440px, 100%); max-height: none; border-radius: 0; border: 0; }
  .det-fundo:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(16, 24, 40, .4); }
  .g-topo, .g-baixo { grid-template-columns: minmax(0, 1fr); }
  .tempo { overflow: hidden; }
  .t-linha { grid-template-columns: 1fr; gap: 4px; }
  .t-rot, .t-venc, .t-linha:has(.sem-meses) .t-rot, .t-linha:has(.sem-meses) .t-venc { padding-bottom: 0; }
  .t-mes:nth-child(odd) { visibility: hidden; }
  .hist-linha { grid-template-columns: 30px minmax(0, 1fr); }
  .h-quem, .h-quando { display: none; }
}
@media (max-width: 600px) {
  .linha { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; }
  .l-val { display: none; }
  .grade2 { grid-template-columns: 1fr; }
}

/* detalhe: nada pode alargar a coluna (nome de arquivo comprido, select com opção longa) */
.det { overflow-x: hidden; }
#detalhe, #detalhe > *, .d-sec, .form-doc, .pilha, .grade2 > *, label { min-width: 0; }
#detalhe select, #detalhe input { min-width: 0; max-width: 100%; }
.aviso, .ok-txt, .hist { overflow-wrap: anywhere; }
