/* ==========================================================================
   Baba AI Webmail - Dedicated Mail Panel & Manager Stylesheet
   Modern AgriTech Glassmorphism Design System (RTL)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-base: #0a0a0f;
  --bg-primary: #11111a;
  --bg-secondary: #171724;
  --bg-surface: rgba(23, 23, 36, 0.75);
  --bg-surface-hover: rgba(35, 35, 54, 0.85);
  --bg-glass: rgba(20, 20, 32, 0.65);
  
  --primary: #e63946;
  --primary-light: #ff6b6b;
  --primary-dark: #c52233;
  --primary-glow: rgba(230, 57, 70, 0.28);
  
  --accent: #ff8c42;
  --accent-light: #ffa970;
  --accent-glow: rgba(255, 140, 66, 0.25);
  
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.25);
  
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --success: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-glow: rgba(230, 57, 70, 0.35);
  
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --header-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  height: 100vh;
  overflow: hidden;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(230, 57, 70, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.08) 0%, transparent 45%);
}

/* App Structure */
.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==================== Global Header ==================== */
.mail-header {
  height: var(--header-height);
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  flex-shrink: 0;
}

.mail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  height: 34px;
  width: auto;
}

.brand-badge {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.domain-tag {
  font-size: 11px;
  color: var(--primary-light);
  font-family: monospace;
  font-weight: 600;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 2px 10px var(--primary-glow);
}

.badge-count {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-full);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #042f2e;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
}

/* ==================== Main Views ==================== */
.mail-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}

/* Auth View */
.auth-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(16, 185, 129, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 26px;
}

.auth-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.auth-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-quick-login {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.quick-title {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 10px;
}

.quick-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: right;
}

.chip:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--border-glow);
  color: var(--text-main);
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.chip .dot.admin {
  background: var(--accent);
}

/* ==================== Webmail Layout ==================== */
.webmail-view {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Sidebar */
.mail-sidebar {
  width: 240px;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 16px;
  flex-shrink: 0;
}

.btn-compose {
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all 0.2s ease;
}

.btn-compose:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.folder-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.folder-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-light);
  font-weight: 600;
}

.folder-badge {
  margin-right: auto;
  background: var(--primary);
  color: #042f2e;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.sidebar-quota {
  padding: 14px 10px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.quota-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.quota-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Messages Column */
.messages-column {
  width: 380px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.messages-toolbar {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
}

.message-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.message-item:hover {
  background: var(--bg-surface-hover);
}

.message-item.active {
  background: rgba(16, 185, 129, 0.08);
  border-right: 3px solid var(--primary);
}

.message-item.unread .item-subject {
  font-weight: 700;
  color: var(--text-main);
}

.message-item.unread .unread-dot {
  display: block;
}

.item-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.item-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 2px;
  display: flex;
}

.star-btn.starred {
  color: var(--warning);
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.item-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-time {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.item-subject {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.item-snippet {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  top: 16px;
  left: 12px;
  display: none;
}

/* Reader Column */
.reader-column {
  flex: 1;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-dim);
  padding: 40px;
  text-align: center;
}

.reader-empty h3 {
  font-size: 16px;
  color: var(--text-muted);
}

.reader-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 30px;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-date {
  font-size: 12px;
  color: var(--text-dim);
}

.reader-subject {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
  line-height: 1.4;
}

.reader-sender-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-dark), var(--accent-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
}

.sender-name-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.sender-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.sender-email {
  font-size: 12px;
  color: var(--text-muted);
  direction: ltr;
}

.recipient-line {
  font-size: 12px;
  color: var(--text-dim);
}

.attachments-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 24px;
}

.attachments-title {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.attachment-chip:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--border-glow);
}

.reader-body-wrap {
  flex: 1;
  background: rgba(10, 15, 29, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  color: #cbd5e1;
  line-height: 1.8;
  font-size: 14px;
}

/* ==================== Accounts View ==================== */
.accounts-view, .settings-view {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 30px 40px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.header-titles h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.header-titles p {
  font-size: 13px;
  color: var(--text-muted);
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.account-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
}

.account-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.account-badge-role {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-right: auto;
}

.role-admin {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-light);
  border: 1px solid var(--accent);
}

.role-user {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-light);
  border: 1px solid var(--primary);
}

.account-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

/* ==================== Settings & DNS View ==================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.col-span-2 {
  grid-column: span 2;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.dns-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dns-table th, .dns-table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
}

.dns-table th {
  background: rgba(10, 15, 29, 0.9);
  color: var(--text-dim);
  font-weight: 600;
}

.badge-record {
  font-weight: bold;
  font-family: monospace;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.dns-status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 15, 29, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.success {
  background: var(--success);
  box-shadow: 0 0 10px var(--primary-glow);
}

.status-indicator.warning {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.test-actions-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== Form Controls & Buttons ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-with-icon, .input-tag-wrap, .input-with-suffix {
  display: flex;
  align-items: center;
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: all 0.2s ease;
}

.input-with-icon:focus-within, .input-tag-wrap:focus-within, .input-with-suffix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.input-with-icon input, .input-tag-wrap input, .input-with-suffix input, select, textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 0;
}

textarea {
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 12px;
  resize: vertical;
}

select {
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.suffix-text {
  font-size: 12px;
  color: var(--primary-light);
  direction: ltr;
  font-weight: 600;
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.col-4 { flex: 4; }
.col-6 { flex: 6; }
.col-8 { flex: 8; }

.radio-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(10, 15, 29, 0.6);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a1003;
  font-weight: 700;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.text-danger {
  color: var(--danger) !important;
}

/* ==================== Modals ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.compose-dialog {
  max-width: 720px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  background: rgba(10, 15, 29, 0.6);
}

/* ==================== Toasts ==================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease;
}

.toast.success { border-color: var(--primary); }
.toast.error { border-color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .mail-sidebar { width: 70px; padding: 12px 6px; }
  .mail-sidebar span:not(.badge-count) { display: none; }
  .btn-compose span { display: none; }
  .sidebar-quota { display: none; }
  .messages-column { width: 300px; }
  .settings-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
}

@media (max-width: 680px) {
  .mail-header { padding: 0 12px; }
  .brand-badge { display: none; }
  .messages-column { width: 100%; }
  .reader-column { display: none; }
}


.brand-robot-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(230, 57, 70, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.brand-gradient-text {
  background: linear-gradient(135deg, #e63946, #ff6b6b, #ff8c42);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
