/* ==========================================================================
   INFINITYLINK NOC — ARQUITETURA VISUAL 4 PILARES (Desktop + Mobile-First)
   Pilares: Kokonut UI + Bklit UI + Motion.dev + Anime.js
   Purple Ban Ativo: Zero roxo/violeta.
   Suporte Nativo: Modo Escuro NOC (data-theme="dark") e Modo Claro (data-theme="light")
   ========================================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root,
html[data-theme="dark"] {
    --bg-primary: #070A12;
    --bg-secondary: #0D1322;
    --bg-card: #121A2D;
    --bg-card-elevated: #172138;
    --bg-header: rgba(7, 10, 18, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --emerald: #10B981;
    --emerald-soft: rgba(16, 185, 129, 0.14);
    --emerald-border: rgba(16, 185, 129, 0.32);
    --cyan: #06B6D4;
    --cyan-soft: rgba(6, 182, 212, 0.14);
    --cyan-border: rgba(6, 182, 212, 0.34);
    --blue: #3B82F6;
    --amber: #F59E0B;
    --amber-soft: rgba(245, 158, 11, 0.14);
    --amber-border: rgba(245, 158, 11, 0.34);
    --red: #EF4444;
    --red-soft: rgba(239, 68, 68, 0.15);
    --red-border: rgba(239, 68, 68, 0.38);
    --track-bg: rgba(255, 255, 255, 0.08);
    --spotlight-color: rgba(6, 182, 212, 0.11);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --spring-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme="light"] {
    --bg-primary: #F1F5F9;
    --bg-secondary: #E2E8F0;
    --bg-card: #FFFFFF;
    --bg-card-elevated: #F8FAFC;
    --bg-header: rgba(255, 255, 255, 0.88);
    --border-subtle: rgba(15, 23, 42, 0.09);
    --border-strong: rgba(15, 23, 42, 0.18);
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --emerald: #059669;
    --emerald-soft: rgba(5, 150, 105, 0.12);
    --emerald-border: rgba(5, 150, 105, 0.3);
    --cyan: #0284C7;
    --cyan-soft: rgba(2, 132, 199, 0.12);
    --cyan-border: rgba(2, 132, 199, 0.3);
    --blue: #2563EB;
    --amber: #D97706;
    --amber-soft: rgba(217, 119, 6, 0.12);
    --amber-border: rgba(217, 119, 6, 0.3);
    --red: #DC2626;
    --red-soft: rgba(220, 38, 38, 0.12);
    --red-border: rgba(220, 38, 38, 0.32);
    --track-bg: rgba(15, 23, 42, 0.08);
    --spotlight-color: rgba(2, 132, 199, 0.08);
    --shadow-card: 0 8px 24px -8px rgba(15, 23, 42, 0.08);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.35s var(--spring-ease), color 0.35s var(--spring-ease);
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Luzes sutis de fundo no NOC */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 15%, var(--cyan-soft) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 10%, var(--emerald-soft) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.7;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.noc-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--cyan-border);
    box-shadow: var(--shadow-card);
    font-size: 13px;
    font-weight: 600;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--spring-bounce), opacity 0.3s ease;
}

.noc-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   HEADER / COMMAND BAR (Kokonut UI)
   ========================================================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.35s var(--spring-ease), border-color 0.35s var(--spring-ease);
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--emerald-soft);
    border: 1px solid var(--emerald-border);
    color: var(--emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-pulse {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 0 0 var(--emerald);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.noc-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--cyan-soft);
    color: var(--cyan);
    border: 1px solid var(--cyan-border);
    letter-spacing: 0.04em;
}

.badge-demo {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--amber-soft);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
}

.update-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    flex-shrink: 0;
}

.btn-action {
    min-height: 42px;
    padding: 0 15px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s var(--spring-bounce), border-color 0.2s ease, background-color 0.2s ease;
}

.btn-action:active {
    transform: scale(0.96);
}

.btn-collect {
    background: var(--cyan-soft);
    color: var(--cyan);
    border: 1px solid var(--cyan-border);
}

.btn-collect:hover {
    background: var(--cyan);
    color: #FFFFFF;
}

.btn-collect.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-theme {
    background: var(--bg-card-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-theme:hover {
    border-color: var(--border-strong);
}

/* ==========================================================================
   MAIN CONTAINER & BENTO KPI GRID (Bklit UI)
   ========================================================================== */
.main-container {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

.bento-kpi-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr 1.25fr;
    gap: 14px;
    margin-bottom: 18px;
}

.bento-kpi-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    transition: transform 0.28s var(--spring-ease), border-color 0.25s ease, background-color 0.35s ease;
}

.bento-kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--cyan-border);
}

.spotlight-layer {
    pointer-events: none;
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), var(--spotlight-color), transparent 70%);
}

.bento-kpi-card:hover .spotlight-layer,
.school-card:hover .spotlight-layer {
    opacity: 1;
}

.kpi-availability {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ring-wrapper {
    position: relative;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.uptime-ring {
    width: 62px;
    height: 62px;
    transform: rotate(-90deg);
}

.ring-track {
    fill: none;
    stroke: var(--track-bg);
    stroke-width: 4.2;
}

.ring-fill {
    fill: none;
    stroke: var(--emerald);
    stroke-width: 4.2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.9s var(--spring-ease), stroke 0.3s ease;
}

.ring-value {
    position: absolute;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.kpi-badge-cyan {
    background: var(--cyan-soft);
    color: var(--cyan);
}

.kpi-badge-emerald {
    background: var(--emerald-soft);
    color: var(--emerald);
}

.kpi-primary-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.kpi-big {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary);
}

.kpi-divider {
    color: var(--text-muted);
    margin: 0 2px;
    font-weight: 500;
}

.kpi-unit {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.kpi-subtext {
    font-size: 12px;
    font-weight: 600;
    color: var(--emerald);
}

.kpi-mini-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--track-bg);
    overflow: hidden;
    margin-top: 10px;
}

.kpi-mini-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.8s var(--spring-ease);
}

.fill-cyan { background: var(--cyan); }
.fill-emerald { background: var(--emerald); }

.kpi-split-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.split-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.split-stat-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.split-stat-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.split-stat-sep {
    width: 1px;
    height: 28px;
    background: var(--border-subtle);
}

.text-danger { color: var(--red) !important; }
.text-amber { color: var(--amber) !important; }
.text-emerald { color: var(--emerald) !important; }

/* ==========================================================================
   FILTER PILLS BAR (Swipeable on Mobile)
   ========================================================================== */
.filter-bar-section {
    margin-bottom: 18px;
}

.filter-pills-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-pills-scroll::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.22s var(--spring-ease);
}

.filter-pill:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--cyan-soft);
    color: var(--cyan);
    border-color: var(--cyan-border);
}

.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-online { background: var(--emerald); }
.dot-issue { background: var(--red); }

/* ==========================================================================
   SCHOOL CARDS BENTO GRID
   ========================================================================== */
.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(410px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.school-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-card);
    transition: transform 0.28s var(--spring-ease), border-color 0.25s ease, background-color 0.35s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.school-card:hover {
    transform: translateY(-3px);
    border-color: var(--school-color, var(--cyan));
}

.school-card.card-has-issue {
    border-color: var(--red-border);
}

.school-card-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.school-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.school-color-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

.school-title-block h3 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
}

.school-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.school-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.school-status.online {
    background: var(--emerald-soft);
    color: var(--emerald);
    border: 1px solid var(--emerald-border);
}

.school-status.partial {
    background: var(--amber-soft);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

.school-status.offline {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.status-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* ==========================================================================
   DUAL-WAN LINK TELEMETRY BLOCKS (Bklit UI Gauges)
   ========================================================================== */
.school-links {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-telemetry-card {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color 0.2s ease, background-color 0.35s ease;
}

.link-telemetry-card.link-is-offline {
    border-color: var(--red-border);
    background: var(--red-soft);
}

.link-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.link-provider {
    display: flex;
    align-items: center;
    gap: 8px;
}

.provider-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.provider-dot.online {
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
}

.provider-dot.offline {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

.link-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}

.link-ip-badge {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}

.link-ping-pill {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.link-gauges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.gauge-box {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gauge-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 12px;
}

.gauge-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.gauge-value {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}

.gauge-unit {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.gauge-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--track-bg);
    overflow: hidden;
}

.gauge-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.85s var(--spring-ease);
}

.gauge-bar.down-bar {
    background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.gauge-bar.up-bar {
    background: var(--emerald);
}

.offline-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.14);
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
}

.school-card-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==========================================================================
   BOTTOM BENTO PANELS: HISTORY & ALERTS
   ========================================================================== */
.bottom-bento-layout {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 16px;
}

.bento-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.panel-title-group h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-controls {
    display: flex;
    gap: 6px;
}

.chart-btn {
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-btn.active,
.chart-btn:hover {
    background: var(--cyan-soft);
    color: var(--cyan);
    border-color: var(--cyan-border);
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.hist-snapshot {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hist-snapshot.hist-current {
    border-color: var(--cyan-border);
}

.hist-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.hist-time-hour {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--cyan);
}

.hist-time-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.hist-schools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
}

.hist-school {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.hist-school-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.hist-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.hist-links-header,
.hist-link {
    display: grid;
    grid-template-columns: 16px 1fr 38px 46px 46px;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.hist-links-header {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 3px;
}

.hist-link {
    padding: 2px 0;
    font-family: 'JetBrains Mono', monospace;
}

.hist-link-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hist-metric.dl { color: var(--cyan); font-weight: 700; text-align: right; }
.hist-metric.ul { color: var(--emerald); font-weight: 700; text-align: right; }
.hist-metric.lat { color: var(--text-secondary); text-align: right; }
.hist-metric.off { grid-column: span 3; color: var(--red); font-weight: 700; text-align: right; }

/* ALERTS LIST */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 12px;
}

.alert-item.link_down {
    border-left: 3px solid var(--red);
}

.alert-item.link_up {
    border-left: 3px solid var(--emerald);
}

.alert-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.alert-message {
    color: var(--text-primary);
    line-height: 1.4;
}

.no-alerts {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 20px 0;
    text-align: center;
}

/* LOADING PLACEHOLDER */
.loading-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-secondary);
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   RESPONSIVIDADE MOBILE-FIRST (TABLET & SMARTPHONE ERGONOMICS)
   Alvos de toque >= 44px, Grade KPI 2x2, Operadoras Empilhadas
   ========================================================================== */
@media (max-width: 1100px) {
    .bento-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bottom-bento-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .brand-text h1 {
        font-size: 16px;
    }

    .subtitle {
        display: none;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .last-update {
        padding: 6px 10px;
        font-size: 11px;
        flex: 1;
    }

    /* Lei de Fitts: Alvos de toque confortáveis no polegar (>= 44px) */
    .btn-action {
        min-height: 44px;
        padding: 0 14px;
        font-size: 12px;
    }

    .main-container {
        padding: 14px 12px 32px;
    }

    /* Grade 2x2 Compacta na Primeira Dobra do Celular */
    .bento-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }

    .bento-kpi-card {
        padding: 12px;
        border-radius: 14px;
    }

    .kpi-availability {
        grid-column: span 2;
    }

    .kpi-big {
        font-size: 21px;
    }

    .filter-pill {
        min-height: 42px;
        padding: 0 14px;
        font-size: 12px;
    }

    /* Cartões de Escolas 100% Largura no Celular */
    .schools-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .school-card {
        padding: 14px;
        border-radius: 16px;
    }

    .link-top-bar {
        flex-wrap: wrap;
    }

    .hist-schools {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .theme-label-text {
        display: none;
    }
    .btn-theme {
        min-width: 44px;
        padding: 0;
    }
}
