/* ==================== PHONEMAIL TIRANGA (INDIAN FLAG) DESIGN SYSTEM ====================
   Kesari Saffron: #FF671F | Chakra Navy: #06038D / #1E3A8A | India Green: #046A38 / #10B981
   Supports both Light (Daylight Bharat) and Dark (Midnight Chakra) Themes
======================================================================================== */

:root, [data-theme="light"] {
  --theme-mode: 'light';
  --bg-app: #fbfdfc;
  --bg-surface: #ffffff;
  --bg-subtle: #f0f5f2;
  --bg-hover: #e6efe9;
  --border-light: #dde6e1;
  --border-focus: #FF671F;
  
  /* Indian Tricolor Accents */
  --saffron-main: #FF671F;
  --saffron-dark: #e0530e;
  --saffron-subtle: #fff7ed;
  --saffron-border: #fed7aa;
  
  --green-main: #046A38;
  --green-dark: #034f2a;
  --green-vibrant: #10B981;
  --green-subtle: #ecfdf5;
  --green-border: #a7f3d0;
  
  --chakra-navy: #06038D;
  --chakra-blue: #1E3A8A;
  --chakra-subtle: #eff6ff;
  
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;
  --accent-rose-subtle: #fef2f2;
  
  /* High-Contrast Typography */
  --text-main: #0b1727;
  --text-muted: #3d5147;
  --text-dim: #7a8f83;
  
  --shadow-sm: 0 1px 2px rgba(6, 46, 36, 0.04);
  --shadow-card: 0 1px 3px rgba(6, 46, 36, 0.04), 0 4px 12px -2px rgba(6, 46, 36, 0.03);
  --shadow-hover: 0 4px 16px -2px rgba(6, 46, 36, 0.08), 0 2px 4px -1px rgba(6, 46, 36, 0.03);
  --shadow-modal: 0 20px 40px -8px rgba(6, 46, 36, 0.16), 0 8px 16px -4px rgba(6, 46, 36, 0.06);
}

[data-theme="dark"] {
  --theme-mode: 'dark';
  --bg-app: #080e1a;
  --bg-surface: #0f1a2e;
  --bg-subtle: #0b1322;
  --bg-hover: #16243d;
  --border-light: rgba(255, 255, 255, 0.09);
  --border-focus: #FF7722;
  
  /* Indian Tricolor Accents (Dark Mode Adjusted) */
  --saffron-main: #FF7722;
  --saffron-dark: #FF671F;
  --saffron-subtle: rgba(255, 103, 31, 0.14);
  --saffron-border: rgba(255, 103, 31, 0.35);
  
  --green-main: #10B981;
  --green-dark: #059669;
  --green-vibrant: #34d399;
  --green-subtle: rgba(16, 185, 129, 0.14);
  --green-border: rgba(16, 185, 129, 0.35);
  
  --chakra-navy: #3b82f6;
  --chakra-blue: #60a5fa;
  --chakra-subtle: rgba(59, 130, 246, 0.14);
  
  --accent-amber: #fbbf24;
  --accent-rose: #f87171;
  --accent-rose-subtle: rgba(239, 68, 68, 0.15);
  
  /* High-Contrast Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 20px 40px -8px rgba(0, 0, 0, 0.8), 0 8px 16px -4px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  font-size: 14px;
}

/* ==================== TIRANGA TOP ACCENT RIBBON ==================== */
.tiranga-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, 
    #FF671F 0%, #FF671F 33.33%, 
    #ffffff 33.33%, #ffffff 66.66%, 
    #046A38 66.66%, #046A38 100%);
  z-index: 99999;
}

[data-theme="dark"] .tiranga-ribbon {
  background: linear-gradient(90deg, 
    #FF7722 0%, #FF7722 33.33%, 
    #cbd5e1 33.33%, #cbd5e1 66.66%, 
    #10B981 66.66%, #10B981 100%);
}

/* ==================== BUTTONS ==================== */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: all 0.18s ease;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--green-main) 0%, var(--green-dark) 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(4, 106, 56, 0.35);
  transition: all 0.18s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(4, 106, 56, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.full-width {
  width: 100%;
}

/* ==================== AUTH SCREEN ==================== */
.auth-wrapper {
  position: fixed;
  inset: 0;
  top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  padding: 20px;
  z-index: 5000;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--shadow-modal);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--saffron-subtle);
  border: 1px solid var(--saffron-border);
  color: var(--saffron-dark);
  font-weight: 700;
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 9999px;
  margin-bottom: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

[data-theme="dark"] .brand-badge {
  color: var(--saffron-main);
}

.online-dot {
  width: 8px;
  height: 8px;
  background: var(--green-vibrant);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--green-vibrant);
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.saffron-text { color: var(--saffron-main); }
.green-text { color: var(--green-main); }

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 26px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.demo-pill-btn {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-main);
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  padding: 3px 8px;
  border-radius: 6px;
}

.input-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  transition: all 0.15s ease;
}

.input-box:focus-within {
  border-color: var(--saffron-main);
  box-shadow: 0 0 0 3px var(--saffron-subtle);
}

.flag-addon {
  font-weight: 700;
  color: var(--text-main);
  font-size: 13.5px;
}

.input-addon {
  margin-right: 10px;
  font-size: 15px;
}

.input-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14.5px;
  color: var(--text-main);
  font-weight: 600;
  background: transparent;
}

.terms-disclaimer {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.4;
  text-align: center;
}

.terms-disclaimer a {
  color: var(--saffron-main);
  text-decoration: underline;
  font-weight: 600;
}

.auth-footer-note {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
}

/* ==================== TELEGRAM-STYLE REAL-TIME OTP VERIFICATION ==================== */
.telegram-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.telegram-icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 103, 31, 0.15), rgba(4, 106, 56, 0.15));
  border: 1.5px solid var(--saffron-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px -2px rgba(255, 103, 31, 0.2);
}

.telegram-phone-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 6px 14px;
  border-radius: 9999px;
  margin: 10px 0 14px;
}

.telegram-phone-number {
  font-family: 'Outfit', monospace;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.telegram-edit-btn {
  background: none;
  border: none;
  color: var(--saffron-main);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
}

.telegram-edit-btn:hover {
  background: var(--saffron-subtle);
}

.telegram-otp-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 16px;
}

.telegram-otp-cell {
  width: 48px;
  height: 58px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-surface);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  color: var(--text-main);
  font-family: 'Outfit', monospace;
  outline: none;
  transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  -webkit-appearance: none;
  appearance: none;
}

.telegram-otp-cell:focus {
  border-color: var(--saffron-main);
  box-shadow: 0 0 0 4px var(--saffron-subtle), 0 4px 12px rgba(255, 103, 31, 0.18);
  transform: translateY(-2px);
}

.telegram-otp-cell.filled {
  border-color: var(--green-vibrant);
  background: var(--green-subtle);
  color: var(--green-dark);
}

[data-theme="dark"] .telegram-otp-cell.filled {
  color: var(--green-vibrant);
}

.telegram-otp-cell.error {
  border-color: var(--accent-rose) !important;
  background: var(--accent-rose-subtle) !important;
  color: var(--accent-rose) !important;
}

.telegram-otp-divider {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dim);
  user-select: none;
  padding: 0 2px;
}

/* Horizontal Shake on Invalid Code (Telegram Signature Error Animation) */
@keyframes telegramShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

.otp-shake {
  animation: telegramShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.otp-status-banner {
  min-height: 24px;
  font-size: 12.5px;
  text-align: center;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.otp-status-banner.error-text {
  color: var(--accent-rose);
  font-weight: 600;
}

.otp-status-banner.success-text {
  color: var(--green-vibrant);
  font-weight: 600;
}

.telegram-countdown-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-light);
}

.otp-timer-badge {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.otp-action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.otp-pill-action {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.otp-pill-action:hover {
  border-color: var(--saffron-main);
  color: var(--saffron-main);
  transform: translateY(-1px);
}

.otp-pill-action.voice-call-btn {
  border-color: var(--green-border);
  background: var(--green-subtle);
  color: var(--green-main);
}

.otp-pill-action.voice-call-btn:hover {
  background: var(--green-main);
  color: #fff;
}

.otp-pill-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.otp-live-hint-card {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--saffron-subtle);
  border: 1px solid var(--saffron-border);
  color: var(--saffron-dark);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

[data-theme="dark"] .otp-live-hint-card {
  color: var(--saffron-main);
}

.otp-quick-fill-btn {
  background: var(--saffron-main);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.otp-quick-fill-btn:hover {
  background: var(--saffron-dark);
}

/* ==================== TELEGRAM STEP 3: PROFILE REGISTRATION ==================== */
.profile-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}

.profile-avatar-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron-main), var(--green-main));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 8px 24px -4px rgba(255, 103, 31, 0.35);
  margin-bottom: 8px;
  transition: transform 0.2s ease;
}

.profile-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.alias-tag-picker {
  margin-top: 14px;
  margin-bottom: 20px;
}

.alias-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.alias-chip {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.alias-chip:hover {
  border-color: var(--saffron-main);
  color: var(--saffron-main);
}

.alias-chip.selected {
  background: var(--saffron-subtle);
  border-color: var(--saffron-main);
  color: var(--saffron-dark);
  font-weight: 700;
}

[data-theme="dark"] .alias-chip.selected {
  color: var(--saffron-main);
}

/* ==================== TOP NAVIGATION BAR ==================== */
.main-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

.top-nav-bar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 8px;
  background: transparent;
}

.menu-toggle-btn:hover {
  background: var(--bg-subtle);
}

.menu-toggle-btn .bar {
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--green-subtle);
  color: var(--green-main);
  border: 1px solid var(--green-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.tiranga-tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  color: var(--green-main);
  padding: 2px 7px;
  border-radius: 9999px;
  margin-left: 2px;
}

.phone-handle-chip {
  display: inline-flex;
  align-items: center;
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  color: var(--green-main);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
}

.nav-center {
  flex: 1;
  max-width: 580px;
  margin: 0 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  padding: 7px 16px;
  transition: all 0.15s ease;
}

.search-bar:focus-within {
  background: var(--bg-surface);
  border-color: var(--saffron-main);
  box-shadow: 0 0 0 3px var(--saffron-subtle);
}

.search-icon {
  font-size: 14px;
  margin-right: 10px;
  color: var(--text-dim);
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--text-main);
}

.kbd-hint {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.nav-icon-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-light);
}

.theme-toggle-btn {
  font-size: 17px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.theme-toggle-btn:hover {
  border-color: var(--saffron-main);
}

.user-avatar-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF671F 0%, #046A38 100%);
  color: #ffffff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ==================== WORKSPACE LAYOUT ==================== */
.app-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==================== SIDEBAR ==================== */
.sidebar-panel {
  width: 250px;
  min-width: 250px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s ease;
  z-index: 50;
}

.btn-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #046A38 0%, #059669 100%);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 3px 10px rgba(4, 106, 56, 0.35);
  margin-bottom: 22px;
  transition: all 0.18s ease;
}

.btn-compose:hover {
  background: linear-gradient(135deg, #03522b 0%, #047857 100%);
  box-shadow: 0 4px 16px rgba(4, 106, 56, 0.45);
  transform: translateY(-1px);
}

.compose-plus { font-size: 15px; }
.compose-text { flex: 1; text-align: left; }
.compose-kbd {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
}

.sidebar-group-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding-left: 10px;
}

.folder-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--green-subtle);
  color: var(--green-main);
  border-left: 3.5px solid var(--green-main);
  font-weight: 700;
}

.nav-icon { font-size: 16px; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--green-main);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 12px 6px 18px 6px;
}

/* Quick Aliases in Sidebar */
.alias-chips-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: auto;
}

.alias-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alias-chip:hover {
  border-color: var(--green-border);
  background: var(--green-subtle);
}

.chip-tag { font-weight: 600; color: var(--text-main); }
.chip-status { font-size: 10.5px; color: var(--green-main); font-weight: 700; }

.sidebar-system-card {
  margin-top: 20px;
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  border-radius: 8px;
  padding: 12px;
}

.system-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--green-main);
  font-weight: 700;
  margin-bottom: 4px;
}

.green-indicator {
  width: 7px;
  height: 7px;
  background: var(--green-vibrant);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--green-vibrant);
}

.system-status-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==================== CONTENT VIEWPORT & MAIL STREAM ==================== */
.content-viewport {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-app);
}

.email-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

.list-toolbar {
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-checkbox {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.custom-checkbox input { opacity: 0; position: absolute; }
.checkmark {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--text-dim);
  border-radius: 4px;
  background: var(--bg-surface);
  transition: all 0.15s ease;
}

.custom-checkbox input:checked ~ .checkmark {
  background: var(--green-main);
  border-color: var(--green-main);
}

.folder-header-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.pill-counter {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  border-radius: 9999px;
  font-weight: 600;
}

/* Email Cards List Stream */
.email-cards-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.email-card-item:hover {
  border-color: var(--green-border);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.email-card-item.unread {
  background: var(--bg-surface);
  border-left: 4px solid var(--green-main);
}

[data-theme="dark"] .email-card-item.unread {
  background: #121e36;
}

.email-card-item.unread .item-subject-title {
  font-weight: 700;
  color: var(--text-main);
}

.email-card-item.keyboard-focused {
  outline: 2px solid var(--green-main);
  border-color: var(--green-main);
}

.item-star {
  font-size: 17px;
  color: var(--text-dim);
  margin-right: 12px;
  cursor: pointer;
  transition: color 0.15s;
}

.item-star.starred {
  color: var(--accent-amber);
}

.item-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-subtle);
  border: 1.5px solid var(--green-border);
  color: var(--green-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  margin-right: 14px;
  flex-shrink: 0;
}

[data-theme="dark"] .item-avatar-circle {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--green-vibrant);
}

.item-sender-col {
  width: 170px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 14px;
}

.item-content-preview {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-subject-title {
  font-weight: 600;
}

.item-body-snippet {
  color: var(--text-muted);
  font-weight: 400;
}

.item-date-col {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 12px;
  flex-shrink: 0;
  font-weight: 600;
}

/* ==================== READING VIEWPORT PANEL ==================== */
.reading-viewport-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  overflow-y: auto;
  border-left: 1px solid var(--border-light);
}

.reading-header-bar {
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.btn-back-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green-main);
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
}

.btn-back-action:hover {
  background: var(--green-border);
}

.reading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
}

.action-btn:hover {
  background: var(--bg-subtle);
}

.action-btn.danger:hover {
  background: var(--accent-rose-subtle);
  border-color: #fca5a5;
  color: var(--accent-rose);
}

.reading-card {
  padding: 24px 28px;
  max-width: 820px;
}

.reading-subject-box {
  margin-bottom: 20px;
}

.category-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--saffron-dark);
  background: var(--saffron-subtle);
  border: 1px solid var(--saffron-border);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

[data-theme="dark"] .category-tag {
  color: var(--saffron-main);
}

.reading-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.reading-sender-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.sender-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF671F 0%, #046A38 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.sender-details {
  flex: 1;
}

.sender-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
}

.badge-verified {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-main);
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  padding: 2px 6px;
  border-radius: 4px;
}

.sender-sub-line {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.reading-timestamp {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

.reading-body-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 32px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Quick Action Dock */
.reading-action-dock {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.dock-btn:hover {
  background: var(--bg-subtle);
}

.dock-btn.primary {
  background: var(--saffron-subtle);
  border-color: var(--saffron-border);
  color: var(--saffron-dark);
}

[data-theme="dark"] .dock-btn.primary {
  color: var(--saffron-main);
}

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

/* ==================== COMPOSE DOCK / SHEET ==================== */
.compose-sheet-modal {
  position: fixed;
  bottom: 20px;
  right: 24px;
  width: 520px;
  max-width: 95vw;
  z-index: 2000;
}

.compose-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compose-header {
  padding: 12px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compose-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.close-btn {
  font-size: 16px;
  color: var(--text-dim);
  padding: 4px;
}

.close-btn:hover { color: var(--text-main); }

.compose-body {
  padding: 14px 18px;
  background: var(--bg-surface);
}

.compose-field {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
}

.compose-field label {
  width: 60px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.compose-field input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-main);
  background: transparent;
}

#desk-compose-body {
  width: 100%;
  border: none;
  outline: none;
  padding: 14px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  background: transparent;
  resize: none;
}

.compose-footer {
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==================== SETTINGS MODAL ==================== */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 3000;
}

.settings-dialog {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-modal);
  max-height: 90vh;
  overflow-y: auto;
}

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

.settings-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.settings-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.settings-section h4 {
  font-size: 11px;
  font-weight: 800;
  color: var(--saffron-dark);
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

[data-theme="dark"] .settings-section h4 {
  color: var(--saffron-main);
}

.identity-grid {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.id-item {
  display: flex;
  flex-direction: column;
}

.id-label {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.id-value {
  font-size: 15px;
  color: var(--text-main);
  font-weight: 600;
}

.id-value.accent {
  color: var(--green-main);
  font-weight: 700;
}

.section-help-text {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.aliases-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.alias-item-bright {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
}

.alias-item-bright .alias-addr {
  font-weight: 700;
  color: var(--green-main);
  font-family: monospace;
}

.alias-item-bright .alias-lbl {
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

.add-alias-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.add-alias-form input {
  flex: 1;
  min-width: 120px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  color: var(--text-main);
}

.add-alias-form input:focus {
  border-color: var(--saffron-main);
}

/* ==================== TOAST NOTIFICATION PILL ==================== */
.bright-toast-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--text-main);
  color: var(--bg-surface);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--saffron-border);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bright-toast-pill.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==================== RESPONSIVE DESIGN (LAPTOP, TABLET & PHONE) ==================== */

/* Backdrop overlay when sidebar is open on mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.sidebar-backdrop.active {
  display: block;
}

/* Tablet & Mobile Screens (<= 900px) */
@media (max-width: 900px) {
  .phone-handle-chip {
    display: none;
  }

  .nav-center {
    margin: 0 10px;
    max-width: none;
  }

  .kbd-hint {
    display: none;
  }

  .sidebar-panel {
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    width: 270px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
  }

  .sidebar-panel.open {
    transform: translateX(0);
  }

  .reading-viewport-panel {
    border-left: none;
  }
}

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .top-nav-bar {
    padding: 0 12px;
    height: 56px;
  }

  .brand-name {
    font-size: 17px;
  }

  .tiranga-tag {
    display: none;
  }

  .search-bar {
    padding: 6px 12px;
  }

  .email-cards-list {
    padding: 10px 10px;
    gap: 6px;
  }

  .email-card-item {
    padding: 10px 12px;
  }

  .item-avatar-circle {
    width: 30px;
    height: 30px;
    font-size: 12px;
    margin-right: 10px;
  }

  .item-sender-col {
    width: 100px;
    font-size: 13px;
    margin-right: 8px;
  }

  .item-content-preview {
    font-size: 12.5px;
  }

  .reading-card {
    padding: 16px;
  }

  .reading-title {
    font-size: 20px;
  }

  .compose-sheet-modal {
    inset: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .compose-card {
    height: 100%;
    border-radius: 0;
    border: none;
  }

  #desk-compose-body {
    min-height: 200px;
  }
}

/* ==================== CONTACTS AUTOCOMPLETE DROPDOWN ==================== */
.contacts-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: var(--shadow-modal);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1050;
  animation: fadeInDown 0.15s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.contacts-autocomplete-header {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.contact-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.12s ease;
}

.contact-autocomplete-item:last-child {
  border-bottom: none;
}

.contact-autocomplete-item:hover,
.contact-autocomplete-item.selected {
  background: var(--bg-hover);
}

.contact-item-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-main), var(--green-vibrant));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contact-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 6px;
}

.contact-item-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--saffron-subtle);
  color: var(--saffron-dark);
  font-weight: 600;
}
