/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --danger: #d93025;
  --danger-light: #fce8e6;
  --warning: #f9ab00;
  --warning-light: #fef7e0;
  --success: #1e8e3e;
  --success-light: #e6f4ea;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fc;
  --bg-hover: #f1f3f4;
  --bg-active: #d3e3fd;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.15);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.2);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 50%;
  --sidebar-width: 256px;
  --header-height: 64px;
  --transition: all 0.2s ease;
  --star-color: #f4b400;
}

/* Dark theme */
[data-theme="dark"] {
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #80868b;
  --bg-primary: #1f1f1f;
  --bg-secondary: #2d2d2d;
  --bg-hover: #3c3c3c;
  --bg-active: #174ea6;
  --border: #3c3c3c;
  --border-light: #333333;
  --primary-light: #174ea6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}

html {
  font-size: 14px;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--border); }

.btn-text {
  background: transparent;
  color: var(--text-secondary);
}
.btn-text:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #c5221f; }

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ===== AUTH SCREEN ===== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.auth-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  color: white;
}

.auth-header h1 {
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-form h2 {
  font-size: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

.form-group label i {
  width: 16px;
  margin-right: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.auth-switch a:hover { text-decoration: underline; }

.demo-info {
  margin-top: 20px;
  padding: 12px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

.demo-info strong { color: var(--primary); }

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
}

.logo i { font-size: 28px; }

.header-center {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  height: 44px;
  border: 1px solid transparent;
  transition: var(--transition);
}

.search-bar:focus-within {
  background: var(--bg-primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.search-bar i {
  color: var(--text-muted);
  margin-right: 12px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 120px;
  justify-content: flex-end;
}

.user-menu {
  position: relative;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.user-avatar:hover { opacity: 0.85; }

.user-dropdown {
  position: absolute;
  right: 0;
  top: 48px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 200;
}

.user-info {
  padding: 20px;
  text-align: center;
}

.user-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: white;
  margin: 0 auto 12px;
}

.user-name {
  font-weight: 600;
  font-size: 16px;
}

.user-email {
  color: var(--text-muted);
  font-size: 13px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item i { width: 20px; color: var(--text-secondary); }

/* ===== MAIN LAYOUT ===== */
.main-content {
  display: flex;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 68px;
  padding: 16px 8px;
}

.sidebar.collapsed .btn-compose span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .badge {
  display: none;
}

.sidebar.collapsed .btn-compose {
  padding: 12px;
  justify-content: center;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.btn-compose {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  width: 100%;
}

.btn-compose:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-compose i { font-size: 18px; }

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}

.badge-warning { background: var(--warning); color: #333; }

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
}

.storage-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.storage-used {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.storage-info p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Quota Info */
.quota-info {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.quota-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.quota-header i {
  color: var(--primary);
}

.quota-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.quota-used {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s ease;
  background: var(--primary);
}

.quota-used.warning { background: #f59e0b; }
.quota-used.danger { background: #ef4444; }

.quota-text {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* Compose quota badge */
.compose-quota-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--bg-hover);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.compose-quota-badge i {
  color: var(--primary);
  font-size: 11px;
}

.compose-quota-badge.warning { background: #fef3c7; color: #92400e; }
.compose-quota-badge.warning i { color: #f59e0b; }
.compose-quota-badge.danger { background: #fee2e2; color: #991b1b; }
.compose-quota-badge.danger i { color: #ef4444; }

/* ===== EMAIL LIST ===== */
.email-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.email-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  min-height: 48px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right { color: var(--text-muted); font-size: 13px; }

.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  width: 20px;
  height: 20px;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  transition: var(--transition);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.batch-actions {
  display: flex;
  gap: 4px;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.email-item:hover {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--primary);
}

.email-item.unread {
  background: var(--primary-light);
  font-weight: 600;
}

.email-item.unread:hover {
  background: #d3e3fd;
}

.email-item.selected {
  background: var(--bg-active);
}

.email-item .checkbox-container { flex-shrink: 0; }

.email-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.email-star {
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.email-star:hover { color: var(--star-color); }
.email-star.starred { color: var(--star-color); }

.email-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.email-sender {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.email-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.email-subject {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400 !important;
}

.email-indicators {
  display: flex;
  gap: 6px;
  align-items: center;
}

.email-indicators i {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== EMAIL DETAIL ===== */
.email-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
}

.detail-actions {
  display: flex;
  gap: 4px;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.detail-subject {
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--text-primary);
  line-height: 1.4;
}

.detail-meta {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.detail-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.detail-sender-info { flex: 1; }

.detail-sender-name {
  font-weight: 600;
  font-size: 15px;
}

.detail-sender-email {
  color: var(--text-muted);
  font-size: 13px;
}

.detail-to {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.detail-date-full {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.detail-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.detail-body p { margin-bottom: 12px; }

.detail-reply-box {
  margin-top: 32px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.detail-reply-box:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ===== COMPOSE MODAL ===== */
.compose-modal {
  position: fixed;
  bottom: 0;
  right: 24px;
  z-index: 300;
}

.compose-window {
  width: 560px;
  background: var(--bg-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.compose-header h3 { font-size: 14px; font-weight: 500; }

.compose-header-actions {
  display: flex;
  gap: 4px;
}

.compose-header-actions .btn-icon {
  color: var(--bg-primary);
  width: 32px;
  height: 32px;
}

.compose-header-actions .btn-icon:hover {
  background: rgba(255,255,255,0.1);
}

.compose-body {
  flex: 1;
  overflow-y: auto;
}

.compose-field {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
}

.compose-field label {
  font-size: 13px;
  color: var(--text-muted);
  width: 60px;
  flex-shrink: 0;
}

.compose-field input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
}

.compose-provider-field select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.compose-provider-field select:focus {
  border-color: var(--primary-color);
}

.compose-provider-field label {
  width: auto;
  white-space: nowrap;
  gap: 4px;
}

.compose-provider-field label i {
  margin-right: 4px;
  color: var(--primary-color);
}

.compose-editor { flex: 1; min-height: 200px; display: flex; flex-direction: column; }

.editor-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-light);
  gap: 2px;
}

.editor-toolbar .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.editor-content {
  flex: 1;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
  min-height: 200px;
  color: var(--text-primary);
}

.editor-content:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
}

.compose-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.compose-footer .btn-text { margin-left: auto; }

/* ===== ATTACHMENTS ===== */
.attachments-preview {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
  max-height: 140px;
  overflow-y: auto;
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 12px;
  max-width: 220px;
  position: relative;
}

.attachment-item .att-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.attachment-item .att-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--primary);
  font-size: 14px;
  flex-shrink: 0;
}

.attachment-item .att-info {
  flex: 1;
  min-width: 0;
}

.attachment-item .att-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text-primary);
}

.attachment-item .att-size {
  color: var(--text-muted);
  font-size: 11px;
}

.attachment-item .att-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 12px;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}

.attachment-item .att-remove:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Detail view attachments */
.detail-attachments {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.detail-attachments h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.detail-attachments h4 i {
  margin-right: 6px;
}

.detail-att-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-att-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.detail-att-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.detail-att-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.detail-att-item .att-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--primary);
  font-size: 18px;
}

.detail-att-item .att-name {
  font-size: 13px;
  font-weight: 500;
}

.detail-att-item .att-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* Inline image in editor */
.editor-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
}

/* ===== SETTINGS MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 { font-size: 18px; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section h4 {
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 48px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 48px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: slideIn 0.3s ease forwards;
  max-width: 400px;
}

.toast.toast-success { background: var(--success); color: white; }
.toast.toast-error { background: var(--danger); color: white; }
.toast.toast-warning { background: var(--warning); color: #333; }

.toast-action {
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.toast-action:hover { background: rgba(255,255,255,0.1); }

@keyframes slideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: var(--header-height);
    bottom: 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    left: 0;
  }

  .header-left { min-width: auto; }
  .logo span { display: none; }
  .header-center { padding: 0 8px; }

  .compose-window {
    width: calc(100vw - 16px);
    right: 8px;
  }

  .email-sender { max-width: 120px; }
}

@media (max-width: 480px) {
  .email-avatar { display: none; }
  .header-center { display: none; }
}
