/* ==========================================================================
   GoMail Enterprise Design System & Modern Styles
   ========================================================================== */

:root {
    /* Color Palette - Dark Theme (Default) */
    --bg-base: #090d16;
    --bg-surface: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.75);
    --bg-card-active: rgba(71, 85, 105, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.2);

    --font-en: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
    --sidebar-width: 270px;
    --header-height: 70px;
}

[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --bg-card-active: #e2e8f0;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-ar);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html[lang="en"] body {
    font-family: var(--font-en);
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.small { font-size: 13px; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
html[dir="rtl"] .toast-container {
    left: auto;
    right: 24px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 280px;
}
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-info { background: #4f46e5; }
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Login View
   ========================================================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%), var(--bg-base);
}
.login-card {
    width: 100%;
    max-width: 380px;
    padding: 28px 24px;
    box-shadow: var(--shadow-glow), 0 16px 36px rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-lg);
}
.login-header {
    text-align: center;
    margin-bottom: 22px;
}
.login-logo-badge {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}
.logo-svg {
    width: 28px;
    height: 28px;
    color: #ffffff;
}
.login-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}
.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}
.login-footer-hint {
    text-align: center;
    margin-top: 16px;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    right: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
html[dir="ltr"] .input-icon {
    right: auto;
    left: 14px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    padding-right: 38px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    height: 38px;
}
html[dir="ltr"] input[type="text"],
html[dir="ltr"] input[type="email"],
html[dir="ltr"] input[type="password"],
html[dir="ltr"] input[type="number"],
html[dir="ltr"] select {
    padding-right: 12px;
    padding-left: 38px;
}
textarea {
    height: auto;
    padding-right: 12px;
}
html[dir="ltr"] textarea {
    padding-left: 12px;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-row {
    display: flex;
    gap: 12px;
}
.col-half {
    flex: 1;
}
.form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.form-checkbox-group input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ==========================================================================
   Refined & Compact Button System
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    min-height: 34px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.btn svg {
    width: 14px;
    height: 14px;
}
.btn-block {
    width: 100%;
}
.btn-sm {
    padding: 4px 10px;
    min-height: 28px;
    font-size: 11.5px;
    border-radius: 5px;
    gap: 4px;
}
.btn-sm svg {
    width: 12px;
    height: 12px;
}
.btn-xs {
    padding: 2px 8px;
    min-height: 24px;
    font-size: 11px;
    border-radius: 4px;
    gap: 3px;
}
.btn-lg {
    padding: 9px 18px;
    min-height: 38px;
    font-size: 13.5px;
    border-radius: 7px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-highlight);
    color: var(--text-primary);
}
.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}
.btn-accent {
    background: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}
.btn-accent:hover {
    background: #0284c7;
    transform: translateY(-1px);
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
}
.icon-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-highlight);
}
.icon-btn svg {
    width: 15px;
    height: 15px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-primary { background: var(--primary-glow); color: #818cf8; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-indigo { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.badge-emerald { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-amber { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge-rose { background: rgba(244, 63, 94, 0.2); color: #fda4af; }

/* Pulse Dots */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulseAnimation 2s infinite;
}
@keyframes pulseAnimation {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    transition: width 0.3s ease;
}
html[dir="ltr"] .app-sidebar {
    border-left: none;
    border-right: 1px solid var(--border-color);
    right: auto;
    left: 0;
}
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}
.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}
.brand-text {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}
.brand-subtitle {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sidebar-status-card {
    margin: 16px 14px 8px 14px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.status-indicator-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.status-meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}
.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 14px 6px 14px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
    transition: all 0.2s ease;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.15) 100%);
    color: var(--primary);
    font-weight: 700;
    border: 1px solid var(--border-highlight);
}
.nav-item-highlight {
    background: rgba(99, 102, 241, 0.08);
}
.sidebar-user-card {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
}
.user-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.user-info-text {
    flex: 1;
    overflow: hidden;
}
.user-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-email {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.app-main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
html[dir="ltr"] .app-main-content {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}

/* App Header */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.page-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mobile-only { display: none; }

/* Page Content View Area */
.page-content {
    flex: 1;
    padding: 28px;
}
.content-view {
    display: none;
    animation: fadeIn 0.25s ease;
}
.content-view.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Dashboard View Components
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.kpi-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.kpi-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}
.kpi-icon-wrap svg { width: 24px; height: 24px; }
.bg-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.bg-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.bg-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.kpi-info { flex: 1; }
.kpi-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-top: 2px; }

.panel-card {
    padding: 22px;
    margin-bottom: 24px;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.service-pill {
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}
.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
}
.resources-meters {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.meter-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.meter-bar {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
}
.meter-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.stats-counter-row {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
}
.stat-box {
    text-align: center;
}
.stat-count {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}
.stat-title {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Data Tables
   ========================================================================== */
.view-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}
.view-header-text h3 {
    font-size: 18px;
    font-weight: 800;
}
.view-header-text p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.table-card {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}
html[dir="ltr"] .data-table {
    text-align: left;
}
.data-table th {
    padding: 10px 14px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table .btn {
    min-height: 26px;
    padding: 3px 8px;
    font-size: 11.5px;
    border-radius: 5px;
}
.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ==========================================================================
   Webmail View
   ========================================================================== */
.webmail-layout {
    display: grid;
    grid-template-columns: 200px 340px 1fr;
    height: calc(100vh - var(--header-height) - 56px);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.webmail-folders {
    padding: 16px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
}
html[dir="ltr"] .webmail-folders {
    border-left: none;
    border-right: 1px solid var(--border-color);
}
.folder-list {
    list-style: none;
}
.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s;
}
.folder-item svg { width: 16px; height: 16px; }
.folder-name { flex: 1; }
.folder-badge {
    font-size: 11px;
    background: var(--bg-card-hover);
    padding: 2px 7px;
    border-radius: 9999px;
    color: var(--text-primary);
}
.folder-item.active {
    background: var(--primary-glow);
    color: var(--primary);
}
.folder-item.active .folder-badge {
    background: var(--primary);
    color: #ffffff;
}

.webmail-messages-pane {
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
html[dir="ltr"] .webmail-messages-pane {
    border-left: none;
    border-right: 1px solid var(--border-color);
}
.messages-toolbar {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}
.search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.search-box svg {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
html[dir="ltr"] .search-box svg {
    right: auto;
    left: 12px;
}
.search-box input {
    padding: 8px 12px;
    padding-right: 36px;
    font-size: 13px;
}
html[dir="ltr"] .search-box input {
    padding-right: 12px;
    padding-left: 36px;
}
.messages-list-scroll {
    flex: 1;
    overflow-y: auto;
}
.message-preview-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.message-preview-item:hover {
    background: var(--bg-card-hover);
}
.message-preview-item.active {
    background: var(--bg-card-active);
    border-right: 3px solid var(--primary);
}
html[dir="ltr"] .message-preview-item.active {
    border-right: none;
    border-left: 3px solid var(--primary);
}
.message-preview-item.unread .preview-from {
    font-weight: 800;
    color: var(--text-primary);
}
.message-preview-item.unread::before {
    content: '';
    position: absolute;
    top: 18px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
html[dir="ltr"] .message-preview-item.unread::before {
    right: auto;
    left: 6px;
}
.preview-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.preview-from { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.preview-date { font-size: 11px; color: var(--text-muted); }
.preview-subject { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-snippet { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.webmail-detail-pane {
    background: var(--bg-base);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.empty-detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}
.empty-detail-placeholder svg { width: 56px; height: 56px; }

.message-view-container {
    padding: 24px 28px;
}
.msg-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.msg-title-row h2 {
    font-size: 20px;
    font-weight: 800;
}
.msg-meta-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.sender-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.sender-details { flex: 1; }
.sender-name-row { font-size: 14px; color: var(--text-primary); }
.sender-email-tag { font-size: 12px; color: var(--text-muted); margin-right: 6px; }
.to-row { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.msg-date-col { font-size: 12px; color: var(--text-muted); }

.security-pills-row {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.msg-body-wrapper {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-color);
    min-height: 250px;
    color: var(--text-primary);
    line-height: 1.7;
}
.msg-attachments-section {
    margin-top: 24px;
}
.attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}
.attachment-card {
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.attachment-card:hover {
    border-color: var(--primary);
}

/* ==========================================================================
   Logs & Terminal
   ========================================================================== */
.logs-terminal-card {
    display: flex;
    flex-direction: column;
    height: 600px;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.logs-filter-bar {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}
.logs-filter-input {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}
.logs-filter-select {
    width: 200px;
    padding: 8px 12px;
    font-size: 13px;
}
.logs-terminal-body {
    flex: 1;
    background: #020617;
    padding: 16px 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #e2e8f0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.log-line {
    word-break: break-all;
    line-height: 1.4;
}
.log-time { color: #64748b; margin-left: 8px; }
html[dir="ltr"] .log-time { margin-left: 0; margin-right: 8px; }
.log-info { color: #38bdf8; }
.log-warn { color: #fbbf24; }
.log-error { color: #f87171; }
.log-security { color: #c084fc; font-weight: 700; }

/* ==========================================================================
   DNS Wizard Record Items
   ========================================================================== */
.dns-record-item {
    padding: 14px 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}
.record-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.record-host { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.record-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.record-value-row code {
    font-family: monospace;
    font-size: 13px;
    background: var(--bg-base);
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--text-primary);
    flex: 1;
    overflow-x: auto;
}
.code-wrap { word-break: break-all; }
.dns-score-card {
    padding: 14px 18px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.score-value { color: var(--primary); font-size: 16px; margin-right: 6px; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-box {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
.modal-lg { max-width: 680px; }
.modal-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 18px 20px; }
.modal-footer {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}
.modal-footer .btn {
    min-height: 32px;
    padding: 5px 14px;
    font-size: 12.5px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
    .webmail-layout {
        grid-template-columns: 80px 280px 1fr;
    }
}
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(100%);
    }
    html[dir="ltr"] .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    .app-main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    .mobile-only { display: inline-flex; }
    .webmail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .webmail-folders, .webmail-messages-pane {
        border: none;
    }
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==========================================================================
   Primary System Identity Card & Live Service Probe Styling
   ========================================================================== */
.primary-system-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.08) 50%, rgba(20, 26, 43, 0.85) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.primary-system-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.system-meta-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    flex-shrink: 0;
}
.system-meta-icon svg {
    width: 22px;
    height: 22px;
}

.system-meta-details {
    flex: 1;
    min-width: 240px;
}

.system-meta-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a5b4fc;
    margin-bottom: 6px;
}

.system-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.sys-item {
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sys-label {
    color: var(--text-muted);
    font-weight: 500;
}

.sys-val {
    color: #e0e7ff;
    font-weight: 600;
}

.sys-item code.sys-val {
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.system-meta-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Service Probe Table Styles */
.services-probe-table {
    width: 100%;
    border-collapse: collapse;
}

.services-probe-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.services-probe-table td {
    padding: 10px 14px;
    font-size: 12.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.service-title-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-type-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.probe-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.probe-online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.probe-offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.probe-blocked {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.probe-latency {
    font-size: 10px;
    opacity: 0.75;
    margin-right: 4px;
    margin-left: 4px;
}

.probe-actions-cell {
    display: flex;
    align-items: center;
    gap: 5px;
}

.probe-btn {
    padding: 3px 8px !important;
    min-height: 26px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
}

.probe-btn svg {
    width: 12px;
    height: 12px;
}

