/* ==================== INAI MOBILE WEBAPP DESIGN SYSTEM ====================
   Kesari Saffron: #FF671F | Bharat Green: #046A38 / #10B981 | Chakra Navy: #06038D
   Desktop-grade luxury mobile email experience
======================================================================== */

/* ==================== PERSISTENT SESSION PRE-RENDER VISIBILITY ==================== */
html.has-saved-session #onboarding-container {
  display: none !important;
}
html.has-saved-session #app-container {
  display: flex !important;
}

:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-light: #e2e8f0;
  --border-focus: #FF671F;

  --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;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.14);
}

* {
  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;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ==================== BUTTONS & ICONS ==================== */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  transition: all 0.15s ease;
  position: relative;
}

.icon-btn:active {
  background: var(--bg-hover);
  color: var(--text-main);
  transform: scale(0.96);
}

.icon-btn.danger {
  color: var(--accent-rose);
}

/* ==================== AUTH / ONBOARDING SCREENS ==================== */
.onboarding-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 40%, #fbfdfc 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.onboarding-screen {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 24px 20px;
  overflow-y: auto;
}

.onboarding-screen.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

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

.brand-hero-cluster {
  text-align: center;
  margin: 36px 0 24px;
}

.brand-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(4, 106, 56, 0.08);
  border: 1px solid var(--green-border);
  color: var(--green-main);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-vibrant);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.auth-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.45;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.mobile-phone-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.mobile-field-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  display: block;
  margin-bottom: 8px;
}

.mobile-phone-input-row {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 4px 8px;
  transition: border-color 0.2s;
}

.mobile-phone-input-row:focus-within {
  border-color: var(--green-main);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(4, 106, 56, 0.1);
}

.phone-prefix {
  font-weight: 700;
  color: var(--text-main);
  font-size: 14.5px;
  padding-right: 6px;
  border-right: 1px solid var(--border-light);
  margin-right: 8px;
}

.phone-input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  padding: 8px 4px;
}

.btn-autofill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(4, 106, 56, 0.1);
  color: var(--green-main);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s;
}

.btn-autofill:active {
  background: rgba(4, 106, 56, 0.2);
}

.btn-primary-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #046A38 0%, #034f2a 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(4, 106, 56, 0.25);
  transition: all 0.15s ease;
}

.btn-primary-mobile:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(4, 106, 56, 0.2);
}

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

.auth-or-separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin: 12px 0 16px;
}

.auth-or-separator::before,
.auth-or-separator::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.auth-or-separator span {
  padding: 0 10px;
}

/* Attractive INAI Hero Phone Button */
.phonemail-hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.phonemail-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 103, 31, 0.08);
  color: var(--saffron-main);
  border: 1px solid var(--saffron-border);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 16px;
  margin-bottom: 10px;
}

.phonemail-pulse-ring {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--saffron-main);
  box-shadow: 0 0 6px rgba(255, 103, 31, 0.7);
}

.phonemail-hero-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid var(--green-border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px -2px rgba(4, 106, 56, 0.12);
  transition: all 0.2s ease;
}

.phonemail-hero-btn:active {
  transform: scale(0.98);
  border-color: var(--green-main);
  background: var(--green-subtle);
}

.btn-left-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #046A38 0%, #10B981 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-left-icon svg { width: 20px; height: 20px; }

.btn-content-text {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.btn-main-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-sub-caption {
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-right-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.instant-chip {
  background: var(--green-main);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.btn-arrow-svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-dim);
}

/* Telegram-Style 6-Cell OTP Grid */
.telegram-card-header {
  text-align: center;
  margin: 30px 0 20px;
}

.telegram-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(4, 106, 56, 0.1);
  color: var(--green-main);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.telegram-phone-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.telegram-phone-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.telegram-edit-btn {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green-main);
  padding: 2px 6px;
}

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

.telegram-otp-cell {
  width: 44px;
  height: 52px;
  border-radius: 10px;
  border: 1.5px solid var(--border-light);
  background: #fff;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.telegram-otp-cell:focus {
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(4, 106, 56, 0.15);
  background: #f0fdf4;
}

.telegram-otp-divider {
  font-size: 18px;
  color: var(--text-dim);
}

.otp-status-banner {
  min-height: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
}

.telegram-countdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.otp-timer-badge {
  font-size: 12px;
  color: var(--text-muted);
}

.otp-pill-action {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-main);
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(4, 106, 56, 0.08);
}

.otp-pill-action:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Screen 3: Profile */
.profile-card-header {
  text-align: center;
  margin: 30px 0 20px;
}

.profile-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF671F 0%, #046A38 100%);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 6px 16px rgba(4, 106, 56, 0.2);
}

.profile-inputs-mobile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-input-field {
  width: 100%;
  padding: 13px 14px;
  background: #fff;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-sm);
}

.profile-input-field:focus {
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(4, 106, 56, 0.1);
}

/* ==================== MAIN MOBILE APP WRAPPER ==================== */
.app-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

/* Top App Header */
.app-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  border: 1.5px solid rgba(4, 106, 56, 0.22);
  flex-shrink: 0;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.app-brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--green-main);
}

.app-brand-sub {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.auth-brand-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-brand-logo-img {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(4, 106, 56, 0.18);
  border: 2px solid rgba(4, 106, 56, 0.25);
}

.brand-subname {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
}

.tiranga-tag-mini {
  font-size: 11px;
  font-weight: 800;
  background: var(--green-subtle);
  border: 1px solid var(--green-border);
  color: var(--green-main);
  padding: 1px 5px;
  border-radius: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-pill {
  font-size: 10px;
  font-weight: 800;
  color: var(--green-main);
  background: rgba(4, 106, 56, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 2px;
}

.inai-lang-menu {
  position: absolute;
  top: 42px;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 6px;
  width: 170px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
}

.lang-menu-opt {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
}

.lang-menu-opt:hover, .lang-menu-opt.active {
  background: var(--green-subtle);
  color: var(--green-main);
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #046A38 0%, #10B981 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Search & Filter Section */
.search-filter-section {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 12px 6px;
  flex-shrink: 0;
}

.search-bar-row {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 6px 10px;
  gap: 8px;
}

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

.search-icon {
  color: var(--text-dim);
  display: flex;
}

.mobile-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px 6px;
}

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

.mob-message-counter {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}

/* Custom Checkbox (Crisp White Checkmark) */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: relative;
  height: 18px;
  width: 18px;
  background-color: #fff;
  border: 1.8px solid #94a3b8;
  border-radius: 5px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.checkmark::after {
  content: "";
  display: none;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.custom-checkbox input:checked ~ .checkmark::after {
  display: block;
}

/* Floating Bulk Actions Toolbar */
.bulk-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.2s ease;
}

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

.bulk-count-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 4px;
}

.bulk-act-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.bulk-act-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

.bulk-act-btn.danger {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.bulk-act-close {
  color: #94a3b8;
  font-size: 13px;
  margin-left: auto;
  padding: 2px 6px;
}

/* Source Tabs (INAI Network vs External) */
.mobile-source-tabs {
  display: flex;
  gap: 6px;
  padding-top: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mobile-source-tabs::-webkit-scrollbar { display: none; }

.mob-source-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.mob-source-tab.active {
  background: var(--green-subtle);
  color: var(--green-main);
  border-color: var(--green-border);
  font-weight: 700;
}

.mob-tab-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--border-light);
  color: var(--text-muted);
}

.mob-source-tab.active .mob-tab-badge {
  background: var(--green-main);
  color: #fff;
}

/* ==================== EMAIL LIST STREAM ==================== */
.chat-list {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-app);
  padding: 6px 10px 80px;
  -webkit-overflow-scrolling: touch;
}

.email-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: sticky;
  top: 0;
  background: var(--bg-app);
  z-index: 10;
}

.email-group-title {
  display: flex;
  align-items: center;
  gap: 5px;
}

.email-group-count {
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ==================== SWIPEABLE EMAIL CARD ITEM ==================== */
.email-card-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 7px;
  touch-action: pan-y;
  user-select: none;
}

.swipe-actions-underlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1;
}

.swipe-left-actions {
  display: flex;
  margin-left: auto;
  height: 100%;
}

.swipe-right-actions {
  display: flex;
  margin-right: auto;
  height: 100%;
}

.swipe-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 68px;
  padding: 0 10px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: filter 0.15s ease;
  user-select: none;
}

.swipe-btn:active {
  filter: brightness(0.88);
}

.swipe-btn.archive { background: #475569; }
.swipe-btn.delete { background: #ef4444; }
.swipe-btn.star { background: #f59e0b; color: #fff; }
.swipe-btn.important { background: #6366f1; color: #fff; }

.email-card-surface {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
  will-change: transform;
}

.email-card-surface:active {
  background: #f8fafc;
}

.email-card-surface.unread {
  border-left: 3.5px solid var(--green-main);
  background: #ffffff;
}

.email-card-surface.selected {
  background: rgba(4, 106, 56, 0.05);
  border-color: var(--green-main);
}

.email-card-surface.is-important {
  background: #fffbeb;
  border-color: #fde68a;
}

.email-checkbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.item-important-icon, .item-star {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  z-index: 5;
}

.item-important-icon.important { color: #eab308; }
.item-star.starred { color: #f59e0b; }

.item-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #046A38 0%, #10B981 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-sender-col {
  display: none;
}

.item-content-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.item-body-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.item-date-col {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}

/* Badge Tags Highlighted */
.badge-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: 0.2px;
  margin-right: 6px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.badge-source-tag .badge-icon {
  flex-shrink: 0;
}

.badge-phonemail-pill {
  background: linear-gradient(135deg, rgba(4, 106, 56, 0.14) 0%, rgba(16, 185, 129, 0.22) 100%);
  color: #046A38;
  border: 1px solid rgba(4, 106, 56, 0.35);
  box-shadow: 0 1px 3px rgba(4, 106, 56, 0.12);
}

.badge-external-pill {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(99, 102, 241, 0.18) 100%);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.35);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.10);
}

/* Desktop row-quick-actions hidden on touch mobile */
.row-quick-actions { display: none; }

/* Floating Action Button (FAB) Compose */
.fab-compose {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #046A38 0%, #034f2a 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(4, 106, 56, 0.35);
  z-index: 100;
  transition: transform 0.15s ease;
}

.fab-compose:active {
  transform: scale(0.92);
}

/* ==================== READING PANE VIEW ==================== */
.chat-view-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-surface);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.chat-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  flex-shrink: 0;
}

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

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

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

.contact-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-main);
}

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

.chat-subject-bar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.chat-subject-bar strong {
  color: var(--text-main);
}

.mobile-reading-card {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 80px;
}

.reading-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.reading-avatar-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #046A38 0%, #10B981 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reading-meta-text {
  flex: 1;
}

.reading-sender-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.reading-date-line {
  font-size: 11.5px;
  color: var(--text-dim);
}

.mobile-body-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  word-break: break-word;
}

.chat-input-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.btn-dock-mob {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  transition: all 0.15s;
}

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

/* ==================== SLIDING DRAWER NAVIGATION ==================== */
.drawer-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-wrapper.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-content {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 82%;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.drawer-wrapper.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  padding: 24px 18px 16px;
  background: linear-gradient(135deg, #046A38 0%, #034f2a 100%);
  color: #fff;
}

.profile-avatar-small {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid #fff;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.drawer-status-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 6px;
}

.drawer-items {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-section-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-dim);
  padding: 10px 10px 4px;
  letter-spacing: 0.6px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

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

.drawer-item.active {
  background: var(--green-subtle);
  color: var(--green-main);
  font-weight: 700;
}

.drawer-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 10px;
}

/* ==================== DIGITAL ID CARD MODAL ==================== */
.id-card-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.id-card-dialog {
  background: var(--bg-surface);
  border-radius: 20px;
  width: 100%;
  max-width: 360px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.id-card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.id-card-header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green-main);
  background: var(--green-subtle);
  padding: 4px 8px;
  border-radius: 6px;
}

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

/* Plastic Luxury Smart Card */
.smart-mail-card {
  position: relative;
  background: linear-gradient(135deg, #03381e 0%, #046A38 50%, #0a874a 100%);
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 10px 25px -4px rgba(4, 106, 56, 0.4);
  overflow: hidden;
  margin-bottom: 16px;
}

.smart-card-shimmer {
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.smart-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.chip-hologram {
  width: 36px;
  height: 26px;
  border-radius: 5px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #94a3b8 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
}

.chip-line {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.2);
}

.smart-card-brand {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
}

.country-tag {
  font-size: 9.5px;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
}

.smart-card-middle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.smart-card-meta {
  flex: 1;
}

.card-holder-name {
  font-size: 15px;
  font-weight: 800;
}

.card-holder-phone {
  font-size: 12.5px;
  opacity: 0.9;
  font-family: monospace;
  margin-top: 2px;
}

.card-holder-email {
  font-size: 10.5px;
  opacity: 0.8;
  word-break: break-all;
  margin-top: 4px;
}

.smart-card-qr-box {
  background: #fff;
  padding: 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.75;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 8px;
}

.id-card-actions-row {
  display: flex;
  gap: 8px;
}

/* ==================== COMPOSE MODAL ==================== */
.modal-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trad-field input, .trad-field textarea {
  width: 100%;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
}

.trad-field input:focus, .trad-field textarea:focus {
  border-color: var(--green-main);
}

.mobile-contacts-picker {
  position: absolute;
  top: 68px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 180px;
  overflow-y: auto;
  z-index: 100;
}

.contact-picker-item {
  padding: 8px 12px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}

.contact-picker-item:hover {
  background: var(--green-subtle);
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-secondary {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.app-toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 99999;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}

.app-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s ease;
}

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

.app-toast.success { background: #046A38; }
.app-toast.error { background: #dc2626; }
.app-toast.warning { background: #d97706; }
