:root {
    --primary: #b91c1c;
    --primary-light: #dc2626;
    --primary-dark: #7f1d1d;
    --primary-hover: #991b1b;
    --primary-subtle: #fef2f2;
    --primary-border: #fecaca;
    --secondary: #991b1b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* ------------------- OVERLAY DE LOGIN ------------------- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, #7f1d1d, #180505);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 1.5rem;
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.login-logo {
    max-width: 110px;
    height: auto;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}

.login-server-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
}

.btn-primary-large {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary-large:hover {
    background: var(--primary-light);
}

.btn-primary-large:active {
    transform: scale(0.99);
}

/* ------------------- LAYOUT GERAL DO PORTAL ------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ------------------- SIDEBAR ------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: #180505;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 8px;
    padding: 4px;
}

.brand-text h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-text p {
    font-size: 0.75rem;
    color: #94a3b8;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.5rem 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: transparent;
    color: #94a3b8;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: all 0.2s;
}

.nav-item .nav-icon {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.server-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #fca5a5;
    background: rgba(185, 28, 28, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

/* ------------------- MAIN CONTENT ------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ------------------- TOPBAR ------------------- */
.topbar {
    height: 72px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-left .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fee2e2;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    background: #fee2e2;
    color: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #fecaca;
}

/* ------------------- TAB CONTENT ------------------- */
.tab-pane {
    display: none;
    padding: 2rem;
    flex: 1;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

/* ------------------- BOTÕES E ELEMENTOS GERAIS ------------------- */
.btn-primary {
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-clean {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
}

.select-clean, .input-clean {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    font-size: 0.9rem;
}
