/* ============================================================================
   PLI-HazardTrack · Painel administrativo
   ============================================================================ */

:root {
    --bg: #f5f7f6;
    --card: #ffffff;
    --ink: #0f172a;
    --ink-2: #475569;
    --ink-3: #94a3b8;
    --line: #e2e8f0;
    --line-2: #cbd5e1;
    --border: #e2e8f0;
    --muted: #64748b;
    --pli-verde-escuro: #0f3a1f;
    --pli-verde: #3ec26e;
    --pli-verde-dark: #0f3a1f;
    --pli-navy: #003b5a;
    --pli-primary: #003b5a;
    --pli-secondary: #1c3d59;
    --pli-accent: #116593;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --ok: #2aa358;
    --warn: #f39c12;
    --fail: #e74c3c;
    --code-bg: #f1f5f9;
    --shadow: 0 1px 2px rgba(15, 58, 31, 0.04), 0 4px 12px rgba(15, 58, 31, 0.06);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.45;
}

a { color: var(--pli-verde-escuro); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
    font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 0.82em;
    background: var(--code-bg);
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    color: #1e293b;
}
pre {
    padding: 0.85rem 1rem;
    overflow: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--line);
    line-height: 1.4;
    max-height: 60vh;
}

/* ============================================================================
   LOGIN
   ============================================================================ */

body.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
      radial-gradient(1200px 600px at 30% -20%, rgba(62,194,110,.18), transparent 60%),
      radial-gradient(900px 500px at 110% 110%, rgba(15,58,31,.18), transparent 60%),
      var(--bg);
    padding: 1.5rem;
}

.login-card {
    background: var(--card);
    width: min(420px, 100%);
    border-radius: 14px;
    padding: 1.8rem 1.6rem 1.2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.login-logo {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    color: var(--pli-verde-escuro);
    font-size: 1.1rem;
}

.login-card h1 {
    font-size: 1.35rem;
    margin: 0.4rem 0 0.15rem;
    color: var(--ink);
}

.login-sub {
    color: var(--ink-2);
    font-size: 0.85rem;
    margin: 0 0 1.2rem;
}

.login-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.login-card input {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line-2);
    border-radius: 0.45rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s;
}
.login-card input:focus {
    outline: none;
    border-color: var(--pli-verde);
    box-shadow: 0 0 0 3px rgba(62,194,110,.18);
}

.login-card label select {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line-2);
    border-radius: 0.45rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
}

.btn-primary {
    margin-top: 0.4rem;
    background: var(--pli-verde-escuro);
    color: #fff;
    border: none;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #154f2c; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.login-footer .forgot-link {
    font-weight: 600;
    color: var(--pli-verde-escuro);
}
.login-footer small {
    color: var(--ink-2);
    line-height: 1.4;
}

/* Nome do usuário autenticado no topbar do dashboard */
.admin-actions .who {
    color: rgba(255,255,255,.85);
    font-size: 0.82rem;
    padding: 0.25rem 0.55rem;
    background: rgba(255,255,255,.08);
    border-radius: 0.35rem;
    border: 1px solid rgba(255,255,255,.15);
}

.alert {
    border-radius: 0.45rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.45;
}
.alert-error {
    background: #fdecea;
    color: #991b1b;
    border-left: 3px solid var(--fail);
}

/* ============================================================================
   LOGIN SIGMA-PLI (mesmo visual do PLI Reporta /acesso)
   ============================================================================ */

/*
 * Pagina de acesso: estrutura padrao do ecossistema PLI (a mesma do
 * /acesso do PLI Reporta) — topbar com titulo e links do app, card de
 * login com a marca, rodape com o credito fixo na base.
 */
body.access-page {
    background: linear-gradient(
      340deg,
      #003b5a 0%,
      #1c3d59 38%,
      rgba(28, 61, 89, 0.08) 72%,
      #ffffff 100%
    );
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--pli-primary) 0%, var(--pli-secondary) 100%);
    color: #fff;
    border-bottom: 4px solid var(--pli-verde);
    /* Altura padrao do ecossistema (cabecalho do Smart Router). */
    box-sizing: border-box;
    height: 70px;
    min-height: 70px;
    position: sticky;
    top: 0;
    z-index: 10;
}

header.topbar h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

header.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

header.topbar nav a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
}

header.topbar nav a:hover,
header.topbar nav a[aria-current="page"] {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

body.access-page .access-main {
    width: 100%;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    padding: var(--space-xl) var(--space-lg) var(--space-2xl);
    flex: 1 0 auto;
}

.access-back {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.8125rem;
}

.access-back a {
    color: var(--muted);
    text-decoration: none;
}

.access-back a:hover {
    color: var(--pli-accent);
    text-decoration: underline;
}

footer.footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: var(--space-lg) var(--space-xl);
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #fff;
}

.access-login-card {
    margin-bottom: 0;
}

.access-login-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.access-login-card {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    border-top: 4px solid var(--pli-accent);
    box-shadow:
      0 4px 16px rgba(0, 0, 0, 0.1),
      0 12px 40px rgba(0, 0, 0, 0.08);
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
}

/*
 * Marca do login igual a do cabecalho do app: icone verde e nome em branco.
 * O card e claro, entao a marca ganha a mesma faixa escura da sidebar.
 */
.access-branding {
    text-align: center;
    margin: calc(var(--space-xl) * -1) calc(var(--space-xl) * -1) var(--space-xl);
    padding: var(--space-lg) var(--space-md);
    border-radius: 6px 6px 0 0;
    background: linear-gradient(135deg, var(--pli-primary) 0%, var(--pli-secondary) 100%);
}

/* Mesma marca da sidebar: icone verde + nome branco; slogan · PLI-SP abaixo. */
.access-branding {
    /* Escala da marca: nome = 1em, slogan = 0.49em (proporcao da referencia). */
    font-size: 1.5rem;
}

.access-brand-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 1em;
    color: #fff;
}

.access-app-icon {
    flex-shrink: 0;
    display: inline-flex;
    width: 1.08em;
    height: 1.08em;
    color: var(--pli-verde);
    line-height: 0;
}

.access-app-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.access-app-name {
    font-family: 'Poppins', 'Inter', system-ui, sans-serif;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.1;
    white-space: nowrap;
}

.access-context {
    margin: 0 0 var(--space-lg);
    text-align: center;
    font-size: 0.9375rem;
    color: var(--muted);
}

.access-app-subtitle {
    margin: 0.28rem 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.49em;
    font-weight: 500;
    line-height: 1.2;
}

.access-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.access-field-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pli-secondary);
}

.access-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.access-input-icon {
    position: absolute;
    left: 11px;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
    display: flex;
}

.access-input-wrap input {
    width: 100%;
    min-height: 44px;
    padding: var(--space-sm) 2.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition:
      border-color 0.18s ease,
      box-shadow 0.18s ease;
}

.access-input-wrap input:focus {
    border-color: var(--pli-accent);
    box-shadow: 0 0 0 3px rgba(17, 101, 147, 0.12);
}

.access-input-wrap input::placeholder {
    color: #94a3b8;
    font-size: 0.875rem;
}

.access-toggle-pw {
    position: absolute;
    right: 8px;
    width: auto;
    min-height: 0;
    padding: 4px;
    background: none;
    border: none;
    box-shadow: none;
    color: var(--muted);
    cursor: pointer;
}

.access-toggle-pw:hover {
    color: var(--pli-secondary);
}

.access-feedback {
    display: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: 6px;
    font-size: 0.8125rem;
    margin-bottom: var(--space-md);
    line-height: 1.4;
}

.access-feedback:not([hidden]) {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.access-btn-submit {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--pli-secondary), var(--pli-accent));
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(28, 61, 89, 0.2);
    transition:
      background 0.18s ease,
      transform 0.12s ease,
      box-shadow 0.18s ease;
}

.access-btn-submit:hover {
    background: linear-gradient(135deg, var(--pli-primary), var(--pli-secondary));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(28, 61, 89, 0.3);
}

.access-btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.access-forgot {
    text-align: center;
    margin-top: var(--space-md);
}

.access-forgot a {
    font-size: 0.8125rem;
    color: var(--pli-accent);
    text-decoration: none;
}

.access-forgot a:hover {
    color: var(--pli-secondary);
    text-decoration: underline;
}

.access-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.access-divider span:first-child,
.access-divider span:last-child {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.access-divider-text {
    font-size: 0.8125rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.access-btn-register {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem;
    background: transparent;
    border: 2px solid var(--pli-verde);
    border-radius: 6px;
    color: var(--pli-verde-dark);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    transition:
      background 0.18s ease,
      color 0.18s ease;
}

.access-btn-register:hover {
    background: var(--pli-verde);
    color: #fff;
    text-decoration: none;
}

@media (max-width: 480px) {
    .access-login-card {
        padding: var(--space-xl) var(--space-lg) var(--space-lg);
    }

    .access-app-title {
        font-size: 1.35rem;
    }
}

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.admin-topbar {
    background: var(--pli-verde-escuro);
    color: #fff;
    padding: 0.75rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0,0,0,.2);
}

.admin-brand strong {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    margin-right: 0.35rem;
}
.admin-brand span { color: rgba(255,255,255,.78); font-size: 0.85rem; }

.admin-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.updated-at { color: rgba(255,255,255,.78); font-size: 0.8rem; }

.btn-secondary, .btn-link {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    padding: 0.4rem 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn-secondary:hover, .btn-link:hover {
    background: rgba(255,255,255,.2);
    text-decoration: none;
}
.logout-form { margin: 0; }

.admin-grid {
    max-width: 1280px;
    margin: 1.4rem auto;
    padding: 0 1.2rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}
.card-full { grid-column: 1 / -1; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.card h2 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    color: var(--pli-verde-escuro);
    font-weight: 700;
    letter-spacing: 0.2px;
}
.card-help {
    margin: 0 0 1rem;
    color: var(--ink-2);
    font-size: 0.85rem;
}
.card-body { flex: 1; min-width: 0; }
.card-note {
    flex: 0 1 auto;
    font-size: 0.72rem;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}
.card-head h2 {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-foot {
    margin: 10px 0 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--ink-3);
}
.card.card-full { margin-bottom: 16px; }
.card.card-full:last-child { margin-bottom: 0; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 28px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.card-head h2 {
    margin: 0;
}
.btn-refresh-now {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--line);
    background: var(--pli-verde-escuro);
    color: #fff;
    border-radius: 8px;
    padding: 0.34rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn-refresh-now:hover:not(:disabled) {
    opacity: 0.9;
}
.btn-refresh-now:disabled {
    opacity: 0.55;
    cursor: progress;
}
.btn-refresh-now .brn-ico {
    font-size: 0.95rem;
    line-height: 1;
}
.refresh-msg {
    margin: 0 0 0.7rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-size: 0.82rem;
    border: 1px solid var(--line);
}
.refresh-msg--info {
    background: #eef4fb;
    color: #1c4e80;
    border-color: #cfe0f2;
}
.refresh-msg--ok {
    background: #eaf7ee;
    color: #1d6b39;
    border-color: #cdead6;
}
.refresh-msg--error {
    background: #fcebeb;
    color: #9b2226;
    border-color: #f3cccc;
}

.subhead {
    margin: 1.1rem 0 0.55rem;
    font-size: 0.9rem;
    color: var(--ink-2);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- semáforos ----------------------------------------------------- */
.lights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.light-tile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: #fafbfa;
}
.light-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(0,0,0,.04);
    flex-shrink: 0;
}
.light-ok { background: var(--ok); }
.light-warn { background: var(--warn); }
.light-fail { background: var(--fail); }
.light-label { font-size: 0.85rem; line-height: 1.25; }
.light-label small { display: block; color: var(--ink-2); font-size: 0.72rem; margin-top: 0.1rem; }

/* ---------- key-value grid ----------------------------------------------- */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.4rem 0.9rem;
}
.kv {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.85rem;
}
.kv:last-child { border-bottom: none; }
.kv-k {
    color: var(--ink-2);
    font-weight: 600;
}
.kv-v {
    color: var(--ink);
    word-break: break-word;
}

/* ---------- subcard ------------------------------------------------------ */
.subcard {
    border: 1px solid var(--line);
    background: #fcfdfc;
    border-radius: 0.55rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}
.subcard:last-child { margin-bottom: 0; }
.subcard-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    color: var(--ink);
}
.subcard-head small {
    margin-left: 0.4rem;
    color: var(--ink-2);
    font-weight: 400;
    font-size: 0.78rem;
}

/* ---------- tabelas ------------------------------------------------------ */
.history-wrap, .small-table {
    overflow-x: auto;
}
.history-table, .small-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.history-table th, .small-table th {
    text-align: left;
    background: #f1f5f4;
    color: var(--ink-2);
    font-weight: 600;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.history-table td, .small-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.history-table .row-ok td:nth-child(3) { color: #166534; font-weight: 600; }
.history-table .row-fail td:nth-child(3) { color: #b91c1c; font-weight: 600; }
.history-table td.empty {
    text-align: center;
    color: var(--ink-3);
    padding: 1.2rem;
    font-style: italic;
}

/* ---------- responsivo --------------------------------------------------- */
@media (max-width: 900px) {
    .admin-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 0.1rem; }
    .kv-k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; }
}

/* ============================================================================
   DASHBOARD MULTI-SEÇÃO (admin-app)
   ============================================================================ */

body.admin-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--pli-verde-escuro);
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.sidebar-brand {
    padding: 1.1rem 1rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand strong {
    display: block;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 0.95rem;
}
.sidebar-brand span {
    font-size: 0.72rem;
    color: rgba(255,255,255,.65);
}

.sidebar-nav {
    flex: 1;
    padding: 0.6rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.nav-item {
    text-align: left;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.82);
    padding: 0.55rem 0.75rem;
    border-radius: 0.45rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active {
    background: rgba(255,255,255,.16);
    color: #fff;
    font-weight: 600;
}

.sidebar-foot {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(255,255,255,.12);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.sidebar-link {
    color: rgba(255,255,255,.78);
    font-size: 0.82rem;
    background: none;
    border: none;
    text-align: left;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.sidebar-link:hover { color: #fff; text-decoration: underline; }

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    padding: 0.35rem 0.55rem;
    font-size: 1.1rem;
    cursor: pointer;
}
.header-title h1 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--pli-verde-escuro);
}
.header-title p {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
    color: var(--ink-2);
}
.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.header-actions .who {
    color: var(--ink-2);
    background: var(--code-bg);
    border: 1px solid var(--line);
}
.header-actions .updated-at { color: var(--ink-2); }
.header-actions .btn-secondary {
    background: var(--pli-verde-escuro);
    color: #fff;
    border-color: var(--pli-verde-escuro);
}

.admin-content {
    padding: 16px;
    max-width: none;
    width: 100%;
}

.panel { display: none; }
.panel.active { display: block; }

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    align-items: stretch;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.kpi-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kpi-card small {
    display: block;
    font-size: 0.7rem;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-card strong {
    font-size: 1.35rem;
    line-height: 1.2;
    color: var(--pli-verde-escuro);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-card .kpi-sub {
    font-size: 0.72rem;
    color: var(--ink-3);
    line-height: 1.3;
    min-height: 1.9em;
}
.kpi-card.geo { border-left: 3px solid var(--pli-navy); }
.kpi-card.fire { border-left: 3px solid #f97316; }
.kpi-card.rain { border-left: 3px solid #0ea5e9; }
.kpi-card.data { border-left: 3px solid var(--pli-verde); }
.kpi-card.warn strong { color: var(--fail); }

.bar-chart { margin-top: 0.75rem; }
.bar-row {
    display: grid;
    grid-template-columns: 7rem 1fr 4.5rem;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
}
.bar-label { color: var(--ink-2); }
.bar-track {
    background: #e2e8f0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}
.bar-track i {
    display: block;
    height: 100%;
    border-radius: 5px;
    min-width: 2px;
}
.bar-val { text-align: right; font-weight: 600; }
.bar-val small { font-weight: 400; color: var(--ink-3); }

.chart-area { min-height: 120px; }
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 100px;
    padding: 0.5rem 0;
}
.spark-bar {
    flex: 1;
    min-width: 4px;
    border-radius: 3px 3px 0 0;
    opacity: 0.85;
    transition: opacity 0.12s;
}
.spark-bar:hover { opacity: 1; }
.spark-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--ink-3);
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.report-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.report-icon { font-size: 1.5rem; }
.report-card h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--pli-verde-escuro);
}
.report-card p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--ink-2);
    flex: 1;
}
.report-fmt {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--pli-navy);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.report-dl {
    display: inline-block;
    text-align: center;
    margin-top: 0.35rem;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}
.report-dl:hover { text-decoration: none; opacity: 0.9; }

.empty {
    color: var(--ink-3);
    font-style: italic;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}
.subcard.mt { margin-top: 0.85rem; }
.lights.mt { margin-top: 0.85rem; }

.exec-control {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line, #e2e8f0);
}

.toggle-card {
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}

.toggle-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toggle-sub {
    font-size: 0.78rem;
    color: var(--ink-3, #64748b);
    margin-top: 0.2rem;
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--line, #cbd5e1);
    background: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.65rem 0.35rem 0.4rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.toggle-btn:disabled { opacity: 0.6; cursor: wait; }

.toggle-track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #94a3b8;
    position: relative;
    display: inline-block;
    transition: background 0.2s ease;
}

.toggle-track i {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.toggle-btn.on .toggle-track { background: #16a34a; }
.toggle-btn.on .toggle-track i { transform: translateX(18px); }
.toggle-btn.on .toggle-label { color: #166534; }

.toggle-btn.off .toggle-track { background: #94a3b8; }
.toggle-btn.off .toggle-label { color: #64748b; }

@media (max-width: 960px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.2s;
    }
    .admin-sidebar.open { left: 0; }
    .sidebar-toggle { display: block; }
    .two-col { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; gap: 0.15rem; }
    .bar-val { text-align: left; }
}


/* Sidebar unificada dos sistemas irmãos: menu Reporta + moldura Smart Router */
.admin-sidebar {
    --sidebar-green: #4ade80;
    width: 240px;
    background: linear-gradient(180deg, #003b5a 0%, #002a42 100%);
    border-right: 3px solid var(--sidebar-green);
    box-shadow: 2px 0 12px rgba(0, 59, 90, 0.15);
}
.sidebar-brand {
    min-height: 132px;
    padding: 2rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: inherit;
    text-decoration: none;
    background: linear-gradient(135deg, #003b5a 0%, #002a42 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand:hover { opacity: 0.92; }
.sidebar-brand-pli {
    color: var(--sidebar-green);
    font-family: Poppins, Inter, sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
}
.sidebar-brand-product {
    color: rgba(255, 255, 255, 0.65);
    font-family: Poppins, Inter, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1.2;
    text-transform: uppercase;
}
.sidebar-nav {
    padding: 1.25rem 0.75rem;
    gap: 0.25rem;
}
.nav-item {
    padding: 11px 1rem;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active {
    background: rgba(62, 194, 110, 0.18);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--sidebar-green);
}
.sidebar-foot {
    padding: 1.25rem 0.75rem 1.5rem;
    gap: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-foot form { margin: 0; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 0;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.sidebar-link svg { width: 14px; height: 14px; flex: 0 0 auto; }
.sidebar-link-back { color: rgba(255, 255, 255, 0.55); }
.sidebar-link-back:hover { color: #fff; background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.sidebar-logout { color: rgba(255, 100, 100, 0.75); }
.sidebar-logout:hover { color: #ff8080; background: rgba(255, 100, 100, 0.08); text-decoration: none; }

/* ============================================================================
   PAGINA DE ACESSO — skin padrao do ecossistema PLI (identico nas 3 apps).
   Hierarquia tipografica em Inter, com tokens e classes reutilizaveis:
     titulo principal 24/700 · titulo de secao 20/600 · subsecao 16/600
     rotulos e botoes 14/500 · texto comum 14/400 · texto auxiliar 12/400
   Regra: nenhum filho e maior nem mais pesado que o elemento acima dele;
   botoes e alertas se destacam por cor, fundo e borda, nao por tipografia.
   Medidas em px para nao depender do font-size raiz de cada app.
   ============================================================================ */
body.access-page {
  --t-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-title-size: 24px;      --t-title-weight: 700;
  --t-section-size: 20px;    --t-section-weight: 600;
  --t-subsection-size: 16px; --t-subsection-weight: 600;
  --t-label-size: 14px;      --t-label-weight: 500;
  --t-body-size: 14px;       --t-body-weight: 400;
  --t-aux-size: 12px;        --t-aux-weight: 400;
  --t-ink: #0f172a; --t-ink-2: #1c3d59; --t-muted: #64748b; --t-faint: #94a3b8;
  --t-accent: #116593; --t-green: #3ec26e; --t-green-dark: #2fa854; --t-line: #d7dee6;
  font-family: var(--t-font);
  color: var(--t-ink);
}
body.access-page input,
body.access-page button,
body.access-page a { font-family: var(--t-font); }

/* Classes reutilizaveis (os elementos abaixo sao mapeados a elas). */
body.access-page .t-title,
body.access-page .access-app-name { font-family: var(--t-font); font-size: var(--t-title-size); font-weight: var(--t-title-weight); line-height: 1.2; letter-spacing: -0.3px; }
body.access-page .t-section,
body.access-page header.topbar h1 { font-size: var(--t-section-size); font-weight: var(--t-section-weight); line-height: 1.2; }
body.access-page .t-subsection { font-size: var(--t-subsection-size); font-weight: var(--t-subsection-weight); line-height: 1.3; }
body.access-page .t-label,
body.access-page header.topbar nav a,
body.access-page .access-field-label,
body.access-page .access-btn-submit,
body.access-page .access-btn-register { font-size: var(--t-label-size); font-weight: var(--t-label-weight); line-height: 1.3; }
body.access-page .t-body,
body.access-page .access-context,
body.access-page .access-input-wrap input,
body.access-page .access-feedback { font-size: var(--t-body-size); font-weight: var(--t-body-weight); line-height: 1.5; }
body.access-page .t-aux,
body.access-page .access-app-subtitle,
body.access-page .access-forgot a,
body.access-page .access-back a,
body.access-page .access-divider-text,
body.access-page footer.footer { font-size: var(--t-aux-size); font-weight: var(--t-aux-weight); line-height: 1.4; }

/* Topbar: secao da pagina (20/600) > links de navegacao (14/500). */
body.access-page header.topbar { box-sizing: border-box; height: 70px; min-height: 70px; padding: 8px 24px; gap: 16px; }
body.access-page header.topbar h1 { margin: 0; color: #fff; text-transform: uppercase; letter-spacing: 0.02em; }
body.access-page header.topbar nav { gap: 16px; text-transform: uppercase; letter-spacing: 0.02em; }
body.access-page header.topbar nav a { color: rgba(255, 255, 255, 0.88); }
body.access-page header.topbar nav a:hover,
body.access-page header.topbar nav a[aria-current="page"] { color: #fff; text-decoration: underline; text-underline-offset: 4px; }

/* Card: a marca (24/700) e o titulo principal; tudo abaixo e menor ou mais leve. */
body.access-page .access-main { width: 100%; max-width: 440px; margin: 0 auto; padding: 24px 16px 32px; }
body.access-page .access-login-card { padding: 24px 24px 16px; border-radius: 10px; border-top: 4px solid var(--t-accent); }
body.access-page .access-branding { margin: -24px -24px 24px; padding: 20px 16px; border-radius: 6px 6px 0 0; }
body.access-page .access-brand-head { gap: 8px; }
body.access-page .access-app-icon { width: 26px; height: 26px; }
body.access-page .access-app-name { color: #fff; }
body.access-page .access-app-subtitle { margin-top: 4px; color: rgba(255, 255, 255, 0.72); }
body.access-page .access-context { margin: 0 0 16px; color: var(--t-muted); }
body.access-page .access-field { margin-bottom: 16px; gap: 4px; }
body.access-page .access-field-label { color: var(--t-ink-2); }
body.access-page .access-input-wrap input { min-height: 44px; padding: 8px 36px; color: var(--t-ink); border: 1px solid var(--t-line); border-radius: 6px; }
body.access-page .access-input-wrap input::placeholder { color: var(--t-faint); font-weight: var(--t-body-weight); }
body.access-page .access-feedback { border-radius: 6px; }
body.access-page .access-btn-submit { min-height: 44px; padding: 12px; border: none; border-radius: 6px; color: #fff; background: linear-gradient(135deg, #1c3d59, var(--t-accent)); }
body.access-page .access-forgot { margin-top: 16px; }
body.access-page .access-forgot a { color: var(--t-accent); }
body.access-page .access-divider { margin: 20px 0; }
body.access-page .access-divider-text { color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.06em; }
body.access-page .access-btn-register { min-height: 44px; padding: 10px; border: 2px solid var(--t-green); border-radius: 6px; color: var(--t-green-dark); background: transparent; }
body.access-page .access-btn-register:hover { background: var(--t-green); color: #fff; }
body.access-page .access-back { margin-top: 16px; }
body.access-page .access-back a { color: var(--t-muted); }
body.access-page footer.footer { padding: 16px 24px; color: var(--t-muted); background: #fff; border-top: 1px solid var(--t-line); }

/* ---- Painel administrativo: estrutura fixa das paginas restritas ---- */
/* Marca da sidebar (identidade fixa), na altura padrao de 70px. */
.admin-sidebar { container-type: inline-size; }
.admin-sidebar .sidebar-brand {
    box-sizing: border-box;
    height: 70px;
    min-height: 70px;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    color: #fff;
    text-decoration: none;
    border-bottom: 3px solid var(--pli-verde);
    font-size: clamp(1.05rem, 8cqw, 1.5rem);
}
.admin-sidebar .sidebar-brand-head { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 1em; white-space: nowrap; }
.admin-sidebar .sidebar-brand-icon { flex-shrink: 0; display: inline-flex; width: 1.08em; height: 1.08em; color: var(--pli-verde); line-height: 0; }
.admin-sidebar .sidebar-brand-icon svg { width: 100%; height: 100%; display: block; }
.admin-sidebar .sidebar-brand-name { font-family: "Poppins", "Inter", sans-serif; font-size: 1em; font-weight: 700; letter-spacing: -0.3px; line-height: 1.1; color: #fff; }
.admin-sidebar .sidebar-brand-sub { margin-top: 0.28rem; font-size: 0.49em; font-weight: 500; line-height: 1.2; color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Rodape da sidebar: so o credito. */
.admin-sidebar .sidebar-foot .sidebar-credit { margin: 0; text-align: center; font-size: 10px; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }
/* Cabecalho da pagina: 70px, icone + nome da secao + complemento. */
.admin-header {
    box-sizing: border-box;
    height: 70px;
    min-height: 70px;
    padding: 8px 19px;
    flex-wrap: nowrap;
}
.header-title-row { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1; }
.header-icon { display: inline-flex; flex-shrink: 0; width: 1.35rem; height: 1.35rem; color: var(--pli-accent); }
.header-icon svg { width: 100%; height: 100%; }
.header-title { min-width: 0; }
.header-title h1 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { flex-wrap: nowrap; }
/* Barra de sessao, imediatamente apos o cabecalho (mesmo componente das outras apps). */
.adm-session-bar {
    min-height: 40px;
    padding: 0.35rem 1.2rem;
    background: var(--code-bg);
    color: var(--pli-primary);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.85rem;
}
.adm-session-user { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.adm-session-status { width: 8px; height: 8px; border-radius: 50%; background: var(--pli-verde); flex-shrink: 0; }
.adm-session-username { color: var(--ink-2); }
.adm-session-form { margin: 0; }
.adm-session-logout {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.3rem 0.7rem; border: 1px solid var(--line-2); border-radius: 0.4rem;
    background: #fff; color: var(--pli-primary); font: inherit; font-weight: 600; cursor: pointer;
}
.adm-session-logout:hover { border-color: var(--pli-accent); color: var(--pli-accent); }

/* O icone da marca escala com o nome: sem isto herdava o font-size reduzido da
   regra antiga .sidebar-brand span e ficava em 12px. */
.admin-sidebar .sidebar-brand-head > span { font-size: inherit; }
.admin-sidebar .sidebar-brand-icon { font-size: 1em; }
.admin-sidebar .sidebar-brand-name { font-size: 1em; }

/* Cabecalho e barra de sessao grudados e fixos no topo, fora do scroll. */
.admin-main > .admin-header { position: sticky; top: 0; z-index: 30; }
.admin-main > .adm-session-bar { position: sticky; top: 70px; z-index: 29; margin: 0; }

/* ============================================================================
   SIDEBAR DA AREA RESTRITA — mesmo visual da sidebar de gestao do Smart Router
   (referencia): gradiente navy, borda verde a direita, itens de 14px com barra
   verde quando ativos. Medidas em px (raiz 14px do SR).
   ============================================================================ */
.admin-sidebar {
    --sidebar-green: #4ade80;
    width: 240px;
    background: linear-gradient(180deg, #003b5a 0%, #1c3d59 100%);
    border-right: 3px solid var(--sidebar-green);
    box-shadow: 2px 0 12px rgba(0, 59, 90, 0.15);
}
.admin-sidebar .sidebar-brand {
    padding: 7px 15px;
    border-bottom: 3px solid var(--pli-verde);
    background: linear-gradient(135deg, #003b5a 0%, #1c3d59 100%);
}
.admin-sidebar .sidebar-nav { flex: 1; padding: 17px 10px; display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-sidebar .nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-sidebar .nav-item.active { background: rgba(62, 194, 110, 0.18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--sidebar-green); }
.admin-sidebar .sidebar-foot { padding: 17px 10px 21px; border-top: 1px solid rgba(255, 255, 255, 0.07); gap: 7px; }
.admin-sidebar .sidebar-foot .sidebar-credit { margin: 0; font-size: 10px; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }

/* ============================================================================
   BARRA DE SESSAO — padrao unico do ecossistema (identico nas 3 apps).
   Altura, fonte e cores da barra do HazardTrack; "Sair" no estilo do painel
   de gestao do Reporta (texto sublinhado, sem borda). Medidas em px.
   ============================================================================ */
body .adm-session-bar.adm-session-bar {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0 19px;
  background: #f1f5f9;
  color: #003b5a;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.6px;
  line-height: 1.2;
  box-shadow: none;
}
body .adm-session-bar .adm-session-user { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; font-size: 13.6px; }
body .adm-session-bar .adm-session-user strong { font-size: 13.6px; font-weight: 700; color: #003b5a; overflow: hidden; text-overflow: ellipsis; }
body .adm-session-bar .adm-session-status { width: 8px; height: 8px; border-radius: 50%; background: #3ec26e; box-shadow: 0 0 0 2px rgba(62, 194, 110, 0.18); flex: 0 0 auto; }
body .adm-session-bar .adm-session-username { color: #475569; font-weight: 500; font-size: 13.6px; }
body .adm-session-bar .adm-session-role { padding: 1px 8px; border: 1px solid rgba(62, 194, 110, 0.45); border-radius: 999px; color: #2fa854; background: #e5f6ec; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; flex: 0 0 auto; }
body .adm-session-bar .adm-session-form { margin: 0; }
body .adm-session-bar .adm-session-logout.adm-session-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #1c3d59;
  font: inherit;
  font-size: 13.6px;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
body .adm-session-bar .adm-session-logout.adm-session-logout svg { width: 14px; height: 14px; }
body .adm-session-bar .adm-session-logout.adm-session-logout:hover { color: #2fa854; background: none; border: none; }

/* ============================================================================
   MARCA NAS SIDEBARS — layout em grade: icone a esquerda ocupando a altura das
   duas linhas; nome e complemento em coluna, alinhados a esquerda e comecando
   no mesmo ponto (referencia: logo do SICARD). O cabecalho da marca vira
   display: contents para que icone, nome e complemento entrem na mesma grade.
   ============================================================================ */

.admin-sidebar .sidebar-brand {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.45em;
    row-gap: 0.1em;
    align-items: center;
    align-content: center;
    justify-content: start;
    text-align: left;
}
.admin-sidebar .sidebar-brand-head { display: contents; }
.admin-sidebar .sidebar-brand-icon { grid-column: 1; grid-row: 1 / span 2; width: 1.8em; height: 1.8em; align-self: center; }
.admin-sidebar .sidebar-brand-name { grid-column: 2; grid-row: 1; align-self: end; }
.admin-sidebar .sidebar-brand-sub { grid-column: 2; grid-row: 2; align-self: start; margin: 0; text-align: left; }

.admin-sidebar .sidebar-brand { column-gap: 0.35em; }
.admin-sidebar .sidebar-brand-icon { width: 1.6em; height: 1.6em; }

.admin-sidebar .sidebar-brand-icon { width: auto; height: 100%; aspect-ratio: 1 / 1; align-self: stretch; }

.admin-sidebar .sidebar-brand-icon { width: 1.79em; height: 1.79em; aspect-ratio: auto; align-self: center; }

/* Login: topbar so com a navegacao (sem titulo), alinhada a direita e um pouco menor. */
body.access-page header.topbar { justify-content: flex-end; }
body.access-page header.topbar nav a { font-size: 13px; font-weight: 500; }

/* Barra de sessao: fonte de 12px, sempre abaixo do titulo (>=18px) e do complemento (13px) do cabecalho. */
body .adm-session-bar.adm-session-bar { font-size: 12px; }
body .adm-session-bar .adm-session-user,
body .adm-session-bar .adm-session-user strong,
body .adm-session-bar .adm-session-username,
body .adm-session-bar .adm-session-logout.adm-session-logout { font-size: 12px; }
body .adm-session-bar .adm-session-role { font-size: 10px; }

/* ============================================================================
   TIPOGRAFIA DAS SIDEBARS RESTRITAS — padrao unico das 3 apps (Inter, px):
   item 14/500 #fff · sub-item 12/500 rgba(255,255,255,.78) · grupo 10/700
   maiusculo rgba(255,255,255,.45) · credito 10/400 rgba(255,255,255,.55).
   ============================================================================ */
.admin-sidebar { font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
.admin-sidebar .nav-item { font-family: inherit; font-size: 14px; font-weight: 500; color: #fff; line-height: 1.3; }
.admin-sidebar .nav-item.active { color: #fff; font-weight: 600; }
.admin-sidebar .nav-subitem { font-family: inherit; font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, 0.78); line-height: 1.35; }
.admin-sidebar .nav-subitem.active { color: #fff; font-weight: 600; }
.admin-sidebar .nav-group-label { font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); }
.admin-sidebar .sidebar-credit { font-family: inherit; font-size: 10px; font-weight: 400; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }

/* Topbar do login: mesma fonte dos menus do cabecalho da home do PLI Reporta
   (fonte do sistema, 13px, 600, maiusculas, espacamento 0.04em). */
body.access-page header.topbar nav a { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ============================================================================
   PAINEL v2 — grade simétrica, gráficos SVG, matrizes e componentes novos
   ============================================================================ */
.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.toolbar-label { font-size: 0.8rem; color: var(--ink-2); font-weight: 600; }
.range-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.range-seg button {
    border: none;
    background: #fff;
    color: var(--ink-2);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    border-right: 1px solid var(--line);
}
.range-seg button:last-child { border-right: none; }
.range-seg button:hover { background: var(--code-bg); }
.range-seg button.active { background: var(--pli-primary); color: #fff; }

/* Key-value: colunas fixas por card (sem auto-fit irregular) */
.kv-grid { grid-template-columns: 1fr; gap: 0 16px; }
.kv-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv { grid-template-columns: minmax(9rem, 11rem) 1fr; padding: 5px 0; font-size: 0.8rem; gap: 8px; }
.kv-grid--2 .kv:nth-last-child(-n+2), .kv-grid--3 .kv:nth-last-child(-n+3) { border-bottom: none; }
.kv-section { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 0.85rem; }
.kv-section > b { display: block; margin-bottom: 4px; }
.muted { color: var(--ink-3); font-size: 0.8rem; }

/* Semaforos: sempre 2 x 2 dentro do card */
.lights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.light-tile { padding: 9px 12px; }

/* Graficos */
.chart-box { min-height: 200px; }
.chart-box--sm { min-height: 150px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-text { font-size: 10px; fill: var(--ink-3); }
.chart-svg .hover-col:hover { fill: rgba(0, 59, 90, 0.06); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.72rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--ink-2);
}
.stat-strip--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-strip--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-strip span { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strip i { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.stat-strip b { color: var(--ink); }
.stat-strip em { font-style: normal; font-weight: 600; }
.stat-strip em.up { color: var(--fail); }
.stat-strip em.down { color: var(--ok); }
#chart-ops .stat-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 12px; }

.hist-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hist-box h3 { margin: 0 0 4px; font-size: 0.8rem; color: var(--ink-2); font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.hist-box h3 small { font-weight: 400; color: var(--ink-3); }

/* Barras vs limiares */
.thr-list { display: flex; flex-direction: column; gap: 14px; }
.thr-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 18px; font-size: 0.82rem; }
.thr-head small { color: var(--ink-3); }
.thr-val { margin-left: auto; font-weight: 700; color: var(--c); white-space: nowrap; }
.thr-val em { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 6px; font-size: 0.72rem; }
.thr-track { position: relative; height: 12px; background: var(--line); border-radius: 6px; }
.thr-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.thr-mark { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--c); transform: translateX(-1px); }
.thr-mark b { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 0.66rem; font-weight: 600; color: var(--c); white-space: nowrap; }

/* Matrizes regiao x nivel */
.table-wrap { overflow-x: auto; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.matrix-table th, .matrix-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.matrix-table th { background: #f1f5f4; color: var(--ink-2); font-weight: 600; }
.matrix-table th .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 5px; vertical-align: middle; }
.matrix-table .num, .small-table .num, .history-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix-table td.lvl { color: var(--ink-3); }
.matrix-table td.lvl.hot { color: var(--c); font-weight: 700; }
.matrix-table tr.group-start td { border-top: 1px solid var(--line-2); }
.matrix-table .region-cell { font-weight: 600; vertical-align: middle; }
.matrix-table .region-cell small, .region-cell small { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.68rem; }
.small-table th, .small-table td { white-space: nowrap; }
.small-table td.num { font-variant-numeric: tabular-nums; }
.history-table td.outcome { font-weight: 600; }
.history-table .row-ok td.outcome { color: #166534; }
.history-table .row-fail td.outcome { color: #b91c1c; }
.history-table .row-ok td:nth-child(3), .history-table .row-fail td:nth-child(3) { color: inherit; font-weight: 600; }

.cls-chip { display: inline-block; min-width: 1.6em; padding: 1px 7px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; color: #fff; background: var(--c); text-align: center; }
.lvl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 6px; font-size: 0.7rem; background: color-mix(in srgb, var(--c) 18%, #fff); color: var(--ink); }
.trail { display: block; }

/* Relatorios: 4 colunas fixas */
.report-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.report-card { padding: 14px 16px; }

/* Barras simples (visao geral) */
.bar-chart { margin-top: 10px; }
.bar-row { grid-template-columns: 7.5rem 1fr 5rem; margin-bottom: 6px; font-size: 0.78rem; }

.exec-control { margin-top: 12px; padding-top: 12px; }
.toggle-card { margin-bottom: 12px; }
.subcard { margin-bottom: 12px; }
details summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--pli-primary); }

@media (max-width: 1400px) {
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
    .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #chart-ops .stat-strip, .stat-strip--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kv-grid--2, .kv-grid--3 { grid-template-columns: 1fr; }
    .hist-pair { grid-template-columns: 1fr; }
    .stat-strip, .stat-strip--3 { grid-template-columns: 1fr; }
    .card-note { display: none; }
}

/* Ajustes v2.1: tabelas densas e faixas de 5 itens */
.stat-strip--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.matrix-table--dense { font-size: 0.74rem; }
.matrix-table--dense th, .matrix-table--dense td { padding: 4px 6px; }
.small-table--dense { font-size: 0.76rem; }
.small-table--dense th, .small-table--dense td { padding: 4px 6px; }
.chart-stack { display: flex; flex-direction: column; gap: 10px; }
.chart-stack h3 { margin: 0 0 2px; font-size: 0.78rem; color: var(--ink-2); font-weight: 600; }
.card-head .btn-refresh-now { flex: 0 0 auto; }
@media (max-width: 1200px) {
    .stat-strip--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.stat-strip span { display: block; }
.stat-strip span i { display: inline-block; vertical-align: middle; margin-right: 6px; }

/* Titulos didaticos: permitem quebra em 2 linhas */
.card-head h2 { white-space: normal; line-height: 1.25; }
.card-note { max-width: 40%; }
