/* ============================================
   KYUBIN - Express Delivery
   Linear-Inspired AI Chat Aesthetic
   ============================================ */

:root {
  /* Cool Minimal Palette */
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-muted: #A5B4FC;

  /* Accent for AI features */
  --ai: #8B5CF6;
  --ai-light: #F5F3FF;

  /* Neutrals - Linear style */
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-hover: #F4F4F5;
  --bg-input: #FAFAFA;
  --text: #18181B;
  --text-secondary: #52525B;
  --text-muted: #A1A1AA;
  --text-light: #D4D4D8;
  --border: #E4E4E7;
  --border-light: #F4F4F5;

  /* Category colors - muted */
  --cat-important: #EF4444;
  --cat-promo: #8B5CF6;
  --cat-social: #3B82F6;
  --cat-updates: #10B981;
  --cat-followup: #F59E0B;

  /* Provider colors */
  --provider-gmail: #EA4335;
  --provider-purelymail: #6366F1;
  --provider-fastmail: #69B3E7;
  --provider-imap: #71717A;

  /* Spacing */
  --sidebar-width: 240px;
  --header-height: 52px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   AUTH SCREEN
   ============================================ */
.auth-container {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--primary-light) 100%);
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 380px;
  width: 100%;
  box-shadow:
    0 0 0 1px var(--border),
    0 8px 40px rgba(0,0,0,0.08);
  text-align: center;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
}

.auth-logo svg {
  width: 28px;
  height: 28px;
}

.auth-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
}

.auth-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-light);
}

.auth-btn img {
  width: 18px;
  height: 18px;
}

.auth-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.auth-btn-primary:hover {
  background: var(--primary-hover, #4f46e5);
  border-color: var(--primary-hover, #4f46e5);
}

.auth-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
}

.auth-btn-ghost:hover {
  background: var(--primary-light);
  border-color: transparent;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 14px;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.auth-form input:focus {
  border-color: var(--primary);
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-container {
  display: none;
  height: 100vh;
  background: var(--bg);
}

.app-container.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   HEADER - Minimal
   ============================================ */
.header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.header-logo {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  margin-right: 4px;
}

.header-logo svg {
  color: var(--primary);
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
  display: flex;
  align-items: center;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text);
  transition: all 0.15s ease;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.header-search input {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* ============================================
   BUTTONS - Refined
   ============================================ */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  white-space: nowrap;
}

.btn i {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn-ai {
  background: var(--ai);
  color: white;
}

.btn-ai:hover {
  background: #7C3AED;
}

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

/* ============================================
   AVATAR
   ============================================ */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.avatar:hover {
  box-shadow: 0 0 0 2px var(--primary-muted);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ============================================
   SIDEBAR - Clean
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-section {
  padding: 12px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding: 0 10px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 450;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item i {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.sidebar-item.active i {
  opacity: 1;
}

.sidebar-item .badge {
  margin-left: auto;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-item.active .badge {
  background: var(--primary);
  color: white;
}

/* Category indicators - subtle dots */
.sidebar-item[data-view="important"]::before,
.sidebar-item[data-view="promo"]::before,
.sidebar-item[data-view="social"]::before,
.sidebar-item[data-view="updates"]::before,
.sidebar-item[data-view="followup"]::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: -4px;
}

.sidebar-item[data-view="important"]::before { background: var(--cat-important); }
.sidebar-item[data-view="promo"]::before { background: var(--cat-promo); }
.sidebar-item[data-view="social"]::before { background: var(--cat-social); }
.sidebar-item[data-view="updates"]::before { background: var(--cat-updates); }
.sidebar-item[data-view="followup"]::before { background: var(--cat-followup); }

/* Hide old category icon colors */
.cat-important i, .cat-promo i, .cat-social i, .cat-updates i, .cat-followup i {
  color: inherit !important;
}

/* ============================================
   ACCOUNT ITEMS - Compact
   ============================================ */
.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  font-size: 13px;
}

.account-item:hover {
  background: var(--bg-hover);
}

.account-item.active {
  background: var(--primary-light);
}

.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.account-avatar.gmail { background: var(--provider-gmail); }
.account-avatar.purelymail { background: var(--provider-purelymail); }
.account-avatar.fastmail { background: var(--provider-fastmail); }
.account-avatar.imap { background: var(--provider-imap); }

.account-info {
  flex: 1;
  min-width: 0;
}

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

.account-provider {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.add-account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.1s ease;
}

.add-account-btn:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.add-account-btn i {
  width: 16px;
  height: 16px;
}

/* ============================================
   CONVERSATION LIST - Chat Style
   ============================================ */
.email-list-container {
  width: 320px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

.email-list-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-list-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  color: var(--text);
}

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

/* Conversation item - card style */
.email-item {
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.1s ease;
  border-bottom: 1px solid var(--border-light);
}

.email-item:hover {
  background: var(--bg-hover);
}

.email-item.active {
  background: var(--primary-light);
  border-left: 2px solid var(--primary);
  margin-left: -1px;
}

.email-item.unread {
  background: var(--bg-card);
}

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

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

.email-from {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.email-from-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
}

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

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

.email-snippet {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Category badge - minimal */
.email-category-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  text-transform: capitalize;
}

.email-category-badge.important { background: #FEE2E2; color: #DC2626; }
.email-category-badge.promo { background: #F3E8FF; color: #7C3AED; }
.email-category-badge.social { background: #DBEAFE; color: #2563EB; }
.email-category-badge.updates { background: #D1FAE5; color: #059669; }
.email-category-badge.followup { background: #FEF3C7; color: #D97706; }

/* ============================================
   CONVERSATION VIEW - Chat Bubbles
   ============================================ */
.email-detail-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.email-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-direction: column;
  gap: 12px;
}

.email-detail-empty i {
  width: 40px;
  height: 40px;
  opacity: 0.5;
}

.email-detail-empty span {
  font-size: 14px;
}

/* Conversation header */
.email-detail-header {
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.email-detail-subject {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.email-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-detail-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.email-detail-from {
  flex: 1;
}

.email-detail-from-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.email-detail-from-email {
  font-size: 12px;
  color: var(--text-muted);
}

.email-detail-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Message body - chat bubble style */
.email-detail-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-detail-body > * {
  max-width: 680px;
}

.email-detail-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* Quick actions bar */
.email-detail-actions {
  padding: 16px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ============================================
   AI SUMMARY - Floating Card
   ============================================ */
.ai-summary-panel {
  background: var(--ai-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid #DDD6FE;
}

.ai-summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ai);
}

.ai-summary-header i {
  width: 16px;
  height: 16px;
}

.ai-summary-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ai-key-points {
  margin-top: 10px;
  padding-left: 18px;
  font-size: 13px;
}

.ai-key-points li {
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.ai-action-required {
  margin-top: 12px;
  padding: 10px 12px;
  background: #FEF2F2;
  border-radius: var(--radius-sm);
  color: #DC2626;
  font-weight: 500;
  font-size: 12px;
}

/* ============================================
   CONNECT PROMPT
   ============================================ */
.connect-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.connect-prompt i {
  width: 48px;
  height: 48px;
  color: var(--text-light);
}

.connect-prompt h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.connect-prompt p {
  color: var(--text-muted);
  max-width: 280px;
  font-size: 14px;
}

/* ============================================
   LOADING & SPINNER
   ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 10px;
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}

/* ============================================
   SKELETON LOADER
   ============================================ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bg-hover) 25%,
    var(--border-light) 50%,
    var(--bg-hover) 75%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  margin-bottom: 8px;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 180px;
  z-index: 100;
  display: none;
  overflow: hidden;
}

.dropdown-menu.active {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.1s ease;
  color: var(--text-secondary);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.dropdown-item i {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ============================================
   MODAL - Clean & Focused
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}

.modal.wide {
  max-width: 640px;
}

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

.modal-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  transition: all 0.1s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-close i {
  width: 18px;
  height: 18px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  gap: 10px;
  background: var(--bg);
}

/* ============================================
   FORMS
   ============================================ */
.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: all 0.15s ease;
}

.form-field input::placeholder {
  color: var(--text-muted);
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

/* ============================================
   PROVIDER SELECTION
   ============================================ */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.provider-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-card);
}

.provider-card:hover {
  border-color: var(--primary-muted);
  background: var(--primary-light);
}

.provider-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.provider-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  margin-bottom: 8px;
}

.provider-card-icon img {
  width: 28px;
  height: 28px;
}

.provider-card-icon i {
  width: 28px;
  height: 28px;
}

.provider-icon-purelymail i { color: var(--provider-purelymail); }
.provider-icon-fastmail i  { color: var(--provider-fastmail); }
.provider-icon-imap i      { color: var(--provider-imap); }

.provider-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.provider-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   COMPOSE - Chat Input Style
   ============================================ */
.compose-field {
  margin-bottom: 14px;
}

.compose-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.compose-field input,
.compose-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
}

.compose-field input:focus,
.compose-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.compose-recipients {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  background: var(--bg-card);
}

.compose-recipients:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.compose-recipients input {
  flex: 1;
  min-width: 100px;
  border: none;
  padding: 4px 0;
  font-size: 14px;
  background: transparent;
}

.compose-recipients input:focus {
  outline: none;
  box-shadow: none;
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.recipient-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  padding: 0;
  display: flex;
  opacity: 0.7;
}

.recipient-chip button:hover {
  opacity: 1;
}

/* Quill editor - minimal */
.compose-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}

.compose-editor .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 8px;
}

.compose-editor .ql-container {
  border: none;
  font-size: 14px;
  min-height: 180px;
}

.compose-editor .ql-editor {
  min-height: 180px;
  line-height: 1.7;
  color: var(--text);
}

.compose-editor .ql-editor::before {
  color: var(--text-muted);
  font-style: normal;
}

/* ============================================
   AI COMPOSE HELPER - Prominent
   ============================================ */
.ai-compose-helper {
  background: linear-gradient(135deg, var(--ai-light) 0%, #EDE9FE 100%);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #DDD6FE;
}

.ai-compose-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ai);
}

.ai-compose-header i {
  width: 16px;
  height: 16px;
}

.ai-compose-input {
  display: flex;
  gap: 8px;
}

.ai-compose-input input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #DDD6FE;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: white;
  color: var(--text);
}

.ai-compose-input input::placeholder {
  color: var(--text-muted);
}

.ai-compose-input input:focus {
  outline: none;
  border-color: var(--ai);
  box-shadow: 0 0 0 3px var(--ai-light);
}

.ai-compose-options {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.ai-compose-options select {
  padding: 6px 10px;
  border: 1px solid #DDD6FE;
  border-radius: 6px;
  font-size: 12px;
  background: white;
  color: var(--ai);
  cursor: pointer;
}

.ai-compose-options select:focus {
  outline: none;
  border-color: var(--ai);
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.settings-row label {
  font-size: 13px;
  color: var(--text-secondary);
}

.settings-row select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
}

/* Toggle switch - refined */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
}

.toast.error {
  background: #DC2626;
}

.toast.success {
  background: #059669;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .sidebar {
    width: 200px;
  }

  .email-list-container {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .email-list-container {
    width: 100%;
    border-right: none;
  }

  .email-detail-container {
    display: none;
  }

  .email-detail-container.active {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 50;
  }

  .provider-grid {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }
}
