/* ==========================================================================
   Powertoc — Painel do cliente / admin
   Identidade alinhada ao boleto: verde institucional + navy + sol.
   Carregado DEPOIS de styles.css. Escopo: body.panel e body.auth-page.
   ========================================================================== */

:root {
  /* Verde institucional (faixas do boleto) */
  --p-green:      #00a651;
  --p-green-600:  #009449;
  --p-green-700:  #008a45;
  --p-green-300:  #7fd3a6;
  --p-green-100:  #c6ecd8;
  --p-green-050:  #e8f7ef;

  /* Azul-marinho: titulos (#092445) e menu lateral (#062B49) */
  --p-navy:       #092445;
  --p-navy-menu:  #062b49;
  --p-navy-800:   #0b2f52;
  --p-navy-900:   #041d34;

  /* Sol (aba superior do boleto / marca) */
  --p-sun:        #f5a800;
  --p-sun-dark:   #d18f00;
  --p-sun-050:    #fdf5e3;
  --p-sun-200:    #f0d296;
  --p-sun-text:   #8a5f00;

  /* Neutros */
  --p-bg:         #f6f8fa;
  --p-surface:    #ffffff;
  --p-line:       #e3e8ee;
  --p-line-soft:  #eef1f5;
  --p-muted:      #7b8794;
  --p-text:       #425466;

  --p-danger:     #c62744;
  --p-danger-bg:  #fdecef;
  --p-danger-bd:  #f6c6cf;

  /* Separacao entre blocos da pagina. Precisa ficar visivelmente acima do
     vao interno das grades (16px), senao secoes vizinhas parecem coladas. */
  --p-gap:        26px;

  --p-radius:     16px;
  --p-radius-lg:  20px;
  --p-shadow-xs:  0 1px 2px rgba(9, 36, 69, .05);
  --p-shadow-sm:  0 4px 16px rgba(9, 36, 69, .06);
  --p-shadow-md:  0 16px 40px rgba(9, 36, 69, .10);
  --p-shadow-lg:  0 28px 64px rgba(9, 36, 69, .16);

  /* Compat: nomes antigos ainda referenciados por páginas legadas */
  --p-sky:        #00a651;
  --p-sky-dark:   #008a45;
  --p-eco:        #00a651;
  --p-navy2:      #0b2f52;
}

/* =====================================================================
   SHELL (body.panel)
   ===================================================================== */
body.panel {
  background: var(--p-bg);
  color: var(--p-text);
  font-family: "Montserrat","Source Sans 3",Arial,sans-serif;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.app .sidebar {
  background: var(--p-navy-menu);
  color: #c9d5e0;
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06), 8px 0 32px rgba(6,43,73,.22);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
.app .sidebar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--p-green) 0%, var(--p-green) 55%, var(--p-sun) 55%, var(--p-sun) 100%);
}

.side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 18px; margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-brand img { width: 40px; height: 40px; flex: none; }
.side-brand .bn { line-height: 1.1; min-width: 0; }
.side-brand .bn strong { color: #fff; font-size: 16.5px; letter-spacing: .04em; display: block; font-weight: 800; }
.side-brand .bn strong em { font-style: normal; color: #4ecf8b; }
.side-brand .bn small {
  color: #8b9db0; font-size: 8.5px; letter-spacing: .19em;
  text-transform: uppercase; font-weight: 700; display: block; margin-top: 3px;
}

.side-label {
  font-size: 10px; letter-spacing: .17em; text-transform: uppercase;
  color: #6b8299; padding: 16px 12px 7px; font-weight: 800;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.app .nav-item {
  display: flex; align-items: center; gap: 12px;
  color: #b9c7d4; text-decoration: none;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.app .nav-item .nav-ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.app .nav-item .nav-ico svg { width: 18px; height: 18px; fill: #8598aa; transition: fill .15s ease; }
.app .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.app .nav-item:hover .nav-ico svg { fill: #e4ecf3; }
.app .nav-item.active { background: var(--p-green); color: #fff; }
.app .nav-item.active:hover { background: var(--p-green); }
.app .nav-item.active .nav-ico svg { fill: #fff; }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot .nav-item { color: #90a1b2; }
.side-foot .nav-item:hover { background: rgba(198,39,68,.18); color: #ffd9e0; }
.side-foot .nav-item:hover .nav-ico svg { fill: #ffb3c1; }

/* Bloco de destaque no rodapé da sidebar */
.side-help {
  margin-top: 14px; padding: 14px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(0,166,81,.24), rgba(0,166,81,.06));
  border: 1px solid rgba(78,207,139,.22);
}
.side-help b { display: block; color: #fff; font-size: 12.5px; margin-bottom: 4px; }
.side-help span { display: block; color: #a3b4c4; font-size: 11.5px; line-height: 1.45; margin-bottom: 6px; }
.side-help a { color: #4ecf8b; font-weight: 700; font-size: 11.5px; text-decoration: none; }
.side-help a:hover { text-decoration: underline; }

/* ---- Coluna principal ---- */
.app-main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--p-line);
  padding: 0 30px; height: 74px;
  position: sticky; top: 0; z-index: 40;
}
.tb-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tb-title { font-size: 20px; font-weight: 800; color: var(--p-navy); letter-spacing: -.02em; margin: 0; }
.tb-sub { font-size: 12.5px; color: var(--p-muted); margin: 3px 0 0; }
.side-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.side-toggle span { display: block; width: 22px; height: 2px; background: var(--p-navy); border-radius: 2px; margin: 5px 0; }

.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 6px 12px 6px 6px;
  border: 1px solid var(--p-line); border-radius: 999px; background: #fff;
  box-shadow: var(--p-shadow-xs); cursor: pointer; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.user-chip:hover { border-color: var(--p-green-300); box-shadow: 0 6px 18px rgba(9,36,69,.12); }
.user-chip .u-caret { width: 16px; height: 16px; color: var(--p-muted); transition: transform .18s ease; flex: none; }
.user-menu.open .u-caret { transform: rotate(180deg); }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 252px; background: #fff; border: 1px solid var(--p-line); border-radius: 14px;
  box-shadow: var(--p-shadow-md); padding: 8px; z-index: 80;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.user-menu.open .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown::before {
  content: ""; position: absolute; top: -6px; right: 22px; width: 12px; height: 12px;
  background: #fff; border-left: 1px solid var(--p-line); border-top: 1px solid var(--p-line);
  transform: rotate(45deg);
}
.user-dropdown .ud-head { padding: 8px 12px 12px; border-bottom: 1px solid var(--p-line); margin-bottom: 6px; }
.user-dropdown .ud-head b { display: block; font-size: 13.5px; color: var(--p-navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown .ud-head span { font-size: 12px; color: var(--p-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--p-text); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.user-dropdown a svg { width: 18px; height: 18px; color: var(--p-muted); flex: none; }
.user-dropdown a:hover { background: var(--p-green-050); color: var(--p-green-700); }
.user-dropdown a:hover svg { color: var(--p-green-700); }
.user-dropdown a.danger:hover { background: var(--p-danger-bg); color: var(--p-danger); }
.user-dropdown a.danger:hover svg { color: var(--p-danger); }
.user-dropdown .ud-sep { height: 1px; background: var(--p-line); margin: 6px 4px; }

.user-chip .avatar {
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #00a651, var(--p-green-700));
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.user-chip .u-meta { line-height: 1.2; text-align: left; }
.user-chip .u-meta b { font-size: 13px; color: var(--p-navy); display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .u-meta small { font-size: 11px; }
.role-pill { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; margin-top: 2px; }
.role-pill.admin { background: var(--p-sun-050); color: var(--p-sun-text); border: 1px solid var(--p-sun-200); }
.role-pill.client { background: var(--p-green-050); color: var(--p-green-700); border: 1px solid var(--p-green-100); }
.role-pill.demo { background: #eef2f7; color: var(--p-navy); border: 1px solid #d8e2ec; }

.content { padding: 26px 30px 10px; flex: 1; width: 100%; max-width: 1420px; margin: 0; min-width: 0; }

.app-footer { padding: 26px 30px 32px; text-align: center; color: var(--p-muted); font-size: 12px; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(6,43,73,.5); z-index: 55; display: none; }

/* =====================================================================
   COMPONENTES DE CONTEÚDO
   ===================================================================== */

/* Cabeçalho de página */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head .ph-text h2 { font-size: 21px; font-weight: 800; color: var(--p-navy); margin: 0; letter-spacing: -.02em; }
.page-head .ph-text p { font-size: 13.5px; color: var(--p-muted); margin: 5px 0 0; }
.page-head .ph-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Cartão */
body.panel .card {
  background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: 22px 24px; box-shadow: var(--p-shadow-sm); margin: 0;
}
body.panel .card + .card, body.panel .grid-3 + .card, body.panel .card[style] { margin-top: var(--p-gap); }
body.panel .kpi-grid + .card, body.panel .card + .kpi-grid,
body.panel .kpi-grid + .kpi-grid, body.panel .plant-grid + .card { margin-top: var(--p-gap); }
body.panel .card h3 {
  font-size: 15.5px; color: var(--p-navy); margin: 0 0 16px; letter-spacing: -.01em;
  font-weight: 800; display: flex; align-items: center; gap: 9px;
}
body.panel .card h3::before {
  content: ""; width: 4px; height: 16px; border-radius: 3px; flex: none;
  background: linear-gradient(180deg, #00a651, var(--p-green-700));
}
body.panel .card h3.no-rail::before { display: none; }

/* Cabeçalho interno com ações à direita */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head h3 { margin: 0 !important; }
.card-head .ch-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head .ch-tools select,
.card-head .ch-tools input { width: auto; min-width: 190px; }

/* Faixa verde no estilo do boleto */
.band {
  background: linear-gradient(100deg, var(--p-green), var(--p-green-700));
  color: #fff; border-radius: 12px; padding: 12px 18px;
  font-weight: 800; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.band.navy { background: linear-gradient(100deg, var(--p-navy), var(--p-navy-900)); }
.band .band-value { font-size: 17px; letter-spacing: 0; text-transform: none; }

/* Aviso amarelo (igual ao box de atenção do boleto) */
.notice {
  background: var(--p-sun-050); border: 1px solid var(--p-sun-200); border-radius: 13px;
  padding: 14px 18px; color: var(--p-sun-text); font-size: 13.5px; line-height: 1.5;
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px;
}
.notice svg { width: 20px; height: 20px; flex: none; color: var(--p-sun-dark); margin-top: 1px; }
.notice b { display: block; font-size: 13.5px; color: #6d4c00; margin-bottom: 2px; }

/* Banner de economia (estilo "VOCÊ ECONOMIZOU") */
.eco-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(115deg, var(--p-green-050), #f4fbf6);
  border: 1px solid var(--p-green-100); border-radius: var(--p-radius); padding: 20px 24px;
}
.eco-banner .eb-left { display: flex; align-items: center; gap: 16px; }
.eco-banner .eb-ico {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, #00a651, var(--p-green-700)); color: #fff;
}
.eco-banner .eb-ico svg { width: 24px; height: 24px; }
.eco-banner h4 { margin: 0; font-size: 16px; font-weight: 800; color: var(--p-green-700); letter-spacing: -.01em; }
.eco-banner p { margin: 3px 0 0; font-size: 13px; color: #4a7a63; }
.eco-banner .eb-value { text-align: right; }
.eco-banner .eb-value b { display: block; font-size: 28px; font-weight: 800; color: var(--p-green-700); letter-spacing: -.02em; line-height: 1.1; }
.eco-banner .eb-value span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #6a8f7c; font-weight: 700; }

/* ---- KPIs ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(216px, 1fr)); gap: 16px; }
.kpi {
  background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: 18px 20px; box-shadow: var(--p-shadow-sm);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
}
/* Cartao limpo: a cor fica so no numero e no chip do icone. */
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--p-muted); font-weight: 800; }
.kpi-ico {
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--p-green-050); color: var(--p-green-700);
}
.kpi-ico svg { width: 19px; height: 19px; }
/* As variantes navy/sun/slate mantem o mesmo chip verde bem claro. */
.kpi-value { font-size: 25px; font-weight: 800; color: var(--p-green-700); letter-spacing: -.03em; line-height: 1.05; }
.kpi-value small { font-size: 14px; font-weight: 700; color: var(--p-muted); letter-spacing: 0; margin-left: 3px; }
.kpi-foot { font-size: 12px; color: var(--p-muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; }
.trend.up   { background: var(--p-green-050); color: var(--p-green-700); }
.trend.down { background: var(--p-danger-bg); color: var(--p-danger); }
.trend.flat { background: #eef1f5; color: #425466; }
.trend svg { width: 12px; height: 12px; }

/* ---- Stat legado ---- */
body.panel .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
body.panel .stat {
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: 18px 20px; box-shadow: var(--p-shadow-sm); position: relative; overflow: hidden;
}
body.panel .stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--p-green); }
body.panel .stat .badge { margin-bottom: 8px; }
body.panel .stat h3 { font-size: 16px; color: var(--p-navy); margin: 0; font-weight: 700; line-height: 1.35; }
body.panel .stat h3::before { display: none; }

/* ---- Badges ---- */
body.panel .badge {
  display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--p-green-050); color: var(--p-green-700); border: 1px solid var(--p-green-100);
}
body.panel .badge.success { background: var(--p-green-050); color: var(--p-green-700); border-color: var(--p-green-100); }
body.panel .badge.warning { background: var(--p-sun-050); color: var(--p-sun-text); border-color: var(--p-sun-200); }
body.panel .badge.danger  { background: var(--p-danger-bg); color: var(--p-danger); border-color: var(--p-danger-bd); }
body.panel .badge.neutral { background: #eef1f5; color: #425466; border-color: #e3e8ee; }
body.panel .badge.navy    { background: #e8f7ef; color: var(--p-navy); border-color: #dbe2ea; }

/* Chips de dado */
body.panel .vencimento-badge {
  display: inline-block; padding: 4px 10px; border-radius: 8px;
  border: 1px solid #dbe2ea; background: #f6f8fa;
  font-weight: 700; font-size: 12.5px; color: var(--p-navy);
}
body.panel .total-badge {
  display: inline-block; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--p-green-100); background: var(--p-green-050);
  font-weight: 800; font-size: 12.5px; color: var(--p-green-700);
}

/* ---- Tabelas ---- */
body.panel .table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
body.panel .table thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--p-muted); font-weight: 800; padding: 11px 14px;
  background: #f7f9fb; border-bottom: 1px solid var(--p-line); white-space: nowrap;
}
body.panel .table thead th:first-child { border-top-left-radius: 10px; }
body.panel .table thead th:last-child { border-top-right-radius: 10px; }
body.panel .table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--p-line-soft); color: var(--p-text); vertical-align: middle; }
body.panel .table tbody tr:hover td { background: #f9fafc; }
body.panel .table tbody tr:last-child td { border-bottom: 0; }
body.panel .table tr.selected td { background: var(--p-green-050) !important; }
body.panel .table td .muted { color: var(--p-muted); font-size: 12px; display: block; margin-top: 2px; }
body.panel .table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* ---- Botões ---- */
body.panel .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; line-height: 1.15;
  background: linear-gradient(135deg, #00a651, var(--p-green-700)); color: #fff;
  box-shadow: 0 6px 16px rgba(0,138,69,.22); transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
  font-family: inherit;
}
body.panel .btn:hover { transform: translateY(-1px); text-decoration: none; box-shadow: 0 10px 22px rgba(0,138,69,.28); }
body.panel .btn svg { width: 16px; height: 16px; }
body.panel .btn.secondary { background: var(--p-green-050); color: var(--p-green-700); border-color: var(--p-green-100); box-shadow: none; }
body.panel .btn.secondary:hover { background: #d7f0e3; }
body.panel .btn.ghost { background: #fff; color: var(--p-navy); border-color: var(--p-line); box-shadow: none; }
body.panel .btn.ghost:hover { border-color: var(--p-green-300); color: var(--p-green-700); }
body.panel .btn.navy { background: linear-gradient(135deg, #2f5d8a, var(--p-navy)); box-shadow: 0 6px 16px rgba(9,36,69,.24); }
body.panel .btn.sun { background: linear-gradient(135deg, var(--p-sun), var(--p-sun-dark)); color: #4a3200; box-shadow: 0 6px 16px rgba(209,143,0,.26); }
body.panel .btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
body.panel .btn:disabled, body.panel .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Formulários ---- */
body.panel label { font-size: 12px; color: var(--p-navy); font-weight: 700; margin-bottom: 6px; display: block; }
body.panel input, body.panel select, body.panel textarea {
  width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--p-line);
  background: #fbfcfd; font-family: inherit; font-size: 14px; color: var(--p-text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
body.panel input:focus, body.panel select:focus, body.panel textarea:focus {
  outline: none; border-color: var(--p-green); box-shadow: 0 0 0 3px rgba(0,166,81,.14); background: #fff;
}
body.panel select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364798a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  padding-right: 34px;
}

/* ---- Alertas ---- */
body.panel .alert {
  padding: 13px 16px; border-radius: 12px; font-size: 13.5px; margin-bottom: 18px;
  background: var(--p-sun-050); border: 1px solid var(--p-sun-200); color: var(--p-sun-text);
}
body.panel .alert.ok { background: var(--p-green-050); border-color: var(--p-green-100); color: var(--p-green-700); }
body.panel .alert.err { background: var(--p-danger-bg); border-color: var(--p-danger-bd); color: var(--p-danger); }
body.panel .alert a { color: inherit; font-weight: 800; text-decoration: underline; }

/* ---- Estado vazio ---- */
.empty { text-align: center; padding: 40px 20px; color: var(--p-muted); }
.empty .em-ico {
  width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px;
  display: grid; place-items: center; background: var(--p-green-050); color: var(--p-green);
}
.empty .em-ico svg { width: 26px; height: 26px; }
.empty b { display: block; color: var(--p-navy); font-size: 15px; margin-bottom: 5px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ---- Grades utilitárias ---- */
body.panel .g-2-1 + .card, body.panel .g-2 + .card, body.panel .g-3 + .card { margin-top: var(--p-gap); }
.g-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.g-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
.g-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.g-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.mt-sec { margin-top: var(--p-gap); }
.mt-20 { margin-top: var(--p-gap); }   /* nome antigo, mesmo espacamento */
.mt-16 { margin-top: 16px; }

/* ---- Gráficos ---- */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { display: block; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 14px; }
.chart-legend .cl {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--p-muted);
}
.chart-legend .cl i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-legend .cl.line i { height: 3px; border-radius: 2px; width: 14px; }

.pt-tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: rgba(9,36,69,.95); border-radius: 9px;
  padding: 8px 11px; font-size: 12px; line-height: 1.45; font-weight: 600; color: #fff;
  box-shadow: 0 10px 26px rgba(6,43,73,.3); white-space: nowrap;
  opacity: 0; transform: translate(-50%, -112%); transition: opacity .12s ease;
}
.pt-tooltip.show { opacity: 1; }
.pt-tooltip b { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8fb3cd; margin-bottom: 5px; }
.pt-tooltip .tt-row { display: flex; align-items: center; gap: 7px; }
.pt-tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.pt-tooltip .tt-row span { color: #cdd9e4; }
.pt-tooltip .tt-row em { font-style: normal; margin-left: auto; padding-left: 14px; font-weight: 800; color: #fff; }

/* ---- Abas em pílula ---- */
.pill-tabs { display: inline-flex; background: #eef1f5; border-radius: 11px; padding: 3px; gap: 2px; }
.pill-tabs button {
  border: 0; background: transparent; font-family: inherit; font-weight: 700; font-size: 12.5px;
  color: var(--p-muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: all .15s ease;
}
.pill-tabs button.active { background: #fff; color: var(--p-green-700); box-shadow: var(--p-shadow-xs); }

/* ---- Barra de proporção ---- */
.meter { height: 7px; border-radius: 999px; background: #e9edf2; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #00a651, var(--p-green-700)); }
.meter.navy > i { background: linear-gradient(90deg, #2f5d8a, var(--p-navy)); }
.meter.sun > i  { background: linear-gradient(90deg, var(--p-sun), var(--p-sun-dark)); }

/* ---- Lista de dados (rótulo/valor) ---- */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--p-muted); font-weight: 600; }
.dl dd { margin: 0; color: var(--p-text); font-weight: 700; text-align: right; }

/* ---- Cartão de usina ---- */
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plant {
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-radius);
  box-shadow: var(--p-shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.plant:hover { box-shadow: var(--p-shadow-md); transform: translateY(-2px); border-color: var(--p-green-300); }
.plant .pl-head {
  padding: 15px 18px; background: linear-gradient(100deg, var(--p-green), var(--p-green-700)); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.plant .pl-head b { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; display: block; }
.plant .pl-head span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; opacity: .85; display: block; margin-top: 3px; font-weight: 700; }
.plant .pl-head .pl-pow { text-align: right; font-size: 16px; font-weight: 800; white-space: nowrap; }
.plant .pl-head .pl-pow span { opacity: .85; }
.plant .pl-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 13px; flex: 1; }
.plant .pl-addr { display: flex; gap: 10px; font-size: 13px; color: var(--p-text); line-height: 1.45; }
.plant .pl-addr svg { width: 17px; height: 17px; flex: none; color: var(--p-green); margin-top: 1px; }
.plant .pl-addr span { color: var(--p-muted); display: block; font-size: 12px; }
.plant .pl-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.plant .pl-stat { background: #f8fafc; border: 1px solid var(--p-line-soft); border-radius: 11px; padding: 10px 12px; }
.plant .pl-stat i { font-style: normal; display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--p-muted); font-weight: 800; }
.plant .pl-stat b { display: block; font-size: 15px; color: var(--p-navy); font-weight: 800; margin-top: 3px; letter-spacing: -.02em; }
.plant .pl-foot { margin-top: auto; padding-top: 4px; }
.plant .pl-spark { height: 46px; }

/* Rateio */
.share-row { display: flex; align-items: center; gap: 12px; }
.share-row .sr-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.share-row .sr-name { font-weight: 700; font-size: 13.5px; color: var(--p-text); }
.share-row .sr-val { margin-left: auto; font-weight: 800; color: var(--p-navy); font-size: 13.5px; white-space: nowrap; }

/* Faixa de demonstração */
.demo-flag {
  background: var(--p-surface);
  border: 1px solid var(--p-line); border-left: 3px solid var(--p-green); color: var(--p-muted);
  border-radius: 11px; padding: 10px 16px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.demo-flag svg { width: 17px; height: 17px; flex: none; color: var(--p-green); }

/* =====================================================================
   AUTENTICAÇÃO (body.auth-page)
   ===================================================================== */
body.auth-page { margin: 0; background: var(--p-bg); font-family: "Montserrat","Source Sans 3",Arial,sans-serif; color: var(--p-text); }
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-visual {
  position: relative; overflow: hidden; color: #e6ecf2;
  padding: 52px 56px; display: flex; flex-direction: column;
  background:
    radial-gradient(720px 460px at 88% -12%, rgba(245,168,0,.20), transparent 62%),
    radial-gradient(640px 440px at -12% 112%, rgba(0,166,81,.42), transparent 58%),
    linear-gradient(158deg, var(--p-navy) 0%, var(--p-navy-900) 100%);
}
.auth-visual::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--p-green) 0%, var(--p-green) 62%, var(--p-sun) 62%, var(--p-sun) 100%);
}
.auth-visual .av-brand { display: flex; align-items: center; gap: 13px; }
.auth-visual .av-brand img { width: 50px; height: 50px; }
.auth-visual .av-brand strong { color: #fff; font-size: 19px; letter-spacing: .04em; display: block; line-height: 1; font-weight: 800; }
.auth-visual .av-brand strong em { font-style: normal; color: #4ecf8b; }
.auth-visual .av-brand small { color: #8b9db0; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; display: block; margin-top: 5px; }
.auth-visual .av-body { margin: auto 0; max-width: 470px; }
.auth-visual h2 { font-size: clamp(26px, 3vw, 35px); font-weight: 800; color: #fff; line-height: 1.16; letter-spacing: -.02em; margin: 0 0 15px; }
.auth-visual .av-lead { color: #b9c7d4; font-size: 15.5px; margin-bottom: 28px; line-height: 1.6; }
.auth-visual ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-visual li { display: flex; align-items: center; gap: 13px; font-size: 14.5px; color: #e6ecf2; }
.auth-visual li svg { width: 21px; height: 21px; flex: none; color: #4ecf8b; }
.auth-visual .av-foot { margin-top: 32px; font-size: 12px; color: #8598aa; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card .ac-mini { display: none; align-items: center; gap: 11px; margin-bottom: 24px; }
.auth-card .ac-mini img { width: 42px; height: 42px; }
.auth-card .ac-mini strong { color: var(--p-navy); font-size: 16px; font-weight: 800; letter-spacing: .03em; }
.auth-card .ac-mini strong em { font-style: normal; color: var(--p-green); }
.auth-card h1 { font-size: 26px; font-weight: 800; color: var(--p-navy); letter-spacing: -.025em; margin: 0 0 8px; }
.auth-card .ac-sub { color: var(--p-muted); font-size: 14.5px; margin: 0 0 24px; }
.auth-card label { font-size: 12.5px; color: var(--p-navy); font-weight: 700; display: block; margin: 16px 0 7px; }
.auth-card input {
  width: 100%; padding: 13px 14px; border-radius: 11px; border: 1px solid var(--p-line);
  background: #fbfcfd; font-family: inherit; font-size: 15px; color: var(--p-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-card input:focus { outline: none; border-color: var(--p-green); box-shadow: 0 0 0 3px rgba(0,166,81,.14); background: #fff; }
.auth-card .btn-auth {
  width: 100%; margin-top: 24px; padding: 14px; border: 0; border-radius: 11px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, #00a651, var(--p-green-700));
  box-shadow: 0 10px 24px rgba(0,138,69,.26); transition: transform .15s ease, box-shadow .15s ease;
}
.auth-card .btn-auth:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(0,138,69,.34); }
.auth-card .ac-alt { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--p-line); font-size: 13.5px; color: var(--p-muted); text-align: center; }
.auth-card .ac-alt a { color: var(--p-green-700); font-weight: 700; text-decoration: none; }
.auth-card .ac-alt a:hover { text-decoration: underline; }
.auth-alert { padding: 12px 15px; border-radius: 11px; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; background: var(--p-danger-bg); border: 1px solid var(--p-danger-bd); color: var(--p-danger); }

/* =====================================================================
   RESPONSIVO
   ===================================================================== */
@media (max-width: 1100px) {
  .g-2-1, .g-1-2, .g-2, .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 264px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; height: 100vh;
  }
  .app .sidebar.open { transform: translateX(0); }
  .side-toggle { display: block; }
  .sidebar-backdrop.show { display: block; }
  .content { padding: 20px 16px 8px; }
  .topbar { padding: 0 16px; }
  .user-chip .u-meta { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-card .ac-mini { display: flex; }
  body.panel .grid-3 { grid-template-columns: 1fr; }
  .eco-banner { flex-direction: column; align-items: flex-start; }
  .eco-banner .eb-value { text-align: left; }
  .card-head .ch-tools { width: 100%; }
  .card-head .ch-tools select { width: 100%; min-width: 0; }
}

/* Impressão */
@media print {
  .sidebar, .topbar, .app-footer, .sidebar-backdrop { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body.panel { background: #fff; }
  .content { padding: 0; }
}

/* =====================================================================
   MEDIDOR EM TEMPO REAL (relogio virtual da unidade consumidora)
   ===================================================================== */
.meter-modal { align-items: flex-start; }
.meter-sheet {
  width: min(560px, 96%); margin: auto;
  background: #fff; border-radius: 18px; border: 1px solid var(--p-line);
  box-shadow: var(--p-shadow-lg); overflow: hidden; position: relative;
}
.meter-sheet .ms-head {
  padding: 18px 22px; background: linear-gradient(100deg, var(--p-navy), var(--p-navy-900)); color: #fff;
}
.meter-sheet .ms-head b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.meter-sheet .ms-head span { display: block; font-size: 12px; color: #a3b4c4; margin-top: 3px; }
.meter-sheet .ms-body { padding: 22px; }
.meter-sheet .ms-foot {
  padding: 14px 22px 18px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; border-top: 1px solid var(--p-line); flex-wrap: wrap;
}
.meter-sheet .ms-foot small { font-size: 11.5px; color: var(--p-muted); }

/* Corpo do medidor */
.meter-box {
  background: linear-gradient(180deg, #0f3358, #0b2f52);
  border-radius: 15px; padding: 16px; border: 1px solid #041d34;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 10px 26px rgba(6,43,73,.24);
}
.meter-box .mb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 12px; margin-bottom: 13px; border-bottom: 1px solid rgba(255,255,255,.09);
}
.meter-box .mb-brand {
  font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #8598aa;
  display: flex; align-items: center; gap: 8px;
}
.meter-box .mb-brand em { font-style: normal; color: #4ecf8b; }
.meter-box .mb-serial {
  font-family: "Courier New", monospace; font-size: 11.5px; font-weight: 700; color: #cdd9e4;
  background: rgba(255,255,255,.07); border-radius: 6px; padding: 4px 9px; letter-spacing: .06em;
}

/* Visor LCD */
.meter-lcd {
  background: linear-gradient(180deg, #c9d6b8, #b6c6a4);
  border-radius: 9px; padding: 12px 14px 11px;
  border: 1px solid #8fa07e; box-shadow: inset 0 2px 6px rgba(30,45,20,.28);
}
.meter-lcd .lcd-label {
  font-size: 8.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #4a5a3d; margin-bottom: 5px;
}
.meter-lcd .lcd-main { position: relative; display: flex; align-items: baseline; gap: 8px; }
.meter-lcd .lcd-digits {
  position: relative; font-family: "Courier New", monospace; font-size: 33px; font-weight: 700;
  letter-spacing: .07em; color: #16240f; line-height: 1;
}
/* Segmentos "apagados" ao fundo, como num LCD real */
.meter-lcd .lcd-digits .ghost { position: absolute; left: 0; top: 0; color: #16240f; opacity: .085; }
.meter-lcd .lcd-digits .live { position: relative; }
.meter-lcd .lcd-unit { font-size: 13px; font-weight: 800; color: #3a4a2f; letter-spacing: .04em; }
.meter-lcd .lcd-sub {
  display: flex; gap: 18px; flex-wrap: wrap; margin-top: 9px; padding-top: 8px;
  border-top: 1px dashed rgba(30,45,20,.28);
}
.meter-lcd .lcd-sub div { font-size: 10.5px; color: #4a5a3d; font-weight: 700; letter-spacing: .04em; }
.meter-lcd .lcd-sub b { display: block; font-family: "Courier New", monospace; font-size: 15px; color: #16240f; margin-top: 1px; }

/* LEDs */
.meter-leds { display: flex; gap: 10px; margin-top: 14px; }
.meter-led {
  flex: 1; display: flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 9px 11px;
}
.meter-led .led {
  width: 11px; height: 11px; border-radius: 999px; flex: none;
  background: currentColor; animation: ptLedBlink var(--rate, 1s) infinite;
}
.meter-led.wh     { color: #f5a800; }
.meter-led.kvar   { color: #2f8de0; }
.meter-led.online { color: #4ecf8b; }
.meter-led .lt { line-height: 1.25; min-width: 0; }
.meter-led .lt b { display: block; font-size: 11.5px; font-weight: 800; color: #e6ecf2; letter-spacing: .03em; }
.meter-led .lt i { display: block; font-style: normal; font-size: 10px; color: #8598aa; white-space: nowrap; }

@keyframes ptLedBlink {
  0%, 16%   { opacity: 1; box-shadow: 0 0 10px 2px currentColor; }
  17%, 100% { opacity: .13; box-shadow: none; }
}
/* Sem telemetria nada pisca: LED parado diz a verdade, piscando mentiria.
   Wh e kvarh ficam apagados como lampada morta; so o Online acende, vermelho,
   para o cliente ver de imediato que o medidor nao esta se comunicando. */
.meter-led.off .led { animation: none; opacity: 1; }

.meter-led.off .lt b  { color: #7d8d9c; }
.meter-led.off .lt i  { color: #61707e; }
.meter-led.off .led {                       /* apagado */
  background: #1b2734;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.55);
}

.meter-led.online.off .led {                /* aceso, vermelho, fixo */
  background: #e5484d;
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 0 10px 2px rgba(229,72,77,.65), inset 0 0 3px rgba(255,255,255,.35);
}
.meter-led.online.off        { border-color: rgba(229,72,77,.32); background: rgba(229,72,77,.08); }
.meter-led.online.off .lt b  { color: #ff9ca0; }
.meter-led.online.off .lt i  { color: #d98287; }

.ms-foot small.nota-offline { color: #b4232a; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .meter-led .led { animation: none; opacity: 1; }
}

/* Dados complementares abaixo do medidor */
.meter-info { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.meter-info .mi {
  background: #f8fafc; border: 1px solid var(--p-line-soft); border-radius: 11px; padding: 10px 12px;
}
.meter-info .mi i {
  font-style: normal; display: block; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--p-muted); font-weight: 800;
}
.meter-info .mi b { display: block; font-size: 14px; color: var(--p-navy); font-weight: 800; margin-top: 3px; }

/* Botao da coluna "Gasto tempo real" */
.btn-meter {
  display: inline-flex; align-items: center; gap: 8px;
  background: #0b2f52; color: #d8e1ea; border: 1px solid #041d34;
  border-radius: 9px; padding: 7px 12px; font-family: inherit; font-size: 12px;
  font-weight: 700; cursor: pointer; line-height: 1;
  transition: background .15s ease, transform .15s ease;
}
.btn-meter:hover { background: #0f3358; transform: translateY(-1px); }
.btn-meter .dot {
  width: 8px; height: 8px; border-radius: 999px; background: #4ecf8b; flex: none;
  animation: ptLedBlink 2s infinite; color: #4ecf8b;
}
/* Unidade sem telemetria: bolinha vermelha e parada. */
.btn-meter.offline .dot { background: #e5484d; color: #e5484d; animation: none; opacity: 1; }

/* Botao de emissao do boleto no modal da fatura */
body.panel .btn.boleto-btn,
.invoice-sheet .btn.boleto-btn {
  background: linear-gradient(135deg, #2f5d8a, var(--p-navy));
  color: #fff; box-shadow: 0 6px 16px rgba(9,36,69,.24);
}
body.panel .btn.boleto-btn:hover,
.invoice-sheet .btn.boleto-btn:hover { box-shadow: 0 10px 22px rgba(9,36,69,.32); }
.invoice-sheet .btn.boleto-btn svg { width: 16px; height: 16px; }

/* =====================================================================
   CONTRATOS: contador no menu, splash, visualizador e assinatura
   ===================================================================== */

/* Contador de pendencias ao lado do item do menu */
.nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 6px; margin-left: 7px;
  border-radius: 999px; background: var(--p-sun); color: #3d2b00;
  font-size: 11px; font-weight: 800; line-height: 1; vertical-align: middle;
}
.app .nav-item.active .nav-count { background: #fff; color: var(--p-green-700); }

/* Aviso persistente de contrato sem assinatura */
.sign-warn {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  background: var(--p-sun-050); border: 1px solid var(--p-sun-200);
  border-radius: 13px; padding: 13px 18px; margin-bottom: 18px;
}
.sign-warn svg { width: 21px; height: 21px; flex: none; color: var(--p-sun-dark); }
.sign-warn b { display: block; font-size: 13.5px; color: #6d4c00; }
.sign-warn span { display: block; font-size: 12.5px; color: var(--p-sun-text); margin-top: 2px; }
.sign-warn .btn { margin-left: auto; }

/* ---- Splash de contrato pendente ---- */
.splash-modal { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.splash-sheet {
  width: min(470px, 94%); margin: auto; background: #fff;
  border: 1px solid var(--p-line); border-radius: 20px; padding: 34px 32px 30px;
  box-shadow: var(--p-shadow-lg); text-align: center;
}
.splash-sheet .splash-ico {
  width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--p-green-050); color: var(--p-green-700);
}
.splash-sheet .splash-ico svg { width: 32px; height: 32px; }
.splash-sheet h2 {
  font-size: 21px; font-weight: 800; color: var(--p-navy);
  letter-spacing: -.02em; margin: 0 0 10px; line-height: 1.25;
}
.splash-sheet p { font-size: 14px; color: var(--p-muted); line-height: 1.6; margin: 0 0 24px; }
.splash-actions { display: flex; flex-direction: column; gap: 10px; }
.splash-actions .btn { width: 100%; padding: 12px 16px; font-size: 14px; }

/* ---- Visualizador de PDF ---- */
/* O visualizador fica acima da janela de assinatura. A logica ja fecha a
   assinatura antes de abrir o PDF; isto e a garantia de que, mesmo se
   aquele passo falhar, o documento nunca aparece por tras. */
#pdf-modal { z-index: 2200; }

.pdf-sheet {
  width: min(940px, 96%); height: min(88vh, 900px); margin: auto;
  background: #fff; border: 1px solid var(--p-line); border-radius: 18px;
  box-shadow: var(--p-shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
.pdf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; background: var(--p-navy); color: #fff; flex-wrap: wrap;
}
.pdf-head b { font-size: 14.5px; font-weight: 800; display: block; }
.pdf-head span { font-size: 11.5px; color: #a3b4c4; display: block; margin-top: 2px; }
.pdf-head .btn.ghost { background: transparent; color: #cdd9e4; border-color: rgba(255,255,255,.28); }
.pdf-head .btn.ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.pdf-body { flex: 1; background: #eef1f5; min-height: 0; }
.pdf-body iframe { width: 100%; height: 100%; border: 0; display: block; }
.pdf-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 20px; border-top: 1px solid var(--p-line); flex-wrap: wrap;
}
.pdf-foot .muted { font-size: 12.5px; color: var(--p-muted); }

/* ---- Assinatura ---- */
.sign-sheet {
  width: min(620px, 96%); margin: auto; background: #fff;
  border: 1px solid var(--p-line); border-radius: 18px;
  box-shadow: var(--p-shadow-lg); overflow: hidden; position: relative;
}
.sign-head {
  padding: 18px 22px; background: var(--p-navy); color: #fff;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.sign-head b { font-size: 15px; font-weight: 800; display: block; }
.sign-head span { font-size: 11.5px; color: #a3b4c4; display: block; margin-top: 3px; }
.sign-head .modal-close {
  position: static; width: 32px; height: 32px; font-size: 20px; flex: none;
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff;
}
.sign-head .modal-close:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: #fff; }

.sign-body { padding: 22px; }
.sign-step { display: flex; gap: 14px; padding-bottom: 20px; }
.sign-step + .sign-step { border-top: 1px solid var(--p-line-soft); padding-top: 20px; }
.sign-step .sign-num {
  width: 26px; height: 26px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--p-green-050); color: var(--p-green-700); font-size: 12.5px; font-weight: 800;
}
.sign-step > div { flex: 1; min-width: 0; }
.sign-step b { display: block; font-size: 14.5px; color: var(--p-navy); font-weight: 800; letter-spacing: -.01em; }
.sign-step p { margin: 4px 0 13px; font-size: 12.5px; color: var(--p-muted); line-height: 1.55; }
.sign-step .sign-num { font-size: 13px; }

.sign-aceites { display: grid; gap: 10px; }
body.panel .aceite {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  background: #fff; border: 1px solid var(--p-line); border-radius: 11px;
  padding: 13px 15px; margin: 0; font-weight: 400;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
body.panel .aceite:hover { border-color: var(--p-green-300); background: #fbfdfc; }
body.panel .aceite input[type="checkbox"] {
  width: 17px; height: 17px; min-width: 17px; margin: 1px 0 0; padding: 0;
  flex: none; accent-color: var(--p-green); cursor: pointer;
}
body.panel .aceite span {
  font-size: 13px; font-weight: 400; color: var(--p-text);
  line-height: 1.55; text-align: left; letter-spacing: 0;
}
body.panel .aceite:has(input:checked) {
  background: var(--p-green-050); border-color: var(--p-green-100);
  box-shadow: inset 0 0 0 1px var(--p-green-100);
}
body.panel .aceite:has(input:checked) span { color: var(--p-green-700); font-weight: 600; }

.sign-codigo { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
body.panel .codigo-input {
  width: 186px; flex: none; text-align: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 22px; font-weight: 700; letter-spacing: 7px;
  padding: 11px 8px 11px 15px; color: var(--p-navy);
  background: #fff; border: 1.5px solid var(--p-line); border-radius: 11px;
}
body.panel .codigo-input:focus { border-color: var(--p-green); box-shadow: 0 0 0 3px rgba(0,166,81,.14); }
body.panel .codigo-input::placeholder { color: #cfd7df; letter-spacing: 7px; font-weight: 400; }

.sign-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--p-line);
}
.sign-foot .muted { font-size: 11.5px; color: var(--p-muted); max-width: 260px; line-height: 1.45; }

@media (max-width: 700px) {
  /* O visualizador fica acima da janela de assinatura. A logica ja fecha a
   assinatura antes de abrir o PDF; isto e a garantia de que, mesmo se
   aquele passo falhar, o documento nunca aparece por tras. */
#pdf-modal { z-index: 2200; }

.pdf-sheet { height: 92vh; }
  .sign-foot .muted { max-width: 100%; }
  .sign-warn .btn { margin-left: 0; width: 100%; }
}

/* =====================================================================
   ACESSO RESTRITO (/adminp) — deliberadamente sobrio e sem marca comercial
   ===================================================================== */
body.adminp-page {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(720px 420px at 50% -10%, rgba(0,166,81,.10), transparent 60%),
    var(--p-navy-menu);
  font-family: "Montserrat", Arial, sans-serif; color: var(--p-text);
}
.adminp-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.adminp-card {
  width: min(390px, 100%); background: #fff; border-radius: 18px;
  padding: 34px 32px 26px; box-shadow: 0 30px 70px rgba(4,18,32,.4);
}
.adminp-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.adminp-brand img { width: 40px; height: 40px; }
.adminp-brand strong { display: block; font-size: 16px; font-weight: 800; color: var(--p-navy); letter-spacing: .04em; }
.adminp-brand strong em { font-style: normal; color: var(--p-green); }
.adminp-brand small {
  display: block; font-size: 8.5px; letter-spacing: .19em; text-transform: uppercase;
  color: var(--p-muted); font-weight: 700; margin-top: 3px;
}
.adminp-card h1 { font-size: 21px; font-weight: 800; color: var(--p-navy); letter-spacing: -.02em; margin: 0 0 6px; }
.adminp-sub { font-size: 13.5px; color: var(--p-muted); margin: 0 0 22px; }
.adminp-card label { font-size: 12.5px; color: var(--p-navy); font-weight: 700; display: block; margin: 15px 0 7px; }
.adminp-card input {
  width: 100%; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--p-line);
  background: #fbfcfd; font-family: inherit; font-size: 15px; color: var(--p-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.adminp-card input:focus {
  outline: none; border-color: var(--p-green); background: #fff;
  box-shadow: 0 0 0 3px rgba(0,166,81,.14);
}
.adminp-card .btn-auth {
  width: 100%; margin-top: 22px; padding: 13px; border: 0; border-radius: 11px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, #00a651, var(--p-green-700));
  box-shadow: 0 10px 24px rgba(0,138,69,.26); transition: transform .15s ease, box-shadow .15s ease;
}
.adminp-card .btn-auth:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(0,138,69,.34); }
.adminp-foot {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--p-line);
  font-size: 11.5px; color: var(--p-muted); text-align: center;
}

/* Alerta de plano inativo por falta de contrato assinado */
.plan-alert {
  display: flex; align-items: flex-start; gap: 13px;
  background: var(--p-danger-bg); border: 1px solid var(--p-danger-bd);
  border-left: 4px solid var(--p-danger);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 16px;
}
.plan-alert svg { width: 21px; height: 21px; flex: none; color: var(--p-danger); margin-top: 1px; }
.plan-alert b {
  display: block; font-size: 14px; font-weight: 800; color: var(--p-danger);
  letter-spacing: -.01em;
}
.plan-alert span { display: block; font-size: 13px; color: #8c2437; margin-top: 3px; line-height: 1.5; }

/* Selo de fatura sem compensacao (contrato pendente na unidade) */
/* Mesma forma dos baloes de status, so que clicavel. */
.btn-nao-compensada {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--p-danger-bg); color: var(--p-danger);
  border: 1px solid var(--p-danger-bd);
  font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  line-height: 1.45; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.btn-nao-compensada:hover {
  background: #fbdae0; border-color: var(--p-danger); color: var(--p-danger); text-decoration: none;
}
.btn-nao-compensada svg { width: 12px; height: 12px; flex: none; }

/* Baloes de situacao lado a lado, quebrando linha em telas estreitas */
.badge-stack { display: flex; flex-wrap: wrap; gap: 6px; }

/* Celula do formulario dividida ao meio, mantendo a largura original */
.field-split { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }

/* Caixa de selecao com a mesma altura de um campo, para alinhar na linha */
body.panel .check-inline {
  display: flex; align-items: center; gap: 10px; margin: 0; cursor: pointer;
  background: #fff; border: 1px solid var(--p-line); border-radius: 10px;
  padding: 10px 13px; min-height: 41px; font-weight: 400;
  transition: border-color .15s ease, background .15s ease;
}
body.panel .check-inline:hover { border-color: var(--p-green-300); }
body.panel .check-inline input[type="checkbox"] {
  width: 17px; height: 17px; min-width: 17px; margin: 0; padding: 0;
  flex: none; accent-color: var(--p-green); cursor: pointer;
}
body.panel .check-inline span { font-size: 13.5px; font-weight: 400; color: var(--p-text); line-height: 1.3; }
body.panel .check-inline:has(input:checked) { background: var(--p-green-050); border-color: var(--p-green-100); }
body.panel .check-inline:has(input:checked) span { color: var(--p-green-700); font-weight: 600; }

@media (max-width: 700px) { .field-split { grid-template-columns: 1fr; } }

/* Retorno do envio do codigo, dentro da propria janela de assinatura */
.codigo-retorno {
  margin-top: 11px; padding: 10px 13px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; font-weight: 600;
}
.codigo-retorno.ok    { background: var(--p-green-050); border: 1px solid var(--p-green-100); color: var(--p-green-700); }
.codigo-retorno.aviso { background: var(--p-sun-050);   border: 1px solid var(--p-sun-200);   color: var(--p-sun-text); }
.codigo-retorno.erro  { background: var(--p-danger-bg); border: 1px solid var(--p-danger-bd); color: var(--p-danger); }
.codigo-retorno b { font-family: "Courier New", monospace; font-size: 16px; letter-spacing: 3px; }

/* Botao ocupado durante o envio */
body.panel .btn:disabled, body.panel .btn[disabled] { opacity: .6; cursor: wait; transform: none; }

/* Campo do codigo recusado: a borda acompanha a mensagem logo abaixo */
body.panel .codigo-input.invalido {
  border-color: var(--p-danger);
  background: var(--p-danger-bg);
  color: var(--p-danger);
}
body.panel .codigo-input.invalido:focus {
  border-color: var(--p-danger);
  box-shadow: 0 0 0 3px rgba(198,39,68,.14);
}

/* Legenda do card de caucao: sem ela o valor parece entrar no saldo devedor. */
body.panel .stat .stat-nota {
  display: block; margin-top: 6px; font-size: 11px; line-height: 1.35;
  color: var(--p-sun-dark); font-weight: 700;
}
