/* Identidade KeepGrow R02: petróleo base, laranja só acento/CTA, Inter Tight. Sem degradê, sombra suave, brilho ou vidro. */
:root {
  --petroleo: #042B35;
  --petroleo-fundo: #021C23;
  --petroleo-linha: #2E5560;
  --laranja: #FE5E29;
  --laranja-texto: #C23A0E;
  --offwhite: #F6F3EE;
  --areia: #E4DFD5;
  --grafite: #4A6170;
  --branco: #FFFFFF;
  --r: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter Tight", system-ui, sans-serif;
  background: var(--offwhite); color: var(--petroleo);
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--petroleo); color: var(--offwhite); display: flex; flex-direction: column; padding: 24px 18px; position: sticky; top: 0; height: 100vh; }
.brand img { width: 132px; display: block; margin-bottom: 32px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { text-decoration: none; padding: 9px 10px; border-radius: var(--r); color: var(--areia); font-weight: 500; }
.nav a:hover { background: var(--petroleo-fundo); color: var(--offwhite); }
.nav a.on { color: var(--offwhite); background: var(--petroleo-fundo); box-shadow: inset 0 -1px 0 var(--laranja); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.sync-info { color: var(--areia); }
.sync-info b { color: var(--offwhite); font-weight: 600; }
.who { display: flex; justify-content: space-between; gap: 8px; color: var(--areia); border-top: 1px solid var(--petroleo-linha); padding-top: 10px; word-break: break-all; }
.link-light { background: none; border: 0; color: var(--offwhite); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.main { padding: 28px 32px 64px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 26px; }
.head .sub { color: var(--grafite); margin-top: 4px; }
.crumb { color: var(--grafite); text-decoration: none; font-size: 13px; }
.crumb:hover { text-decoration: underline; }

/* ---------- botões e campos ---------- */
.btn { font: inherit; font-weight: 600; border-radius: var(--r); padding: 8px 14px; cursor: pointer; border: 1px solid var(--petroleo); background: var(--branco); color: var(--petroleo); white-space: nowrap; }
.btn:hover { background: var(--areia); }
.btn.primary { background: var(--laranja); border-color: var(--laranja); color: var(--petroleo-fundo); }
.btn.primary:hover { background: var(--laranja-texto); border-color: var(--laranja-texto); color: var(--branco); }
.btn.dark { background: var(--petroleo); color: var(--offwhite); }
.btn.dark:hover { background: var(--petroleo-fundo); }
.btn.line-light { background: transparent; border-color: var(--petroleo-linha); color: var(--offwhite); }
.btn.line-light:hover { border-color: var(--laranja); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--petroleo); background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--laranja); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--grafite); }
textarea { min-height: 70px; resize: vertical; }

/* ---------- filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 12px; margin-bottom: 20px; }
.filters label { min-width: 140px; flex: 1 1 140px; }
.filters .grow { flex: 2 1 220px; }

/* ---------- cards (KPI) ---------- */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); border: 1px solid var(--areia); border-radius: var(--r); background: var(--branco); margin-bottom: 24px; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--areia); }
.kpi:first-child { border-left: 0; background: var(--petroleo); color: var(--offwhite); border-radius: var(--r) 0 0 var(--r); }
.kpi .k { font-size: 12px; font-weight: 600; color: var(--grafite); }
.kpi:first-child .k { color: var(--areia); }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--grafite); margin-top: 2px; }
.kpi:first-child .s { color: var(--areia); }
.kpi.alert .v { color: var(--laranja-texto); }

/* ---------- tabela ---------- */
.block { margin-bottom: 28px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.block-h h2 { font-size: 17px; }
.count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--petroleo); color: var(--offwhite); font-size: 12px; text-align: center; margin-left: 6px; font-weight: 600; }
.count.hot { background: var(--laranja); color: var(--petroleo-fundo); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--areia); border-radius: var(--r); background: var(--branco); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--grafite); padding: 9px 12px; border-bottom: 1px solid var(--areia); white-space: nowrap; background: var(--offwhite); }
td { padding: 10px 12px; border-bottom: 1px solid var(--areia); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--offwhite); }
.t-main { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--grafite); }
.muted { color: var(--grafite); }

/* indicadores: normal=petróleo, atenção=laranja contorno, crítico=laranja cheio, excedido=laranja escuro, parado=grafite */
.ind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 11px; border: 1px solid transparent; white-space: nowrap; }
.ind::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ind.normal { color: var(--petroleo); border-color: var(--petroleo-linha); }
.ind.atencao { color: var(--laranja-texto); border-color: var(--laranja); }
.ind.critico { background: var(--laranja); color: var(--petroleo-fundo); }
.ind.excedido { background: var(--laranja-texto); color: var(--branco); }
.ind.pausada, .ind.encerrada, .ind.aguardando_saldo, .ind.sem_config { color: var(--grafite); border-color: var(--areia); }
.bar { height: 4px; background: var(--areia); border-radius: 2px; margin-top: 6px; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--petroleo); border-radius: 2px; }
.bar.warn i { background: var(--laranja); }
.bar.over i { background: var(--laranja-texto); }

details.fold { border: 1px solid var(--areia); border-radius: var(--r); background: var(--branco); }
details.fold > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+"; width: 14px; color: var(--laranja-texto); font-weight: 700; }
details.fold[open] > summary::before { content: "–"; }
details.fold .tbl-wrap { border: 0; border-top: 1px solid var(--areia); border-radius: 0; }

/* ---------- detalhe ---------- */
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 18px; margin-bottom: 20px; }
.panel h2 { font-size: 15px; margin-bottom: 12px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--areia); }
.fact { padding: 12px 12px 0 0; }
.fact .k { font-size: 12px; color: var(--grafite); font-weight: 600; }
.fact .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 14px; border-left: 2px solid var(--areia); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--petroleo); }
.timeline li.ev-erro_sincronizacao::before, .timeline li.ev-campanha_substituida::before, .timeline li.ev-campanha_pausada::before { background: var(--laranja); }
.timeline .when { font-size: 12px; color: var(--grafite); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: var(--areia); color: var(--petroleo); margin-right: 6px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-top: 8px; }
.spark i { flex: 1; background: var(--petroleo); min-height: 1px; }
.chain { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.chain a { font-weight: 600; }

/* ---------- avisos, modal, login ---------- */
.banner { padding: 10px 14px; border-radius: var(--r); background: var(--petroleo); color: var(--offwhite); margin-bottom: 16px; border: 1px solid var(--laranja); }
.banner.ok { border-color: var(--petroleo-linha); }
.empty { padding: 40px 20px; text-align: left; color: var(--grafite); }
.empty h2 { color: var(--petroleo); font-size: 18px; margin-bottom: 6px; }
.modal-bg { position: fixed; inset: 0; background: rgba(2, 28, 35, .55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--offwhite); border-radius: var(--r); width: 100%; max-width: 560px; padding: 22px; border: 1px solid var(--areia); }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal .sub { color: var(--grafite); margin-bottom: 16px; }
.modal .err { color: var(--laranja-texto); font-weight: 600; margin-top: 10px; }
.calc-box { background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 12px; margin: 12px 0; font-variant-numeric: tabular-nums; }
.calc-box b { font-weight: 600; }
.results-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--areia); border-radius: var(--r); background: var(--branco); margin-top: 8px; }
.results-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--areia); background: none; padding: 10px 12px; font: inherit; color: inherit; cursor: pointer; }
.results-list button:hover, .results-list button.sel { background: var(--areia); }
.results-list button:disabled { color: var(--grafite); cursor: default; }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--petroleo); padding: 16px; }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; color: var(--offwhite); }
.login-box label { color: var(--areia); }
.login-logo { width: 160px; margin-bottom: 18px; }
.login-box h1 { font-size: 20px; margin-bottom: 6px; }
.login-err { color: var(--laranja); margin: 0; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi { border-top: 1px solid var(--areia); }
  .kpi:nth-child(-n+3) { border-top: 0; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 14px 16px; }
  .brand img { margin-bottom: 12px; width: 110px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 12px; }
  .main { padding: 18px 16px 48px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--areia) !important; }
  .kpi:first-child { grid-column: 1 / -1; border-radius: var(--r) var(--r) 0 0; border-top: 0 !important; }
  .form, .facts { grid-template-columns: 1fr 1fr; }
}

/* barra lateral recolhível */
.side-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.side-btn { background: none; border: 1px solid var(--petroleo-linha); color: var(--offwhite); border-radius: var(--r); width: 28px; height: 28px; cursor: pointer; font: inherit; font-size: 16px; line-height: 1; }
.side-btn:hover { border-color: var(--laranja); }
.side-open { display: none; align-items: center; gap: 8px; margin-bottom: 16px; background: var(--petroleo); color: var(--offwhite); border: 0; border-radius: var(--r); padding: 7px 12px 7px 8px; font: inherit; font-weight: 600; cursor: pointer; }
.side-open img { width: 20px; height: auto; }
.side-open:hover { background: var(--petroleo-fundo); }
body.side-closed .shell { grid-template-columns: 1fr; }
body.side-closed .side { display: none; }
body.side-closed .side-open { display: inline-flex; }
.danger { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--areia); }
.danger .btn { border-color: var(--laranja-texto); color: var(--laranja-texto); }
.danger .btn:hover { background: var(--laranja-texto); color: var(--branco); }

/* lista de sugestões */
.combo { position: relative; }
.combo input { padding-right: 32px; }
.combo-btn { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 30px; border: 0; background: none; color: var(--grafite); cursor: pointer; font: inherit; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--branco); border: 1px solid var(--petroleo-linha); border-radius: var(--r); max-height: 240px; overflow-y: auto; padding: 4px; }
.combo-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 3px; font: inherit; font-weight: 500; color: var(--petroleo); cursor: pointer; }
.combo-list button:hover, .combo-list button.on { background: var(--areia); }
.combo-list button.cur { font-weight: 700; }

/* seletor de período */
.dp-wrap { position: relative; display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; }
.dp-lbl { font-size: 12px; font-weight: 600; color: var(--grafite); }
.dp-btn { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; text-align: left; font: inherit; color: var(--petroleo); background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 8px 10px; cursor: pointer; }
.dp-btn:hover { border-color: var(--petroleo-linha); }
.dp-btn b { font-weight: 600; }
.dp-btn span { color: var(--grafite); font-size: 13px; }
.dp { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); display: flex; background: var(--branco); border: 1px solid var(--petroleo-linha); border-radius: var(--r); width: max-content; max-width: calc(100vw - 32px); }
.dp-pre { display: flex; flex-direction: column; padding: 8px; border-right: 1px solid var(--areia); min-width: 170px; }
.dp-pre button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 3px; font: inherit; color: var(--petroleo); cursor: pointer; }
.dp-pre button:hover { background: var(--offwhite); }
.dp-pre button.on { background: var(--petroleo); color: var(--offwhite); font-weight: 600; }
.dp-cal { padding: 12px 14px; position: relative; }
.dp-nav { position: absolute; left: 10px; right: 10px; top: 8px; display: flex; justify-content: space-between; pointer-events: none; }
.dp-nav button { pointer-events: auto; width: 28px; height: 28px; border: 1px solid var(--areia); background: var(--branco); border-radius: var(--r); cursor: pointer; font: inherit; color: var(--petroleo); }
.dp-ms { display: flex; gap: 24px; }
.dp-m { width: 238px; }
.dp-mt { text-align: center; font-weight: 600; text-transform: capitalize; height: 28px; line-height: 28px; margin-bottom: 6px; }
.dp-w, .dp-g { display: grid; grid-template-columns: repeat(7, 34px); }
.dp-w span { text-align: center; font-size: 11px; color: var(--grafite); font-weight: 600; padding-bottom: 4px; }
.dp-g button { height: 32px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--petroleo); cursor: pointer; border-radius: 0; }
.dp-g button:hover:not(:disabled) { background: var(--areia); }
.dp-g button.in { background: var(--offwhite); }
.dp-g button.edge { background: var(--petroleo); color: var(--offwhite); font-weight: 600; border-radius: 3px; }
.dp-g button.today { text-decoration: underline; text-decoration-color: var(--laranja); text-underline-offset: 3px; }
.dp-g button:disabled { color: var(--areia); cursor: default; }
.dp-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--areia); margin-top: 10px; padding-top: 10px; }
@media (max-width: 760px) {
  .dp { flex-direction: column; left: 0; right: auto; }
  .dp-pre { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--areia); }
  .dp-ms { flex-direction: column; }
}

/* orçamento compartilhado */
.warn-box { border: 1px solid var(--laranja); border-radius: var(--r); padding: 12px; margin-bottom: 14px; background: var(--offwhite); }
.warn-box > b { color: var(--laranja-texto); }
.sugg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--areia); margin-top: 10px; }
.full-fact { grid-column: 1 / -1; padding-top: 4px; }

/* select próprio */
.sel { position: relative; }
.sel-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; font: inherit; color: var(--petroleo); background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); padding: 8px 10px; cursor: pointer; min-height: 38px; }
.sel-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn::after { content: ""; flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--grafite); border-bottom: 1.5px solid var(--grafite); transform: rotate(45deg) translate(-2px, -2px); }
.sel-btn:hover { border-color: var(--petroleo-linha); }
.sel-btn[aria-expanded="true"] { border-color: var(--petroleo); }
.sel-list { min-width: 100%; right: auto; width: max-content; max-width: min(460px, calc(100vw - 32px)); max-height: 300px; }
.sel-list button.on { background: var(--areia); }
.sel-list button.cur { font-weight: 700; }
.combo-list button.add { color: var(--laranja-texto); font-weight: 600; border-top: 1px solid var(--areia); margin-top: 2px; }

/* ================= responsivo: celular primeiro, depois tablet ================= */
.sel-btn, .dp-btn, input, select, textarea, .btn { min-height: 40px; }
.btn.small { min-height: 34px; }

@media (max-width: 760px) {
  body { font-size: 15px; }
  /* barra superior com menu recolhido */
  .side { position: sticky; top: 0; z-index: 20; padding: 10px 16px; height: auto; }
  .side-top { align-items: center; }
  .brand img { width: 108px; margin: 0; }
  .side-btn { width: auto; height: 36px; padding: 0 12px; font-size: 14px; font-weight: 600; }
  .side-btn::before { content: "Menu"; }
  .side-btn { font-size: 0; }
  .side-btn::before { font-size: 14px; }
  .side .nav, .side .side-foot { display: none; }
  body.nav-open .side .nav { display: flex; flex-direction: column; margin-top: 12px; }
  body.nav-open .side .side-foot { display: flex; margin-top: 12px; }
  body.nav-open .side-btn::before { content: "Fechar"; }
  .nav a { padding: 12px 10px; }
  body.side-closed .side { display: block; }
  body.side-closed .side-open { display: none; }

  .main { padding: 16px 16px 48px; }
  .head { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .head h1 { font-size: 22px; }
  .head > .btn, .head .actions { width: 100%; }
  .head .actions { flex-wrap: wrap; }
  .head .actions .btn { flex: 1 1 auto; }

  .filters { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .filters label, .filters .grow, .dp-wrap { flex: 1 1 auto; min-width: 0; width: 100%; }

  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 14px; border-left: 0 !important; border-top: 1px solid var(--areia) !important; }
  .kpi:nth-child(even) { border-right: 1px solid var(--areia); }
  .kpi:first-child { grid-column: 1 / -1; border-radius: var(--r) var(--r) 0 0; border-top: 0 !important; border-right: 0; }
  .kpi .v { font-size: 20px; }

  /* tabelas viram cartões */
  .tbl-wrap { overflow: visible; border: 0; background: none; }
  .tbl-wrap table, .tbl-wrap tbody, .tbl-wrap tr, .tbl-wrap td { display: block; width: 100%; }
  .tbl-wrap thead { display: none; }
  .tbl-wrap tr { background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); margin-bottom: 10px; padding: 6px 12px; }
  .tbl-wrap td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--offwhite); padding: 8px 0; text-align: right; }
  .tbl-wrap td:last-child { border-bottom: 0; }
  .tbl-wrap td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 12px; font-weight: 600; color: var(--grafite); }
  .tbl-wrap td:not([data-label])::before, .tbl-wrap td[data-label=""]::before { content: none; }
  .tbl-wrap td:first-child { display: block; text-align: left; padding-top: 10px; }
  .tbl-wrap td:first-child::before { content: none; }
  .tbl-wrap td .bar { margin-left: auto; width: 120px; }
  .tbl-wrap td .actions { justify-content: flex-start !important; width: 100%; }
  .tbl-wrap .empty { background: var(--branco); border: 1px solid var(--areia); border-radius: var(--r); }
  details.fold .tbl-wrap { padding: 10px 10px 0; }
  tbody tr.click:hover td { background: none; }

  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .panel { padding: 14px; }
  .form { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .fact .v { font-size: 16px; }
  .sugg { flex-direction: column; align-items: stretch; }

  /* janelas ocupam a tela */
  .modal-bg { padding: 0; align-items: stretch; }
  .modal { max-width: none; min-height: 100%; border-radius: 0; padding: 18px 16px 32px; border: 0; }
  .modal .actions .btn { flex: 1 1 auto; }

  /* seletor de período em tela cheia */
  .dp { position: fixed; inset: 0; max-width: none; width: auto; flex-direction: column; overflow-y: auto; border: 0; border-radius: 0; z-index: 60; }
  .dp-pre { flex-direction: row; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--areia); }
  .dp-pre button { border: 1px solid var(--areia); }
  .dp-ms { flex-direction: column; align-items: center; }
  .dp-m:last-child { display: none; }
  .dp-w, .dp-g { grid-template-columns: repeat(7, 40px); }
  .dp-g button { height: 40px; }
  .dp-m { width: 280px; }
  .dp-foot { flex-direction: column; align-items: stretch; position: sticky; bottom: 0; background: var(--branco); padding-bottom: 12px; }
  .sel-list { max-width: calc(100vw - 32px); }
}

/* tablet */
@media (min-width: 761px) and (max-width: 1100px) {
  .shell { grid-template-columns: 200px 1fr; }
  .main { padding: 24px; }
  .filters label { flex: 1 1 calc(33% - 10px); }
  .dp-wrap { flex: 1 1 100%; }
  .dp { right: auto; left: 0; }
  .form { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: repeat(4, 1fr); }
}
.opt { font-weight: 500; color: var(--grafite); font-size: 11px; margin-left: 4px; }
#planHint { margin-top: -2px; }

/* escolha renovar / complementar */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.ch { flex-direction: row; align-items: flex-start; gap: 10px; border: 1px solid var(--areia); border-radius: var(--r); padding: 12px; background: var(--branco); cursor: pointer; color: var(--petroleo); font-size: 14px; }
.ch input { width: auto; min-height: 0; margin-top: 3px; accent-color: var(--petroleo); }
.ch b { display: block; font-weight: 600; }
.ch small { display: block; font-weight: 400; color: var(--grafite); font-size: 12px; margin-top: 2px; }
.ch:has(input:checked) { border-color: var(--petroleo); outline: 1px solid var(--petroleo); }
.chk span { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--petroleo); font-size: 13px; }
.chk input { width: auto; min-height: 0; accent-color: var(--petroleo); }
@media (max-width: 760px) { .choice { grid-template-columns: 1fr; } }

.who { word-break: normal; align-items: center; }
.who span { overflow-wrap: anywhere; min-width: 0; }
.who .link-light { white-space: nowrap; flex: none; }

/* login: esqueci a senha */
.login-link { align-self: flex-start; color: var(--areia); }
.login-link:hover { color: var(--offwhite); }
.login-txt { margin: -4px 0 0; color: var(--areia); }

/* perfis */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: revert !important; }
body.is-admin .nav a.admin-only { display: block !important; }
body.ro #bAdd, body.ro #bRecharge, body.ro #bReplace, body.ro #bLink, body.ro #noteForm, body.ro #cfgForm .actions,
body.ro [data-act="rec"], body.ro [data-act="bal"], body.ro [data-act="edit"], body.ro .w, body.ro [data-add-prior], body.ro .head > a.btn { display: none !important; }
body.ro #cfgForm input, body.ro #cfgForm textarea { pointer-events: none; background: var(--offwhite); }

/* usuários */
.role-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--areia); border: 1px solid var(--areia); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.role-legend div { background: var(--branco); padding: 10px 12px; }
.role-legend b { display: block; font-weight: 600; }
.role-legend span { font-size: 12px; color: var(--grafite); }
.acc-list { margin-top: 8px; border: 1px solid var(--areia); border-radius: var(--r); background: var(--branco); padding: 4px 10px; max-height: 220px; overflow-y: auto; }
.acc-list .chk { padding: 6px 0; border-bottom: 1px solid var(--offwhite); }
.acc-list .chk:last-child { border-bottom: 0; }

/* responsáveis */
.contacts { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--areia); }
.contacts h3 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.contact { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--areia); }
.contact-form { margin-top: 12px; }
@media (max-width: 760px) { .role-legend { grid-template-columns: 1fr; } .contact { flex-direction: column; align-items: stretch; } }

body:not(.is-admin) #bAdd, body:not(.is-admin) .head > a.btn[href="#/contas"] { display: none !important; }

/* ===== Avisos (webhooks) ===== */
.mono, .secret code, .howto code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.mono { word-break: break-all; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--areia); color: var(--petroleo); background: var(--offwhite); white-space: nowrap; }
.howto { margin-top: 16px; }
.howto ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; color: var(--petroleo); }
.howto code { background: var(--offwhite); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.ev-list { border: 1px solid var(--areia); border-radius: var(--r); padding: 6px 12px; margin: 0; display: grid; grid-template-columns: 1fr; }
.ev-list legend { font-size: 12px; font-weight: 600; color: var(--grafite); padding: 0 4px; }
.ev-list .chk { padding: 8px 0; border-bottom: 1px solid var(--offwhite); }
.secret { margin: 14px 0; padding: 12px; border: 1px dashed var(--laranja); border-radius: var(--r); background: var(--offwhite); }
.secret code { word-break: break-all; color: var(--petroleo); user-select: all; }
@media (min-width: 761px) {
  .tags { justify-content: flex-start; }
  .ev-list { grid-template-columns: 1fr 1fr; column-gap: 16px; }
}
/* Avisos: ações e histórico sem estourar */
.tbl-wrap.dlv { max-width: 100%; }
.tbl-wrap.dlv td { white-space: nowrap; }
.tbl-wrap.dlv td[data-label="Erro"] { white-space: normal; min-width: 160px; }
@media (max-width: 760px) {
  .tbl-wrap.hooks td, .tbl-wrap.dlv td { white-space: normal; }
  .tbl-wrap.hooks td > *, .tbl-wrap.dlv td > * { min-width: 0; overflow-wrap: anywhere; }
  .tbl-wrap.hooks td.r .actions { flex-wrap: wrap; }
  .tbl-wrap.hooks td.r .btn { flex: 1 1 calc(50% - 8px); }
  .tbl-wrap.dlv td[data-label="Erro"] { min-width: 0; }
  .tbl-wrap.dlv td.r .btn { width: 100%; }
}
/* Avisos: tablet e desktop sem rolagem horizontal */
@media (min-width: 761px) {
  .tbl-wrap.hooks, .tbl-wrap.dlv { overflow-x: visible; }
  .tbl-wrap.hooks table, .tbl-wrap.dlv table { table-layout: fixed; width: 100%; }
  .tbl-wrap.hooks td, .tbl-wrap.dlv td { white-space: normal; vertical-align: top; }
  .tbl-wrap.hooks th:nth-child(1) { width: 20%; }
  .tbl-wrap.hooks th:nth-child(2) { width: 22%; }
  .tbl-wrap.hooks th:nth-child(4) { width: 88px; }
  .tbl-wrap.hooks th:nth-child(5) { width: 112px; }
  .tbl-wrap.hooks th:nth-child(6) { width: 132px; }
  .tbl-wrap.hooks .mono { word-break: normal; overflow-wrap: break-word; }
  .tbl-wrap.hooks td.r .actions { flex-direction: column; align-items: stretch; gap: 6px; }
  .tbl-wrap.hooks td.r .btn { width: 100%; white-space: nowrap; }
  .tbl-wrap.dlv th:nth-child(1) { width: 92px; }
  .tbl-wrap.dlv th:nth-child(3) { width: 82px; }
  .tbl-wrap.dlv th:nth-child(4) { width: 76px; }
  .tbl-wrap.dlv th:nth-child(6) { width: 96px; }
  .tbl-wrap.dlv td[data-label="Erro"] { min-width: 0; overflow-wrap: anywhere; }
  .tbl-wrap.dlv td.r .btn { width: 100%; }
}
.st-inline { display: none; margin-top: 6px; }
@media (min-width: 761px) and (max-width: 1100px) {
  .tbl-wrap.hooks th:nth-child(4), .tbl-wrap.hooks td:nth-child(4) { display: none; }
  .tbl-wrap.hooks .st-inline { display: block; }
  .tbl-wrap.hooks th:nth-child(1) { width: 20%; }
  .tbl-wrap.hooks th:nth-child(2) { width: 24%; }
  .tbl-wrap.hooks th:nth-child(5) { width: 96px; }
  .tbl-wrap.hooks th:nth-child(6) { width: 112px; }
  .tbl-wrap.hooks .tag { white-space: normal; }
  .tbl-wrap.hooks th, .tbl-wrap.hooks td { padding-left: 8px; padding-right: 8px; }
}
