/* Estilo compartilhado dos portais de gestão (admin.html e gestor.html). */
:root {
  --bg: #F4F6F5; --surface: #FFFFFF; --surface-alt: #E9EDEC;
  --primary: #1E3A5F; --primary-dark: #142A45; --primary-soft: #DCE6EF;
  --accent: #E89A2C;
  --success: #2E8B57; --success-soft: #DCEFE3;
  --danger: #C0433F; --danger-soft: #F8DEDD;
  --text: #1A1D22; --text-muted: #5B6169; --border: #DADFDD;
  --font-display: 'Manrope', sans-serif; --font-body: 'Inter', sans-serif;
  --on-primary: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151A; --surface: #1A2028; --surface-alt: #212932;
    --primary: #6E9CC4; --primary-dark: #4E7AA0; --primary-soft: #223142;
    --accent: #F0AA46;
    --success: #4CAE7C; --success-soft: #1D2F26;
    --danger: #E06863; --danger-soft: #3A2222;
    --text: #EDEFF1; --text-muted: #99A2AB; --border: #2B333C;
    /* No tema escuro o azul fica claro: texto escuro por cima, para manter o contraste. */
    --on-primary: #0B1520;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
button { font-family: var(--font-body); cursor: pointer; }
.app { max-width: 1100px; margin: 0 auto; padding: 0 20px 48px; }

header.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); padding-top: 14px; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.brand-client { font-size: 13px; font-weight: 600; color: var(--primary); padding-left: 10px; border-left: 1px solid var(--border); }
.user-area { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); font-size: 13px; text-decoration: underline; }

nav.tabs { display: flex; gap: 4px; background: var(--surface-alt); padding: 4px; border-radius: 11px; margin: 22px 0 4px; width: fit-content; max-width: 100%; overflow-x: auto; }
nav.tabs button { border: none; background: transparent; color: var(--text-muted); padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
nav.tabs button.active { background: var(--surface); color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 14px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 26px; margin: 18px 0; }
.panel-narrow { max-width: 440px; margin: 40px auto; }
.panel h3 { font-family: var(--font-display); font-size: 15.5px; margin: 0 0 14px; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 24px 0 4px; }
.eyebrow-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin: 0 0 6px; }
.subtext { color: var(--text-muted); font-size: 13.5px; margin: 0 0 18px; line-height: 1.5; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.field input, .field select { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14.5px; font-family: var(--font-body); }
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 200px; margin-bottom: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.kpi-value { font-family: var(--font-display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
.grid-2 .panel { margin: 0; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.acoes { white-space: nowrap; text-align: right; }
table.data td.acoes .btn + .btn { margin-left: 6px; }
.empty-row { color: var(--text-muted); font-size: 13px; padding: 10px 0; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); white-space: nowrap; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.warn { background: #FBEBD3; color: #8A5310; }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--text-muted); }
.dot.online { background: var(--success); }
.dot.busy { background: var(--accent); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 10px; }
.bar { flex: 1; background: var(--primary-soft); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bar .fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--primary); border-radius: 4px 4px 0 0; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); }
.sat-bar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; background: var(--surface-alt); }
.sat-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }

.banner { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; line-height: 1.5; }
.banner.error { background: var(--danger-soft); color: var(--danger); }
.banner.success { background: var(--success-soft); color: var(--success); }
.banner.info { background: var(--primary-soft); color: var(--primary); }

/* Caixa da senha temporária (aparece uma vez só) */
.secret-box { border: 2px dashed var(--accent); border-radius: 12px; padding: 16px; margin: 14px 0; background: var(--surface); }
.secret-box code { font-size: 20px; font-weight: 700; letter-spacing: .06em; background: var(--surface-alt); padding: 4px 10px; border-radius: 6px; user-select: all; }
.secret-box p { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.link-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-cell code { font-size: 12.5px; background: var(--surface-alt); padding: 2px 6px; border-radius: 5px; }

/* Janela de "trocar senha" */
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 26px; background: var(--surface); color: var(--text); width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }

footer.site { max-width: 1100px; margin: 24px auto 0; padding: 20px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
footer.site a { color: var(--text-muted); }

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .app { padding: 0 16px 40px; }
}
