/* Design System & Estilização Premium - DokMail Backup & Webmail */

:root {
    --bg-app: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(31, 41, 55, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-sans: 'Inter', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    --bg-gradient: radial-gradient(circle at 80% 20%, #1e1b4b 0%, #0b0f19 50%);
}

/* TEMA AZUL OCEANO */
body.theme-ocean {
    --bg-app: #071926;
    --bg-sidebar: #0b2538;
    --bg-card: rgba(15, 43, 64, 0.7);
    --bg-card-hover: rgba(22, 63, 94, 0.8);
    --border-color: rgba(20, 184, 166, 0.15);
    --border-focus: #14b8a6;
    
    --text-primary: #e0f2fe;
    --text-secondary: #38bdf8;
    --text-muted: #0d9488;
    
    --accent: #14b8a6;
    --accent-hover: #0f766e;
    --accent-glow: rgba(20, 184, 166, 0.2);
    
    --bg-gradient: radial-gradient(circle at 80% 20%, #083344 0%, #071926 50%);
}

/* TEMA CLARO CLEAN */
body.theme-light {
    --bg-app: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(243, 244, 246, 1);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #2563eb;
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.1);
    
    --bg-gradient: radial-gradient(circle at 80% 20%, #e2e8f0 0%, #f3f4f6 50%);
}

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

/* SCROLLBAR */
@media (min-width: 769px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 10px;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* APP LAYOUT */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    width: 100vw;
    background: var(--bg-gradient);
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed {
    grid-template-columns: 78px 1fr;
}

/* SIDEBAR */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 24px;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    width: 260px;
    box-sizing: border-box;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 78px;
    padding: 24px 12px;
    align-items: center;
}

/* Retractable Sidebar Transitions and Collapsed Overrides */
.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 10px;
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-nav {
    gap: 16px;
}

.sidebar.collapsed .nav-section {
    gap: 8px;
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar.collapsed .theme-wrapper {
    display: none;
}

.sidebar.collapsed .btn-logout-footer span {
    display: none;
}

.sidebar.collapsed .btn-logout-footer {
    justify-content: center;
    padding: 10px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.sidebar.collapsed .sidebar-copyright {
    display: none !important;
}

/* Toggle Button Styling */
.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-toggle-sidebar:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-toggle-sidebar svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .btn-toggle-sidebar svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .logo-container {
    width: 0;
    opacity: 0;
    margin-right: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    margin-bottom: 24px;
}

/* SaaS Header Icons next to titles */
.header-title-with-icon {
    display: flex;
    align-items: center;
    gap: 16px;
}

.title-icon {
    width: 32px;
    height: 32px;
    fill: var(--accent);
    color: var(--accent);
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* Light theme adjustments for icons */
body[data-theme="light"] .title-icon {
    filter: drop-shadow(0 0 2px rgba(37, 99, 235, 0.15));
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 36px;
    gap: 8px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.logo-img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-left: 12px;
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, rgba(37, 99, 235, 0.4) 100%);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-link.active svg {
    fill: #fff;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

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

.user-details .username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-details .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 6px;
    transition: var(--transition-fast);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-icon:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

/* MAIN CONTENT */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* APP HEADER */
.app-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    backdrop-filter: blur(10px);
    background-color: rgba(11, 15, 25, 0.8);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    position: relative;
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: var(--text-muted);
}

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 38px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}

.header-search input:focus {
    border-color: var(--border-focus);
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.quota-mini-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 180px;
}

.quota-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.progress-bar-container {
    height: 6px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.quota-val {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: right;
}

/* VIEWS WRAPPER */
.views-wrapper {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.app-view {
    animation: fadeIn var(--transition-normal);
}

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

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

.view-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.view-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* CARDS */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    min-width: 0;
    overflow: hidden;
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background-color: #0d9488;
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* FORM ELEMENTS */
.form-group {
    margin-bottom: 16px;
}

.form-group 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: 10px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    background-color: rgba(255, 255, 255, 0.04);
}

select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-6 { flex: 1; }
.col-8 { flex: 2; }
.col-4 { flex: 1; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-transform: none !important;
}

.radio-label input {
    accent-color: var(--accent);
}

.folder-checkboxes {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.folder-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    text-transform: none;
    cursor: pointer;
}

.folder-checkboxes label input {
    accent-color: var(--accent);
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* TABLES */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.01);
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-sm-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.btn-sm-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-sm-icon:hover {
    color: var(--accent);
    background-color: rgba(59, 130, 246, 0.1);
}

.btn-sm-icon.delete:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

/* LOGIN CARD */
.login-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background-color: #0b0f19;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0b0f19 80%);
    background-size: 50px 50px, 50px 50px, auto;
    background-position: center;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 350px;
    height: 350px;
    background: var(--accent);
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.15;
    z-index: 0;
    animation: floatGlow 18s infinite alternate ease-in-out;
    pointer-events: none;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 10%;
    width: 400px;
    height: 400px;
    background: #8b5cf6;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.12;
    z-index: 0;
    animation: floatGlow 25s infinite alternate-reverse ease-in-out;
    pointer-events: none;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, -40px) scale(1.1); }
    100% { transform: translate(-40px, 50px) scale(0.9); }
}

.login-card {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    animation: fadeIn var(--transition-normal);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.login-header .logo span {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* WEBMAIL SPLIT CONTAINER */
.webmail-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: calc(100vh - 170px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background-color: rgba(17, 24, 39, 0.3);
}

.webmail-folders {
    border-right: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: rgba(17, 24, 39, 0.5);
    min-height: 0;
}

.btn-compose {
    width: 100%;
}

.folder-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-left: 8px;
    margin-bottom: 8px;
    display: block;
}

.folder-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
}

.folder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.folder-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.folder-item.active {
    color: #fff;
    background-color: rgba(37, 99, 235, 0.15);
    border-left: 3px solid var(--accent);
}

.folder-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.folder-item-left svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.folder-badge {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

/* WEBMAIL LIST */
.webmail-list {
    border-right: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.2);
    min-height: 0;
}

.webmail-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.email-items-container {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    padding: 10px 16px 10px 44px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    position: relative;
}

.email-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.email-item.active {
    background-color: rgba(37, 99, 235, 0.08);
}

.email-item.selected {
    background-color: rgba(37, 99, 235, 0.12);
}

.email-item-checkbox-wrapper {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-item-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Bulk actions bar style */
.webmail-bulk-actions-bar {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    transition: all 0.3s ease;
}

.bulk-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bulk-select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bulk-select-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--accent);
}

.bulk-selected-count {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
}

.bulk-actions-right {
    display: flex;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.webmail-bulk-actions-bar.has-selection .bulk-actions-right {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.webmail-bulk-actions-bar .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
    border-radius: 4px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.email-item.unread::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
}

.email-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
}

.email-item-date {
    width: 75px;
    text-align: right;
}

.email-item-size {
    width: 55px;
    text-align: right;
}

.email-item-sender {
    width: 150px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    flex-shrink: 0;
}

.email-item.unread .email-item-sender {
    font-weight: 700;
    color: #fff;
}

.email-item-subject-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.email-item-subject {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.email-item.unread .email-item-subject {
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* EMAIL VIEWER */
.webmail-viewer {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: rgba(17, 24, 39, 0.1);
    min-height: 0;
    border-left: none;
}

.empty-state-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 16px;
}

.empty-state-viewer svg {
    width: 64px;
    height: 64px;
    fill: var(--border-color);
}

.viewer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.viewer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-subject {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.viewer-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.viewer-meta-info {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.viewer-meta-info .sender {
    font-weight: 600;
    color: var(--text-primary);
}

.viewer-meta-info .recipients {
    color: var(--text-secondary);
    font-size: 11px;
}

.viewer-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.viewer-body {
    padding: 24px;
    flex: 1;
    min-height: 0;
    color: #1f2937; /* Sempre escuro para contraste garantido */
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    background-color: #ffffff; /* Sempre fundo branco puro */
}

.viewer-body a {
    color: #2563eb;
    text-decoration: underline;
}

.viewer-body a:hover {
    color: #1d4ed8;
}

.viewer-attachments {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(17, 24, 39, 0.4);
}

.attachments-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.attachment-file:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--border-focus);
}

.attachment-file svg {
    width: 14px;
    height: 14px;
    fill: var(--text-muted);
}

/* GRIDS */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.grid-2col > *, .grid-3col > * {
    min-width: 0;
}

.mt-20 { margin-top: 20px; }
.mt-20 { margin-top: 20px; }

/* METRIC CARD */
.metric-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* CHART CONTAINER */
.chart-container {
    height: 250px;
    position: relative;
    width: 100%;
}

/* CONSOLE LOG */
.console-log {
    margin-top: 16px;
    background-color: #040711;
    border: 1px solid #1e293b;
    border-radius: 8px;
    font-family: monospace;
    font-size: 11px;
    color: #a8a29e;
    padding: 12px;
    height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    line-height: 1.4;
}

.log-entry.info { color: #60a5fa; }
.log-entry.success { color: #34d399; }
.log-entry.error { color: #f87171; }
.log-entry.warn { color: #fbbf24; }

/* MODALS */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn var(--transition-fast);
}

.modal-content {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-lg {
    width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.close {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close:hover {
    color: #fff;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* DIVIDER */
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

/* TOASTS */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: slideIn var(--transition-fast);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success {
    background-color: var(--success);
}

.toast-error {
    background-color: var(--danger);
}

.toast-info {
    background-color: var(--accent);
}

/* RESPONSIVITY */
.btn-menu-mobile {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    
    /* Sidebar como Drawer Deslizante no Mobile */
    .sidebar {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        bottom: 0 !important;
        width: 260px !important;
        z-index: 1000 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5) !important;
        background-color: var(--bg-sidebar) !important;
    }
    
    .app-layout.sidebar-open .sidebar {
        left: 0 !important;
    }

    /* Overlay para fechar ao clicar fora */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
    }

    .app-layout.sidebar-open .sidebar-overlay {
        display: block !important;
    }

    /* Botão Hambúrguer */
    .btn-menu-mobile {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        padding: 8px;
        margin-right: 12px;
        border-radius: 8px;
        transition: var(--transition-fast);
    }
    
    .btn-menu-mobile:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    body.theme-light .btn-menu-mobile:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
    
    .btn-menu-mobile svg {
        width: 24px;
        height: 24px;
    }
    
    .webmail-container {
        grid-template-columns: 180px 1fr;
    }
    
    .webmail-viewer {
        display: none; /* No mobile a view de leitura abre em overlay ou aba cheia */
    }
    
    .grid-3col {
        grid-template-columns: 1fr;
    }
    
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* ESTILOS DE COMPONENTES ADICIONADOS PARA TEMA CLARO */
@media (min-width: 769px) {
    body.theme-light ::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
    }
    body.theme-light ::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.25);
    }
}
body.theme-light .form-control {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .form-control:focus {
    background-color: #fff;
}
body.theme-light .header-search input {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .table th {
    background-color: rgba(0, 0, 0, 0.02);
}
body.theme-light .table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}
body.theme-light .modal-content {
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}
body.theme-light .console-log {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}
body.theme-light .console-log .log-entry.info { color: #2563eb; }
body.theme-light .console-log .log-entry.success { color: #059669; }
body.theme-light .console-log .log-entry.error { color: #dc2626; }
body.theme-light .console-log .log-entry.warn { color: #d97706; }

/* Correções de visibilidade de fontes claras no tema Claro */
body.theme-light .metric-value {
    color: #111827; /* Preto/Cinza escuro para valores das métricas */
}
body.theme-light .viewer-subject {
    color: #111827; /* Preto/Cinza escuro para assunto do email */
}
body.theme-light .email-item.unread .email-item-sender {
    color: #000000; /* Preto puro para remetente não lido */
}
body.theme-light .email-item-sender {
    color: #374151; /* Cinza escuro para remetente lido */
}
body.theme-light .email-item-subject {
    color: #4b5563; /* Cinza médio para assunto na lista */
}
body.theme-light .logo-text,
body.theme-light .login-header .logo span {
    background: linear-gradient(135deg, #111827 0%, #4b5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-light .login-container {
    background-color: #f3f4f6;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.015) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, #e2e8f0 0%, #f3f4f6 80%);
    background-size: 50px 50px, 50px 50px, auto;
}

body.theme-light .login-container::before {
    opacity: 0.08;
    background: var(--accent);
}

body.theme-light .login-container::after {
    opacity: 0.08;
    background: #c084fc;
}

body.theme-light .folder-item.active {
    color: var(--accent);
    background-color: rgba(37, 99, 235, 0.1);
}
body.theme-light .folder-badge {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
}
body.theme-light .folder-title {
    color: var(--text-secondary);
}

/* Quadro de Mensagens Cinza Bem Claro no Tema Claro */
body.theme-light .webmail-container {
    background-color: #e5e7eb; /* Divisor/Borda cinza mais marcado */
}
body.theme-light .webmail-folders {
    background-color: #f3f4f6; /* Pastas cinza leve */
}
body.theme-light .webmail-list {
    background-color: #f9fafb; /* Quadro de mensagens cinza bem claro */
}
body.theme-light .webmail-viewer {
    background-color: #ffffff; /* Visualizador branco puro */
}
body.theme-light .viewer-attachments {
    background-color: #f3f4f6;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .attachment-file {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1f2937;
}
body.theme-light .attachment-file:hover {
    background-color: #f9fafb;
    border-color: #2563eb;
}
body.theme-light .webmail-list-header {
    background-color: #f3f4f6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .email-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
body.theme-light .email-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
body.theme-light .email-item.active {
    background-color: rgba(37, 99, 235, 0.08);
}
body.theme-light .pagination-bar {
    background-color: #f3f4f6;
}

/* PAGINAÇÃO, ORDENAÇÃO E TEMA SELECTOR CSS */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.btn-page {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#page-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sort-select {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.sort-select:focus {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.sorting-wrapper {
    margin-left: auto;
}

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

.footer-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.theme-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 10px;
    height: 34px;
    transition: var(--transition-fast);
}

.theme-wrapper:hover {
    border-color: var(--border-focus);
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-wrapper svg.theme-icon {
    width: 14px;
    height: 14px;
    fill: var(--text-secondary);
    margin-right: 6px;
    flex-shrink: 0;
}

.theme-select {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding: 0;
}

.theme-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

.btn-logout-footer {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 8px;
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    height: 34px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-logout-footer:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.28);
    color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.btn-logout-footer svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* BANNER DE PRIVACIDADE - IMAGENS BLOQUEADAS */
.blocked-images-banner {
    background-color: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 24px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-primary);
    animation: fadeIn var(--transition-fast);
}

.blocked-images-banner-text {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--warning);
}

.blocked-images-banner-text svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-show-images {
    background-color: var(--warning);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-show-images:hover {
    background-color: #fbbf24;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* Ajustes no Tema Claro para o Banner */
body.theme-light .blocked-images-banner {
    background-color: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}
body.theme-light .blocked-images-banner-text {
    color: #b45309;
}
body.theme-light .btn-show-images {
    color: #fff;
    background-color: #d97706;
}
body.theme-light .btn-show-images:hover {
    background-color: #b45309;
}

/* DETALHES TÉCNICOS DA MENSAGEM (TABS & MODAL) */
.tech-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.tech-tabs .tab-link {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tech-tabs .tab-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.tech-tabs .tab-link.active {
    color: #fff;
    background-color: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
}

.tech-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.tech-info-item {
    display: flex;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    font-size: 13px;
}

.tech-info-label {
    width: 160px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tech-info-value {
    color: var(--text-primary);
    word-break: break-all;
}

.headers-pre {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-height: 350px;
    overflow: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #a7f3d0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Ajustes no Tema Claro para Detalhes Técnicos */
body.theme-light .tech-tabs .tab-link.active {
    color: var(--accent);
    background-color: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}
body.theme-light .tech-info-item {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}
body.theme-light .headers-pre {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Ajustes no Tema Claro para Rodapé da Sidebar */
body.theme-light .theme-wrapper {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}
body.theme-light .theme-wrapper:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
}
body.theme-light .theme-select {
    color: #374151;
}
body.theme-light .theme-wrapper svg.theme-icon {
    fill: #4b5563;
}
body.theme-light .btn-logout-footer {
    background: rgba(220, 38, 38, 0.06);
    border-color: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}
body.theme-light .btn-logout-footer:hover {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

/* RELATÓRIOS (TABS & TABELAS DETALHADAS) */
.reports-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 20px;
    margin-top: 10px;
}

.reports-tabs .reports-tab-link {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.reports-tabs .reports-tab-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.reports-tabs .reports-tab-link.active {
    color: #fff;
    background-color: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
}

body.theme-light .reports-tabs .reports-tab-link.active {
    color: var(--accent);
    background-color: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.mt-24 {
    margin-top: 24px;
}

/* ==========================================
   DASHBOARD GERAL E PROFISSIONAL (DOKMAIL)
   ========================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-width: 0;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-focus);
    box-shadow: 0 12px 40px var(--accent-glow);
}

.dashboard-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, rgba(37, 99, 235, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.dashboard-card-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.dashboard-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.dashboard-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-action-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dashboard-action-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--accent);
    transition: var(--transition-fast);
}

.dashboard-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-focus);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dashboard-action-btn:hover svg {
    transform: scale(1.1);
}

/* Ajustes Tema Claro */
body.theme-light .dashboard-card {
    background: var(--bg-card);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}
body.theme-light .dashboard-action-btn {
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .dashboard-action-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ==========================================
   MODERN SPLIT PANE VIEW (MENSAGENS)
   ========================================== */

/* Quando possui email ativo selecionado (Split Pane View) */
.webmail-container.has-active-email {
    grid-template-columns: 200px 420px 1fr;
}

.webmail-container.has-active-email .webmail-list {
    border-right: 1px solid var(--border-color);
}

.webmail-container.has-active-email .webmail-viewer {
    display: flex;
}

/* Layout compacto de 2 linhas para itens de e-mail no painel dividido (Desktop) */
.webmail-container.has-active-email .email-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: 
        "sender date"
        "subject size";
    padding-left: 44px;
    padding-right: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 4px 12px;
    align-items: center;
}

.webmail-container.has-active-email .email-item-sender {
    grid-area: sender;
    width: 100%;
    font-size: 13px;
}

.webmail-container.has-active-email .email-item-subject-wrapper {
    grid-area: subject;
    width: 100%;
}

.webmail-container.has-active-email .email-item-meta {
    display: contents;
}

.webmail-container.has-active-email .email-item-date {
    grid-area: date;
    width: auto;
    text-align: right;
    font-size: 11px;
}

.webmail-container.has-active-email .email-item-size {
    grid-area: size;
    width: auto;
    text-align: right;
    font-size: 11px;
}

/* Layout compacto de 2 linhas em telas menores de 768px (Mobile) */
@media (max-width: 768px) {
    .email-item {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas: 
            "sender date"
            "subject size";
        padding-left: 44px;
        padding-right: 12px;
        padding-top: 10px;
        padding-bottom: 10px;
        gap: 4px 12px;
        align-items: center;
    }
    .email-item-sender {
        grid-area: sender;
        width: 100%;
        font-size: 13px;
    }
    .email-item-subject-wrapper {
        grid-area: subject;
        width: 100%;
    }
    .email-item-meta {
        display: contents;
    }
    .email-item-date {
        grid-area: date;
        width: auto;
        text-align: right;
        font-size: 11px;
    }
    .email-item-size {
        grid-area: size;
        width: auto;
        text-align: right;
        font-size: 11px;
    }
}

/* Colapso no Mobile do Split View */
@media (max-width: 1024px) {
    .webmail-container.has-active-email {
        grid-template-columns: 180px 1fr;
    }
    .webmail-container.has-active-email .webmail-list {
        display: none !important;
    }
}

/* Responsividade do Webmail no Mobile */
@media (max-width: 768px) {
    .app-header {
        padding: 0 16px !important;
    }
    .header-actions {
        display: none !important;
    }
    .header-search {
        flex: 1;
        max-width: none;
        margin-left: 12px;
    }

    /* Ajuste de flex-header e botões de relatórios no mobile */
    .flex-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }
    .flex-header h2 {
        font-size: 15px !important;
        line-height: 1.4;
    }
    .flex-header .header-actions-group {
        display: flex;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }
    .flex-header .header-actions-group .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        text-align: center;
        font-size: 11px !important;
        padding: 8px 12px !important;
    }

    /* Diminuir padding das views no mobile para ganhar espaço de tela */
    .views-wrapper {
        padding: 12px !important;
    }

    /* O container de webmail passa a ter apenas 1 coluna */
    .webmail-container {
        grid-template-columns: 1fr !important;
        height: calc(100vh - 130px) !important;
        border-radius: 8px !important;
    }

    /* Mostrar botões de controle de pastas apenas no mobile */
    .btn-folders-mobile {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 6px;
    }

    .btn-folders-close-mobile {
        display: flex !important;
    }

    /* Comportamento de Visibilidade das Colunas: Apenas uma por vez */
    
    /* 1. Estado Padrão (Sem pasta aberta/Sem email ativo): exibe a lista, esconde o resto */
    .webmail-container .webmail-folders {
        display: none !important;
    }
    .webmail-container .webmail-list {
        display: flex !important;
        width: 100% !important;
    }
    .webmail-container .webmail-viewer {
        display: none !important;
    }

    /* 2. Estado show-folders (Visualização do menu de pastas): exibe pastas, esconde o resto */
    .webmail-container.show-folders .webmail-folders {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        border-right: none !important;
    }
    .webmail-container.show-folders .webmail-list {
        display: none !important;
    }
    .webmail-container.show-folders .webmail-viewer {
        display: none !important;
    }

    /* 3. Estado has-active-email (Leitura do e-mail): exibe o visualizador, esconde o resto */
    .webmail-container.has-active-email .webmail-folders {
        display: none !important;
    }
    .webmail-container.has-active-email .webmail-list {
        display: none !important;
    }
    .webmail-container.has-active-email .webmail-viewer {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Habilitar rolagem suave por toque (momentum scrolling) no iOS */
    .views-wrapper,
    .email-items-container,
    .folder-list,
    .viewer-body,
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Ajustar quebra de cabeçalho da lista no mobile se necessário */
    .webmail-list-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px !important;
    }

    .viewer-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .viewer-actions > button {
        margin-right: 0 !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .viewer-actions > div {
        display: flex;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }
    .viewer-actions > div > button {
        flex: 1;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        font-size: 11px;
        padding: 6px 4px;
        white-space: nowrap;
    }

    /* Ajustes responsivos adicionais para o Dashboard */
    .card {
        padding: 16px !important;
        margin-bottom: 16px !important;
    }
    .grid-2col, .grid-3col {
        gap: 16px !important;
    }
    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)) !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }
    .dashboard-card {
        padding: 16px !important;
        gap: 12px !important;
    }
    .dashboard-card-icon {
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
    }
    .dashboard-card-icon svg {
        width: 20px !important;
        height: 20px !important;
    }
    .dashboard-card-value {
        font-size: 18px !important;
    }
    .dashboard-actions-list {
        gap: 8px !important;
    }
    .dashboard-action-btn {
        padding: 12px 14px !important;
        font-size: 13px !important;
        gap: 12px !important;
    }
    .dashboard-action-btn svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
    }
}

