:root {
    --bg-dark: #0f172a; --bg-card: #1e293b; --bg-input: #334155;
    --text-main: #f8fafc; --text-muted: #94a3b8;
    --primary: #3b82f6; --primary-hover: #2563eb;
    --success: #10b981; --danger: #ef4444; --warning-bg: rgba(239, 68, 68, 0.15);
    --glass-bg: rgba(30, 41, 59, 0.75); --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body {
    background-color: var(--bg-dark); color: var(--text-main);
    background-image: radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed; min-height: 100vh;
}
.glass-panel { background: var(--glass-bg); backdrop-filter: blur(16px); border: var(--glass-border); }
.dashboard-hidden { display: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* LOGIN */
.login-container { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--bg-dark); }
.login-card { padding: 3rem; width: 100%; max-width: 420px; border-radius: 24px; text-align: center; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.logo-circle { width: 64px; height: 64px; margin: 0 auto 1.5rem; background: rgba(59, 130, 246, 0.1); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.input-group { margin-bottom: 1.5rem; text-align: left; }
.input-group label { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; font-weight: 500; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 12px; width: 18px; color: var(--text-muted); }
input, textarea, select { width: 100%; padding: 12px 16px 12px 42px; background: var(--bg-input); border: 1px solid transparent; border-radius: 12px; color: white; outline: none; transition: 0.3s; font-size: 0.95rem; }
textarea { padding-left: 16px; resize: vertical; }
select { padding-left: 16px; 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='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em; }
input:focus, textarea:focus, select:focus { background: #475569; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }
.btn-primary { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }
.error-msg { color: var(--danger); font-size: 0.9rem; margin-top: 1rem; }

/* HEADER & TABS */
.app-header { position: sticky; top: 20px; margin: 0 20px; padding: 0.8rem 2rem; border-radius: 20px; display: flex; justify-content: space-between; align-items: center; z-index: 100; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { background: var(--primary); color: white; padding: 8px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.brand-text h1 { font-size: 1.1rem; font-weight: 700; }
.brand-text span { color: var(--primary); }
.live-indicator { font-size: 0.75rem; color: var(--success); font-weight: 600; text-transform: uppercase; }
.nav-tabs { display: flex; gap: 10px; background: rgba(0,0,0,0.2); padding: 5px; border-radius: 12px; }
.tab-btn { background: transparent; border: none; color: var(--text-muted); padding: 8px 16px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 500; transition: 0.3s; }
.tab-btn.active { background: var(--bg-input); color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.tab-btn:hover:not(.active) { color: white; background: rgba(255,255,255,0.05); }
.btn-logout { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; transition: 0.2s; }
.btn-logout:hover { color: var(--danger); transform: scale(1.1); }

/* CONTENT & GRID */
.view-section { display: none; animation: fadeIn 0.4s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.content-wrapper { max-width: 1400px; margin: 2rem auto; padding: 0 20px 100px; }
.section-title { margin-bottom: 2rem; }
.section-title h2 { font-size: 2rem; font-weight: 700; }
.section-title p { color: var(--text-muted); font-size: 1.1rem; }
.bento-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; }
.city-card { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05); border-radius: 20px; padding: 1.5rem; transition: 0.3s; position: relative; overflow: hidden; }
.city-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.1); }
.city-card.maintenance { background: linear-gradient(145deg, var(--warning-bg), var(--bg-card)); border-color: rgba(239, 68, 68, 0.3); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.city-card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 4px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.status-ok { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-bad { background: rgba(239, 68, 68, 0.15); color: var(--danger); animation: pulse 2s infinite; }
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #475569; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--danger); }
input:checked + .slider:before { transform: translateX(24px); }
.notification-area label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.notification-area textarea { min-height: 80px; width: 100%; }

/* BROADCAST & PROGRESSO */
.broadcast-panel { padding: 2rem; border-radius: 20px; margin-bottom: 2rem; }
.broadcast-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.stats-info span { background: rgba(255,255,255,0.1); padding: 6px 12px; border-radius: 8px; font-size: 0.9rem; color: var(--text-main); }

/* Barra de Progresso */
.progress-container { margin-top: 20px; background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.progress-track { width: 100%; height: 10px; background: #334155; border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.5s ease; box-shadow: 0 0 10px rgba(16,185,129,0.5); }

/* TABELA & HEADER */
.clients-list-container { padding: 1.5rem; border-radius: 20px; }
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 15px; }
.header-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.custom-filter { background: var(--bg-input); border: 1px solid rgba(255,255,255,0.1); color: white; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; min-width: 160px; width: auto !important; }
.custom-filter:focus { border-color: var(--primary); outline: none; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.btn-refresh { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); padding: 8px 16px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.btn-refresh:hover { background: rgba(255,255,255,0.05); color: white; }
.btn-delete { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); padding: 8px 16px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 600; transition: 0.2s; }
.btn-delete:hover { background: var(--danger); color: white; border-color: var(--danger); }
.table-responsive { overflow-x: auto; }
.clients-table { width: 100%; border-collapse: collapse; }
.clients-table th { text-align: left; padding: 12px; color: var(--text-muted); border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; font-weight: 500; }
.clients-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--text-main); font-size: 0.9rem; }
.clients-table tr:hover td { background: rgba(255,255,255,0.02); }
input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; width: 16px; height: 16px; }
.badge-status { padding: 4px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.badge-status.sent { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-status.pending { background: rgba(234, 179, 8, 0.15); color: #facc15; }

/* DOCK */
.action-dock { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); padding: 10px 10px 10px 24px; border-radius: 20px; display: flex; align-items: center; gap: 24px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); z-index: 200; }
.dock-info { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; }
.btn-save { background: var(--primary); color: white; border: none; padding: 12px 24px; border-radius: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.btn-save:hover { background: var(--primary-hover); transform: scale(1.02); }
.btn-save:disabled { background: #475569; cursor: not-allowed; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }
    .nav-tabs span { display: none; }
    .broadcast-actions { flex-direction: column; gap: 10px; align-items: stretch; }
    .list-header { flex-direction: column; align-items: stretch; }
    .header-filters, .header-actions { flex-direction: column; width: 100%; }
    .custom-filter, .btn-refresh, .btn-delete { width: 100%; justify-content: center; }
    .action-dock { width: 90%; justify-content: space-between; }
    .dock-info span { display: none; }
}