/* ============================================================
   SECURITY DASHBOARD - Main Stylesheet
   Brand: #ee3551 (primary red) | #474747 (dark gray)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Proza+Libre:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=IBM+Plex+Mono:wght@300;400;500&display=swap');

/* ===== VARIÁVEIS FIXAS ===== */
:root {
    --primary:       #ee3551;
    --primary-dark:  #c42840;
    --primary-light: #ff4d6b;
    --primary-glow:  rgba(238, 53, 81, 0.15);

    --success:  #22c55e;
    --warning:  #f59e0b;
    --info:     #3b82f6;
    --critical: #ee3551;
    --high:     #f97316;
    --medium:   #f59e0b;
    --low:      #22c55e;

    --sidebar-width: 240px;
    --header-height: 60px;
    --radius:    8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
    --shadow-red: 0 4px 20px rgba(238,53,81,0.2);

    --font-mono: 'IBM Plex Mono', monospace;
}

/* ===== TEMA ESCURO (padrão) ===== */
:root,
[data-theme="dark"] {
    --bg:             #1a1a1a;
    --surface:        #222222;
    --surface-hover:  #2a2a2a;
    --border:         #333333;
    --border-hover:   #444444;
    --text:           #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted:     #666666;
    --shadow:         0 4px 20px rgba(0,0,0,0.45);
    --input-bg:       #2a2a2a;
    --scrollbar-bg:   #1a1a1a;

    /* legado — mantém compat com páginas antigas */
    --dark-bg:     #1a1a1a;
    --dark-card:   #222222;
    --dark-border: #333333;
    --dark-hover:  #2e2e2e;
    --text-primary:#f0f0f0;
}

/* ===== TEMA CLARO ===== */
[data-theme="light"] {
    --bg:             #f1f5f9;
    --surface:        #ffffff;
    --surface-hover:  #f8fafc;
    --border:         #e2e8f0;
    --border-hover:   #cbd5e1;
    --text:           #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --shadow:         0 4px 20px rgba(0,0,0,0.08);
    --input-bg:       #f8fafc;
    --scrollbar-bg:   #f1f5f9;

    --dark-bg:     #f1f5f9;
    --dark-card:   #ffffff;
    --dark-border: #e2e8f0;
    --dark-hover:  #f8fafc;
    --text-primary:#0f172a;
}

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

body {
    font-family: 'Proza Libre', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.25s ease, color 0.25s ease;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0;
}

/* Títulos — Proza Libre é bem legível, não precisa de letter-spacing negativo */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Proza Libre', sans-serif;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

/* Mono — IBM Plex Mono */
code, pre, .mono, .mono-ta, .mono-input,
[class*="font-mono"] {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
    letter-spacing: 0;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-red);
}

.sidebar-logo .logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
}
.sidebar-logo .logo-text span { color: var(--primary); }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-left-color: var(--border);
}

.nav-item.active {
    background: var(--primary-glow);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item.nav-category {
    opacity: .5;
    pointer-events: none;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 14px 20px 4px;
    color: var(--text-muted);
}

.nav-icon { display:flex; align-items:center; }
.nav-icon svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-details .user-name,
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-details .user-role,
.user-role { font-size: 11px; color: var(--primary); font-weight: 500; }

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 12px;
    background: rgba(238,53,81,0.1);
    border: 1px solid rgba(238,53,81,0.2);
    color: var(--primary);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
}
.logout-btn svg { width:14px; height:14px; }
.logout-btn:hover { background: var(--primary); color: white; }

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

/* ===== TOPBAR ===== */
.topbar {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.sidebar-toggle svg { width: 20px; height: 20px; }
.sidebar-toggle:hover { color: var(--text); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
    width: 34px; height: 34px;
    border-radius: var(--radius);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}
.topbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.topbar-btn svg { width: 16px; height: 16px; }

.badge-dot {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 8px;
    border: 2px solid var(--surface);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    width: 34px; height: 34px;
    border-radius: var(--radius);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-icon-dark, .theme-icon-light { display: flex; }

/* No tema escuro: mostra ícone da lua (dark), esconde sol */
[data-theme="dark"]  .theme-icon-dark  { display: flex; }
[data-theme="dark"]  .theme-icon-light { display: none; }
/* No tema claro: esconde lua, mostra sol */
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="light"] .theme-icon-light { display: flex; }

/* ===== PAGE CONTENT ===== */
.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.card:hover { border-color: #444; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--stat-color, var(--primary));
}

.stat-card:hover { border-color: #444; transform: translateY(-1px); }

.stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    color: var(--stat-color, var(--primary));
    flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    font-family: 'IBM Plex Mono', monospace;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.stat-change {
    font-size: 11px;
    margin-top: 6px;
    font-weight: 600;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--primary); }

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-12 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.grid-21 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ===== TABLES ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface-hover); }

.data-table .link-cell {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.data-table .link-cell:hover { text-decoration: underline; }

/* ===== SEVERITY BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-critical  { background: rgba(238,53,81,0.15);  color: #ee3551; }
.badge-high      { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-medium    { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-low       { background: rgba(34,197,94,0.15);  color: #22c55e; }
.badge-info      { background: rgba(59,130,246,0.15); color: #3b82f6; }

.badge-open         { background: rgba(238,53,81,0.15);  color: #ee3551; }
.badge-in_progress  { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-resolved     { background: rgba(34,197,94,0.15);  color: #22c55e; }
.badge-active       { background: rgba(34,197,94,0.15);  color: #22c55e; }
.badge-planning     { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-andamento    { background: rgba(245,158,11,0.15); color: #f59e0b; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Proza Libre', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-red); }

.btn-secondary { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: rgba(238,53,81,0.1); color: var(--primary); border: 1px solid rgba(238,53,81,0.2); }
.btn-danger:hover { background: var(--primary); color: white; }

.btn-success { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--success); color: white; }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: 'Proza Libre', sans-serif;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--surface); }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: #22c55e; }
.alert-danger { background: rgba(238,53,81,0.1); border: 1px solid rgba(238,53,81,0.2); color: var(--primary); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #f59e0b; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #3b82f6; }

/* ===== MONO / CODE ===== */
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.code-tag { background: var(--bg); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-family: 'IBM Plex Mono', monospace; color: var(--primary); border: 1px solid var(--border); }

/* ===== CHART CONTAINERS ===== */
.chart-container { position: relative; }
.chart-container canvas { max-height: 250px; }

/* ===== SEVERITY BAR ===== */
.severity-bar { display: flex; flex-direction: column; gap: 8px; }
.severity-item { display: flex; align-items: center; gap: 10px; }
.severity-label { font-size: 12px; color: var(--text-secondary); width: 70px; font-weight: 500; }
.severity-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.severity-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.severity-count { font-size: 12px; font-family: 'IBM Plex Mono', monospace; color: var(--text-muted); width: 30px; text-align: right; }

/* ===== MITRE HEATMAP ===== */
.mitre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.mitre-cell {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-size: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.mitre-cell:hover { border-color: var(--primary); }
.mitre-cell.heat-0 { opacity: 0.3; }
.mitre-cell.heat-1 { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.mitre-cell.heat-2 { border-color: rgba(249,115,22,0.4); background: rgba(249,115,22,0.08); }
.mitre-cell.heat-3 { border-color: rgba(238,53,81,0.5); background: rgba(238,53,81,0.12); }
.mitre-cell-name { font-weight: 600; color: var(--text-secondary); }
.mitre-cell-count { font-size: 16px; font-weight: 800; font-family: 'IBM Plex Mono', monospace; color: var(--text); margin-top: 4px; }

/* ===== MODAL ===== */
.modal-backdrop,
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 1rem;
}
.modal-backdrop.open,
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(0.95); } to { opacity:1; transform: scale(1); } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { cursor: pointer; color: var(--text-muted); transition: var(--transition); background: none; border: none; font-size: 22px; line-height: 1; padding: 0; }
.modal-close:hover { color: var(--primary); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { display: flex; flex-direction: column; gap: 0; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.page-link {
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}
.page-link:hover, .page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'Proza Libre', sans-serif;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}
.tab-btn svg { width: 14px; height: 14px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== PROJECT HEADER ===== */
.project-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.project-icon {
    width: 48px; height: 48px;
    background: var(--primary-glow);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}
.project-icon svg { width: 24px; height: 24px; }
.project-name { font-size: 17px; font-weight: 800; }
.project-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ===== LOADING ===== */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--primary); }
.toast.warning { border-left: 3px solid var(--warning); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-2, .grid-12, .grid-21 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== LOGIN PAGE — sempre fundo claro ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4f8;
    position: relative;
    overflow: hidden;
    font-family: 'Proza Libre', sans-serif;
}

/* Gradiente de fundo suave */
.login-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 60%, rgba(238,53,81,0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(99,102,241,0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 100%, rgba(238,53,81,0.05) 0%, transparent 50%);
}

/* Grid SVG — visível no fundo claro */
.login-page > svg {
    opacity: 0.035 !important;
}

.login-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 44px 40px 36px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 48px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.login-logo-icon {
    width: 46px; height: 46px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(238,53,81,0.35);
}

.login-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.01em;
}
.login-logo-text span { color: var(--primary); }

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    letter-spacing: -.02em;
}
.login-sub {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 28px;
}

/* Inputs dentro do login — sempre claros */
.login-card .form-label {
    color: #374151;
    font-size: 12.5px;
    font-weight: 600;
}
.login-card .form-control {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    color: #0f172a;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.login-card .form-control::placeholder { color: #94a3b8; }
.login-card .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(238,53,81,0.12);
    background: #fff;
}

/* Botão entrar */
.login-card .btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 4px 14px rgba(238,53,81,0.3);
    transition: all .2s;
}
.login-card .btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(238,53,81,0.4);
    transform: translateY(-1px);
}

/* Divisor de demo */
.login-divider {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e9eef4;
}
.login-divider-label {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 600;
}

/* Botões de demo */
.demo-btn {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    text-align: left;
    font-family: 'Proza Libre', sans-serif;
    transition: all .18s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.demo-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(238,53,81,0.04);
}
.demo-btn-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.login-hint {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-top: 10px;
}
.login-hint code {
    background: #f1f5f9;
    color: var(--primary);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
}

/* Alert de erro dentro do login */
.login-card .alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}


/* ===== SCROLLABLE LIST ===== */
.scroll-list { max-height: 300px; overflow-y: auto; }
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.list-item:last-child { border-bottom: none; }

/* ===== SEARCH ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
}
.search-bar svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input { background: none; border: none; color: var(--text); font-size: 13px; font-family: 'Proza Libre', sans-serif; outline: none; flex: 1; }
.search-bar input::placeholder { color: var(--text-muted); }

/* ===== TEMA CLARO — AJUSTES ESPECÍFICOS ===== */
[data-theme="light"] .login-page {
    background: #f1f5f9;
}
[data-theme="light"] .login-box {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}
[data-theme="light"] .list-item {
    border-bottom-color: var(--border);
}
[data-theme="light"] .data-table thead th {
    background: #f8fafc;
}
[data-theme="light"] .data-table tbody tr:hover {
    background: #f8fafc;
}
[data-theme="light"] .badge-dot {
    border-color: var(--surface);
}

/* ===== MOBILE RESPONSIVO ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.4);
    }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
}

/* ===== CLIENT FILTER (topbar) ===== */
.client-filter-wrap {
    position: relative;
    margin: 0 8px;
}

.client-filter-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 11px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Proza Libre', sans-serif;
    white-space: nowrap;
    max-width: 220px;
}
.client-filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}
.client-filter-btn svg { flex-shrink: 0; }
.client-filter-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.client-filter-active-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(238,53,81,.5);
}
.client-filter-chevron {
    flex-shrink: 0;
    transition: transform .2s;
}
.client-filter-wrap.open .client-filter-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.client-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    min-width: 240px;
    max-width: 300px;
    z-index: 200;
    overflow: hidden;
    animation: fadeDown .15s ease;
}
.client-filter-wrap.open .client-filter-dropdown { display: block; }

@keyframes fadeDown {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}

.cfd-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: 12px 14px 8px;
}

.cfd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
    cursor: pointer;
}
.cfd-item:hover { background: var(--surface-hover); color: var(--text); }
.cfd-item.active { color: var(--primary); font-weight: 600; }
.cfd-item svg { margin-left: auto; color: var(--primary); flex-shrink: 0; }

.cfd-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cfd-avatar {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cfd-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfd-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Banner indicador de filtro ativo */
.client-filter-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(238,53,81,.07);
    border: 1px solid rgba(238,53,81,.2);
    border-radius: var(--radius);
    padding: 8px 14px;
    margin-bottom: 16px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.client-filter-banner strong { color: var(--primary); }
.client-filter-banner a {
    margin-left: auto;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.client-filter-banner a:hover { color: var(--primary); }
