:root {
    --bg-dark: #020617;
    --card-bg: #0f172a;
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.3);
    --accent: #10b981;
    --error: #f43f5e;
    --warn: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-w: 270px;
    --glass: rgba(15, 23, 42, 0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }

body.dark-mode {
    background: radial-gradient(circle at top right, #0f172a 0%, #020617 100%);
    color: var(--text-main);
    overflow-x: hidden;
}

.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--glass); backdrop-filter: blur(12px);
    border-right: 1px solid var(--card-border); display: flex; flex-direction: column;
    padding: 2rem 1rem; position: fixed; height: 100vh; z-index: 100;
    overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.logo {
    display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 700;
    margin-bottom: 2.5rem; background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    white-space: nowrap; letter-spacing: -0.2px;
}
.logo img { width: 30px !important; height: 30px !important; filter: drop-shadow(0 0 10px var(--primary-glow)); }

nav { display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.nav-item {
    background: transparent; border: none; color: var(--text-muted); padding: 1.15rem 1.25rem;
    border-radius: 16px; display: flex; align-items: center; gap: 1.25rem; font-size: 1rem;
    font-weight: 500; cursor: pointer; transition: all 0.4s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-main); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.1));
    color: var(--primary); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.bot-status { padding-top: 0.75rem; border-top: 1px solid var(--card-border); margin-top: auto; }
.status-indicator { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--error); box-shadow: 0 0 10px var(--error); }
.connected .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.logout-container { padding-top: 0.75rem; margin-top: 0.5rem; }
.logout-btn {
    width: 100%; background: rgba(244, 63, 94, 0.05); color: var(--error); 
    border: 1px solid rgba(244, 63, 94, 0.1); padding: 0.7rem 1rem; border-radius: 12px; 
    display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; font-weight: 600; 
    cursor: pointer; transition: all 0.3s ease;
}
.logout-btn:hover { background: var(--error); color: white; transform: translateY(-2px); box-shadow: 0 10px 20px rgba(244, 63, 94, 0.3); }

.content { margin-left: var(--sidebar-w); padding: 1.5rem 2.5rem; width: 100%; }
header { margin-bottom: 1.5rem; }
header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 0.25rem; }
header p { font-size: 0.9rem; color: var(--text-muted); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: slideUpFade 0.4s ease; }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Stats - Mais compactos */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card { background: var(--card-bg); border-radius: 20px; padding: 1.25rem; border: 1px solid var(--card-border); transition: all 0.3s ease; }
.stat-card { display: flex; align-items: center; gap: 1rem; }
.stat-card i { font-size: 1.5rem; background: rgba(255, 255, 255, 0.03); padding: 0.75rem; border-radius: 12px; border: 1px solid var(--card-border); }
.color-whatsapp { color: #10b981; } .color-panels { color: #38bdf8; }
.stat-label { text-transform: uppercase; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.2rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; }

.terminal-container {
    background: #020617; border-radius: 18px; padding: 1.75rem; font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem; height: 400px; overflow-y: auto; border: 1px solid rgba(255,255,255,0.05);
}
.log-line { margin-bottom: 0.75rem; padding: 0.5rem 1rem; border-radius: 8px; border-left: 3px solid transparent; }
.log-line.success { border-left-color: var(--accent); } .log-line.error { border-left-color: var(--error); }

/* Panel Grid & Cards Premium */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; }
.panel-card {
    background: var(--card-bg); border-radius: 28px; padding: 2.25rem !important; border: 1px solid var(--card-border);
    display: flex; flex-direction: column; gap: 1.5rem; position: relative; transition: all 0.3s ease;
}
.panel-header-top { display: flex; justify-content: space-between; align-items: center; }
.panel-icon-box {
    width: 60px; height: 60px; background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.1));
    color: var(--primary); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.75rem;
    border: 1px solid rgba(56, 189, 248, 0.1);
}
.panel-tag { background: rgba(56, 189, 248, 0.1); color: var(--primary); padding: 0.4rem 1rem; border-radius: 12px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.panel-title { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.panel-url { font-size: 0.85rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; opacity: 0.7; }
.panel-creds { background: rgba(2, 6, 23, 0.4); padding: 1.5rem; border-radius: 20px; font-size: 0.85rem; color: var(--text-muted); border: 1px solid var(--card-border); }
.panel-creds strong { color: var(--primary); }

.icon-btn {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); color: var(--text-muted);
    width: 44px; height: 44px; border-radius: 14px; cursor: pointer; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.icon-btn:hover { background: var(--primary); color: var(--bg-dark); transform: translateY(-2px); box-shadow: 0 10px 20px var(--primary-glow); }
.icon-btn.delete:hover { background: var(--error); color: white; box-shadow: 0 10px 20px rgba(244, 63, 94, 0.3); }

.add-panel-card {
    background: transparent; border: 2px dashed rgba(255, 255, 255, 0.1); border-radius: 28px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
    cursor: pointer; min-height: 250px; transition: all 0.3s ease; color: var(--text-muted);
}
.add-panel-card:hover { border-color: var(--primary); color: var(--primary); background: rgba(56, 189, 248, 0.02); }
.add-panel-card i { font-size: 3rem; }

/* Modals - Compacto */
.modal {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px); z-index: 2000; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal.active { display: flex; }
.modal-content { 
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 28px; 
    padding: 2rem; width: 100%; max-width: 550px; position: relative; animation: slideUpModal 0.5s ease; 
}
.modal-content h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 600; }
.input-group input { 
    width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--card-border); 
    padding: 0.8rem 1rem; border-radius: 12px; color: white; outline: none; transition: 0.3s;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 15px var(--primary-glow); }

.modal-actions { display: flex; gap: 1rem; margin-top: 1.75rem; }
.btn { flex: 1; padding: 0.9rem; border-radius: 12px; border: none; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn.primary { background: var(--primary); color: var(--bg-dark); }
.btn.secondary { background: rgba(255,255,255,0.05); color: white; }

/* Dashboard Table - Ultra Compacta (Refinada para Nomes) */
table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
th { text-align: left; padding: 0.5rem 1rem; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
td { 
    background: rgba(255,255,255,0.012); padding: 0.5rem 1rem; 
    border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem; vertical-align: middle;
}
td:first-child { border-left: 1px solid var(--card-border); border-top-left-radius: 12px; border-bottom-left-radius: 12px; width: 80px; }
td:last-child { border-right: 1px solid var(--card-border); border-top-right-radius: 12px; border-bottom-right-radius: 12px; width: 70px; text-align: center; }

/* Column Widths Refined */
.col-hora { width: 90px; }
.col-contato { width: auto; font-weight: 500; color: var(--text-main); }
.col-servidor { width: 110px; }
.col-status { width: 110px; }
.col-recibo { width: 70px; text-align: center; }

.status-badge { padding: 0.3rem 0.7rem; border-radius: 8px; font-size: 0.7rem; font-weight: 700; display: inline-block; }
.status-badge.sucesso { background: rgba(16, 185, 129, 0.1); color: var(--accent); }
.status-badge.erro { background: rgba(244, 63, 94, 0.1); color: var(--error); }
.status-badge.aviso { background: rgba(245, 158, 11, 0.1); color: var(--warn); }

.receipt-link { 
    background: rgba(56, 189, 248, 0.08); color: var(--primary); width: 34px; height: 34px;
    border-radius: 8px; border: 1px solid rgba(56, 189, 248, 0.15); cursor: pointer; 
    transition: all 0.3s ease; display: inline-flex; align-items: center; justify-content: center;
}
.receipt-link:hover { background: var(--primary); color: var(--bg-dark); transform: scale(1.1); }

/* Login Page Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #0f172a 0%, #020617 100%);
    color: var(--text-main);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.6s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 1rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-form .input-group {
    margin-bottom: 1.5rem;
}

.login-form .input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.input-wrapper {
    position: relative;
}

.login-form input {
    padding-left: 3rem !important;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    border: none;
    background: var(--primary);
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--primary-glow);
    filter: brightness(1.1);
}

.login-error {
    color: var(--error);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    display: none;
}

