:root {
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --primary-light: #40a9ff;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #f5222d;
  --dark: #001529;
  --gray: #595959;
  --light: #f0f2f5;
  --white: #ffffff;
  --bg-color: #f5f7fa;
  --border-color: #e8e8e8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none !important; color: inherit; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: var(--bg-color); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.header { height: 64px; background: linear-gradient(135deg, #001529 0%, #1890ff 50%, #096dd9 100%); display: flex; align-items: center; padding: 0 24px; justify-content: space-between; box-shadow: 0 2px 12px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 100; }
.header-left { display: flex; align-items: center; gap: 14px; }
.logo { height: 32px; width: auto; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.header-title { font-size: 18px; font-weight: 700; color: white; letter-spacing: 1px; }

.header-center { flex: 1; display: flex; justify-content: center; }
.search-wrapper { position: relative; width: 100%; max-width: 500px; }
.search-box { width: 100%; padding: 10px 16px 10px 44px; border: none; border-radius: 24px; font-size: 14px; outline: none; transition: all 0.3s; background: rgba(255,255,255,0.2); color: white; }
.search-box::placeholder { color: rgba(255,255,255,0.7); }
.search-box:focus { background: rgba(255,255,255,0.95); color: #333; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.search-box:focus::placeholder { color: #999; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.7); font-size: 14px; transition: all 0.3s; }
.search-box:focus + .search-icon { color: #1890ff; }

.header-right { display: flex; align-items: center; gap: 20px; }
.security-status { font-size: 13px; color: #52c41a; font-weight: 500; background: rgba(82,196,26,0.15); padding: 6px 14px; border-radius: 16px; }
#user-email { font-size: 14px; color: white; font-weight: 500; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.2); color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; border: 2px solid rgba(255,255,255,0.3); transition: all 0.3s; }
.user-avatar:hover { background: rgba(255,255,255,0.3); transform: scale(1.05); }
.btn-logout { padding: 8px 20px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; color: white; font-size: 13px; cursor: pointer; transition: all 0.3s; }
.btn-logout:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.5); }

.container { flex: 1; display: flex; overflow: hidden; }

.sidebar { width: 260px; background: white; border-right: 1px solid var(--border-color); display: flex; flex-direction: column; overflow-y: auto; box-shadow: 2px 0 12px rgba(0,0,0,0.04); }
.sidebar-header { padding: 20px; }
.btn-compose { width: 100%; padding: 14px 20px; background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%); color: white; border: none; border-radius: var(--radius-md); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 16px rgba(24, 144, 255, 0.4); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-compose:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(24, 144, 255, 0.5); }

.sidebar-nav { flex: 1; padding: 0 12px; }
.nav-group { margin-bottom: 4px; }
.nav-group-title { padding: 12px 16px; font-size: 12px; color: #999; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; }
.nav-item { display: flex; align-items: center; padding: 8px 16px; gap: 12px; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.25s; margin-bottom: 1px; font-size: 14px; position: relative; overflow: hidden; }
.nav-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); transform: scaleY(0); transition: transform 0.25s; }
.nav-item:hover { background: rgba(24, 144, 255, 0.06); }
.nav-item.active { background: rgba(24, 144, 255, 0.1); color: var(--primary); }
.nav-item.active::before { transform: scaleY(1); }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { font-size: 17px; color: #666; width: 22px; text-align: center; flex-shrink: 0; }
.nav-text { flex: 1; color: #333; }
.nav-count { background: var(--danger); color: white; font-size: 12px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 6px; flex-shrink: 0; }
.nav-count-danger { background: var(--danger); }
.nav-count-warning { background: var(--warning); }
.nav-expand { color: #999; font-size: 14px; flex-shrink: 0; }

.nav-divider { height: 1px; background: #f5f5f5; margin: 10px 0; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.storage-info { display: flex; justify-content: space-between; font-size: 13px; color: #666; }

.main-content { flex: 1; overflow-y: auto; padding: 24px; background: var(--bg-color); }

.mail-list { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.mail-list-header { padding: 20px 28px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; background: #fafafa; }
.header-left h2 { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.header-left .mail-count { font-size: 14px; color: #999; margin-left: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.mail-item { display: flex; align-items: center; padding: 16px 28px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: all 0.25s; gap: 14px; position: relative; }
.mail-item:hover { background: #f8fafc; }
.mail-item.unread { background: #f0f9ff; border-left: 3px solid var(--primary); }
.mail-item.unread .mail-subject, .mail-item.unread .mail-from { font-weight: 600; }
.mail-item.threat { border-left: 3px solid var(--danger); }

.mail-checkbox { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.mail-flag { font-size: 16px; width: 24px; color: #ffd700; }
.mail-from { flex: 0 0 180px; font-size: 14px; color: #1a1a2e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject { flex: 1; font-size: 14px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.threat-badge { background: #fff1f0; color: var(--danger); padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.spam-badge { background: #fffbe6; color: var(--warning); padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.mail-date { font-size: 13px; color: #999; white-space: nowrap; flex-shrink: 0; }
.mail-item-actions { display: flex; gap: 8px; opacity: 0; transition: opacity 0.25s; }
.mail-item:hover .mail-item-actions { opacity: 1; }
.mail-action-btn { padding: 6px; border: none; background: transparent; cursor: pointer; border-radius: var(--radius-sm); font-size: 14px; color: #666; }
.mail-action-btn:hover { background: rgba(24, 144, 255, 0.1); color: var(--primary); }

.filter-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #666; cursor: pointer; margin-right: 12px; }
.filter-checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.unread-count { background: rgba(24, 144, 255, 0.1); color: var(--primary); padding: 2px 10px; border-radius: 10px; font-size: 13px; font-weight: 500; margin-left: 8px; }

.pagination { padding: 16px 28px; border-top: 1px solid #f5f5f5; display: flex; align-items: center; justify-content: center; gap: 16px; background: #fafafa; }
.pagination-btn { padding: 8px 20px; border: 1px solid #d9d9d9; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; transition: all 0.3s; background: white; color: #666; }
.pagination-btn:hover:not(.disabled) { border-color: var(--primary); color: var(--primary); }
.pagination-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-info { font-size: 14px; color: #999; }

.empty-state { padding: 80px 24px; text-align: center; }
.empty-state .icon { font-size: 56px; margin-bottom: 20px; opacity: 0.6; }
.empty-state h3 { font-size: 18px; color: #999; }

.mail-view { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 32px; }
.mail-view-header { margin-bottom: 28px; }
.mail-view-header h2 { font-size: 24px; font-weight: 700; color: #1a1a2e; margin-bottom: 16px; line-height: 1.4; }
.mail-info { display: flex; gap: 28px; flex-wrap: wrap; }
.mail-info span { font-size: 14px; color: #666; }
.mail-info span strong { color: #333; }

.mail-body { font-size: 15px; line-height: 1.8; color: #444; padding: 24px; background: #f8fafc; border-radius: var(--radius-md); white-space: pre-wrap; }

.mail-actions { margin-top: 28px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn-action { padding: 11px 24px; border: 1px solid #d9d9d9; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; transition: all 0.3s; background: white; color: #666; font-weight: 500; }
.btn-action:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { border-color: var(--success); color: var(--success); }
.btn-success:hover { background: #f6ffed; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fff1f0; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.show { display: flex; }
.modal { background: white; border-radius: var(--radius-lg); width: 90%; max-width: 600px; overflow: hidden; box-shadow: var(--shadow-xl); animation: modalFadeIn 0.3s ease; }
@keyframes modalFadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px 28px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #fafafa 0%, #f5f7fa 100%); }
.modal-header h3 { font-size: 18px; font-weight: 600; color: #1a1a2e; }
.modal-close { font-size: 24px; color: #999; cursor: pointer; line-height: 1; transition: all 0.25s; }
.modal-close:hover { color: var(--primary); transform: rotate(90deg); }

.modal-body { padding: 28px; }
.compose-row { display: flex; gap: 14px; margin-bottom: 18px; align-items: center; }
.compose-row label { width: 60px; font-size: 14px; font-weight: 600; color: #333; }
.compose-row input { flex: 1; padding: 12px 16px; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: all 0.25s; }
.compose-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1); }
#compose-body { width: 100%; padding: 16px; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: 14px; min-height: 160px; resize: vertical; outline: none; transition: all 0.25s; }
#compose-body:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1); }

.modal-footer { padding: 20px 28px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 14px; background: #fafafa; }
.btn-send { padding: 12px 32px; background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%); color: white; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 16px rgba(24, 144, 255, 0.4); }
.btn-send:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(24, 144, 255, 0.5); }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.form-group input, .form-group select { width: 100%; padding: 12px 16px; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: all 0.25s; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1); }

.users-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.users-table th { text-align: left; padding: 14px 20px; background: #fafafa; font-weight: 600; font-size: 14px; color: #333; border-bottom: 2px solid #e8e8e8; }
.users-table td { padding: 14px 20px; border-bottom: 1px solid #f5f5f5; font-size: 14px; color: #666; }
.users-table tr:hover td { background: #f8fafc; }

.btn-edit { padding: 7px 14px; background: #f0f9ff; color: var(--primary); border: 1px solid #bae6fd; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: all 0.25s; }
.btn-edit:hover { background: #e0f2fe; }
.btn-delete { padding: 7px 14px; background: #fff1f0; color: var(--danger); border: 1px solid #ffccc7; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: all 0.25s; }
.btn-delete:hover { background: #ffe4e6; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-item { background: white; border-radius: var(--radius-md); padding: 28px; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid #e8e8e8; transition: all 0.3s; }
.stat-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-item .number { font-size: 36px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; }
.stat-item .label { font-size: 14px; color: #999; }
.stat-item.warning .number { color: var(--warning); }
.stat-item.danger .number { color: var(--danger); }

.stats-card { background: white; border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }

.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 24px; }
.stats-card-item { background: white; border-radius: var(--radius-md); padding: 28px; box-shadow: var(--shadow-sm); border: 1px solid #e8e8e8; transition: all 0.3s; position: relative; overflow: hidden; }
.stats-card-item::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stats-card-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stats-card-item .stats-icon { font-size: 36px; color: var(--primary); margin-bottom: 16px; }
.stats-card-item .stats-value { font-size: 32px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; }
.stats-card-item .stats-label { font-size: 14px; color: #999; }

.stats-trend { font-size: 13px; margin-top: 8px; }
.stats-trend.up { color: var(--success); }
.stats-trend.down { color: var(--danger); }

.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 24px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.page-header p { font-size: 14px; color: #999; }

.contacts-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 24px; }
.contact-item { background: white; border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid #e8e8e8; transition: all 0.3s; display: flex; align-items: center; gap: 16px; }
.contact-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(24, 144, 255, 0.3); }
.contact-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex-shrink: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 16px; font-weight: 600; color: #1a1a2e; margin-bottom: 4px; }
.contact-email { font-size: 13px; color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-phone { font-size: 13px; color: #666; margin-top: 4px; }

.threats-list { margin-top: 24px; }
.threat-item { background: white; border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid #e8e8e8; margin-bottom: 16px; transition: all 0.3s; display: flex; gap: 20px; align-items: flex-start; }
.threat-item:hover { box-shadow: var(--shadow-md); }
.threat-item.malware { border-left: 4px solid var(--danger); }
.threat-item.phishing { border-left: 4px solid var(--warning); }
.threat-icon { font-size: 40px; flex-shrink: 0; }
.threat-info { flex: 1; }
.threat-subject { font-size: 16px; font-weight: 600; color: #1a1a2e; margin-bottom: 8px; }
.threat-date { font-size: 13px; color: #999; margin-bottom: 8px; }
.threat-type { display: inline-block; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.threat-type.malware { background: #fff1f0; color: var(--danger); }
.threat-type.phishing { background: #fffbe6; color: var(--warning); }
.threat-actions { display: flex; gap: 12px; margin-top: 16px; }

.users-table { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-top: 24px; }
.users-table table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; padding: 16px 24px; background: linear-gradient(135deg, #fafafa 0%, #f5f7fa 100%); font-weight: 600; font-size: 14px; color: #333; border-bottom: 2px solid #e8e8e8; }
.users-table td { padding: 16px 24px; border-bottom: 1px solid #f5f5f5; font-size: 14px; color: #666; }
.users-table tr:hover td { background: #f8fafc; }
.users-table .role-admin { background: rgba(24, 144, 255, 0.1); color: var(--primary); padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.users-table .role-manager { background: rgba(114, 46, 209, 0.1); color: #722ed1; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.users-table .role-user { background: rgba(82, 196, 26, 0.1); color: var(--success); padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.users-table .status-active { color: var(--success); }
.users-table .status-inactive { color: #999; }

.ai-workbench { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; padding: 28px; }
.ai-card { background: white; border-radius: var(--radius-lg); padding: 32px; text-align: center; border: 1px solid #e8e8e8; transition: all 0.3s; position: relative; overflow: hidden; }
.ai-card::before { content: ''; position: absolute; top: -50%; right: -50%; width: 120px; height: 120px; background: radial-gradient(circle, rgba(24, 144, 255, 0.1) 0%, transparent 70%); border-radius: 50%; }
.ai-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(24, 144, 255, 0.3); }
.ai-icon { width: 72px; height: 72px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 32px; background: linear-gradient(135deg, rgba(24, 144, 255, 0.1) 0%, rgba(114, 46, 209, 0.1) 100%); color: var(--primary); position: relative; z-index: 1; }
.ai-card h3 { font-size: 18px; font-weight: 600; color: #1a1a2e; margin-bottom: 12px; position: relative; z-index: 1; }
.ai-card p { font-size: 14px; color: #666; line-height: 1.6; margin-bottom: 24px; position: relative; z-index: 1; }

.ai-detail { padding: 28px; }
.ai-detail p { font-size: 15px; color: #595959; line-height: 1.8; margin-bottom: 28px; }
.ai-stats { display: flex; gap: 28px; }

.search-form { padding: 28px; text-align: center; }
.search-options { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.search-options label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #666; cursor: pointer; }
.search-options input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

@media (max-width: 768px) {
    .sidebar { width: 80px; }
    .nav-text, .nav-group-title, .nav-count, .nav-expand { display: none; }
    .nav-item { justify-content: center; padding: 14px; }
    .mail-from { flex: 0 0 100px; }
    .header-title { display: none; }
}
