/* ==========================================================================
   WhatsApp Outreach Single Page Utility - Stylesheet
   Mobile-First, Responsive, Light/Dark Modes, Hindi Font Stack
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", "Mangal", "Nirmala UI", sans-serif;
  
  /* Color Palette - Light Theme */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --wa-green: #25D366;
  --wa-dark-green: #128C7E;
  --wa-green-hover: #1ea952;
  
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --danger-color: #e11d48;
  --danger-hover: #be123c;
  --danger-light: #ffe4e6;

  --warning-color: #d97706;
  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;

  --success-color: #16a34a;
  --success-light: #dcfce7;

  /* Status Chip Colors */
  --status-new-bg: #f1f5f9;
  --status-new-text: #475569;
  --status-new-border: #cbd5e1;

  --status-sent-bg: #dbeafe;
  --status-sent-text: #1e40af;
  --status-sent-border: #93c5fd;

  --status-replied-bg: #f3e8ff;
  --status-replied-text: #6b21a8;
  --status-replied-border: #d8b4fe;

  --status-interested-bg: #dcfce7;
  --status-interested-text: #166534;
  --status-interested-border: #86efac;

  --status-notinterested-bg: #ffe4e6;
  --status-notinterested-text: #9f1239;
  --status-notinterested-border: #fda4af;

  --status-skip-bg: #fef3c7;
  --status-skip-text: #92400e;
  --status-skip-border: #fcd34d;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Dark Theme Variables */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #090d16;
    --bg-surface: #111827;
    --bg-surface-elevated: #1f2937;
    --bg-muted: #1e293b;
    --bg-card: #131c2e;
    --border-color: #334155;
    --border-subtle: #1e293b;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e3a5f;

    --status-new-bg: #1e293b;
    --status-new-text: #94a3b8;
    --status-new-border: #334155;

    --status-sent-bg: #1e3a8a;
    --status-sent-text: #93c5fd;
    --status-sent-border: #2563eb;

    --status-replied-bg: #3b0764;
    --status-replied-text: #d8b4fe;
    --status-replied-border: #7c3aed;

    --status-interested-bg: #064e3b;
    --status-interested-text: #86efac;
    --status-interested-border: #059669;

    --status-notinterested-bg: #4c0519;
    --status-notinterested-text: #fda4af;
    --status-notinterested-border: #e11d48;

    --status-skip-bg: #451a03;
    --status-skip-text: #fcd34d;
    --status-skip-border: #d97706;

    --warning-bg: #422006;
    --warning-border: #b45309;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
  }
}

/* Explicit Dark Theme override */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-muted: #1e293b;
  --bg-card: #131c2e;
  --border-color: #334155;
  --border-subtle: #1e293b;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e3a5f;

  --status-new-bg: #1e293b;
  --status-new-text: #94a3b8;
  --status-new-border: #334155;

  --status-sent-bg: #1e3a8a;
  --status-sent-text: #93c5fd;
  --status-sent-border: #2563eb;

  --status-replied-bg: #3b0764;
  --status-replied-text: #d8b4fe;
  --status-replied-border: #7c3aed;

  --status-interested-bg: #064e3b;
  --status-interested-text: #86efac;
  --status-interested-border: #059669;

  --status-notinterested-bg: #4c0519;
  --status-notinterested-text: #fda4af;
  --status-notinterested-border: #e11d48;

  --status-skip-bg: #451a03;
  --status-skip-text: #fcd34d;
  --status-skip-border: #d97706;

  --warning-bg: #422006;
  --warning-border: #b45309;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
}

/* Explicit Light Theme override */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --status-new-bg: #f1f5f9;
  --status-new-text: #475569;
  --status-new-border: #cbd5e1;

  --status-sent-bg: #dbeafe;
  --status-sent-text: #1e40af;
  --status-sent-border: #93c5fd;

  --status-replied-bg: #f3e8ff;
  --status-replied-text: #6b21a8;
  --status-replied-border: #d8b4fe;

  --status-interested-bg: #dcfce7;
  --status-interested-text: #166534;
  --status-interested-border: #86efac;

  --status-notinterested-bg: #ffe4e6;
  --status-notinterested-text: #9f1239;
  --status-notinterested-border: #fda4af;

  --status-skip-bg: #fef3c7;
  --status-skip-text: #92400e;
  --status-skip-border: #fcd34d;

  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;
}

/* Global Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 90px; /* Space for mobile floating bar */
}

/* Containers */
.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Typography & Links */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Header & Progress Controls
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 8px;
}

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

.brand-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.brand-text h1 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.brand-text .sub-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

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

.icon-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--border-color);
}

/* Stats Progress Grid */
.progress-bar-container {
  padding-top: 6px;
  padding-bottom: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }
}

.stat-pill {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-sent .stat-val { color: var(--primary-color); }
.stat-replied .stat-val { color: #8b5cf6; }
.stat-interested .stat-val { color: var(--success-color); }

.stat-daily.cap-exceeded {
  background: var(--danger-light);
  border-color: var(--danger-color);
}

.stat-daily.cap-exceeded .stat-val {
  color: var(--danger-color);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: var(--radius-full);
  transition: width 0.35s ease;
}

/* Warning & Cooldown Banners */
.warning-banner {
  margin-top: 8px;
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.4;
}

.cooldown-banner {
  margin-top: 8px;
  background-color: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.4;
  animation: pulseCooldown 1.5s infinite;
}

@keyframes pulseCooldown {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Quick Nav Bar */
.quick-nav-bar {
  display: flex;
  gap: 8px;
  padding-top: 6px;
  padding-bottom: 10px;
}

.next-unsent-btn {
  flex: 2;
  justify-content: center;
}

.next-unsent-btn .badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  margin-left: 6px;
}

.filter-toggle-btn {
  flex: 1;
  justify-content: center;
  position: relative;
}

.active-filter-indicator {
  position: absolute;
  top: 4px;
  right: 8px;
  color: var(--primary-color);
  font-size: 1.2rem;
  line-height: 0;
}

/* Filters Drawer */
.filters-drawer {
  background: var(--bg-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  padding-bottom: 12px;
  animation: slideDown 0.2s ease-out;
}

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

.filter-controls-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 720px) {
  .filter-controls-grid {
    grid-template-columns: 1fr 1fr;
  }
  .search-box {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .filter-controls-grid {
    grid-template-columns: 1fr;
  }
  .search-box {
    grid-column: span 1;
  }
}

.search-box label,
.filter-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 32px;
  padding-right: 30px;
}

.clear-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filters-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 42px; /* Touch target accessibility */
  transition: background-color var(--transition-fast), transform 0.05s ease, opacity var(--transition-fast);
  user-select: none;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.8rem;
}

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

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

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
}

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

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

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-muted);
}

.btn-danger {
  background-color: var(--danger-color);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
}

.btn-success {
  background-color: var(--success-color);
  color: #ffffff;
}

/* Primary WhatsApp Send Button */
.btn-wa-send {
  background-color: #25D366;
  color: #0b2212;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 4px rgba(37, 211, 102, 0.25);
  border: 1px solid #1ea952;
  width: 100%;
}

.btn-wa-send:hover:not(:disabled) {
  background-color: #20bd5a;
  color: #000000;
}

.btn-wa-send.cooling-down {
  background-color: #64748b;
  border-color: #475569;
  color: #f1f5f9;
  cursor: wait;
}

.btn-wa-send.invalid-num {
  background-color: #94a3b8;
  border-color: #64748b;
  color: #f8fafc;
}

/* ==========================================================================
   Lead Card List & Individual Cards
   ========================================================================== */
.main-content {
  padding-top: 16px;
}

.leads-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.lead-card:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-md);
}

/* Card Target Pulse Animation for "Next Unsent" navigation */
.lead-card.highlight-target {
  animation: targetPulse 2s ease-out;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25) !important;
}

@keyframes targetPulse {
  0% { transform: scale(1.015); box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.4); }
  50% { transform: scale(1); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25); }
  100% { transform: scale(1); }
}

/* Card Header */
.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.business-title-wrap {
  flex: 1;
}

.card-lead-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.business-title {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Status Select Chip */
.status-select-wrap {
  flex-shrink: 0;
}

.status-dropdown {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
}

.status-dropdown[data-status="New"] {
  background-color: var(--status-new-bg);
  color: var(--status-new-text);
  border-color: var(--status-new-border);
}
.status-dropdown[data-status="Sent"] {
  background-color: var(--status-sent-bg);
  color: var(--status-sent-text);
  border-color: var(--status-sent-border);
}
.status-dropdown[data-status="Replied"] {
  background-color: var(--status-replied-bg);
  color: var(--status-replied-text);
  border-color: var(--status-replied-border);
}
.status-dropdown[data-status="Interested"] {
  background-color: var(--status-interested-bg);
  color: var(--status-interested-text);
  border-color: var(--status-interested-border);
}
.status-dropdown[data-status="Not interested"] {
  background-color: var(--status-notinterested-bg);
  color: var(--status-notinterested-text);
  border-color: var(--status-notinterested-border);
}
.status-dropdown[data-status="Skip"] {
  background-color: var(--status-skip-bg);
  color: var(--status-skip-text);
  border-color: var(--status-skip-border);
}

/* Metadata Row (Category, Rating, Badges) */
.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.category-tag {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] .rating-badge {
  background: #422006;
  color: #fcd34d;
}

.review-count {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75rem;
}

/* Warning Badges */
.badge-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] .badge-warning {
  background: #451a03;
  color: #fcd34d;
  border-color: #b45309;
}

.badge-danger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fda4af;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

/* Address & Maps Row */
.card-address-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.address-text {
  flex: 1;
  line-height: 1.4;
}

.maps-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}

.maps-link-btn:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  text-decoration: none;
}

/* Phone & Number Row */
.card-phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.phone-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: var(--text-primary);
}

.sent-timestamp {
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 500;
}

/* Message Section */
.card-message-section {
  margin-bottom: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.message-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-color);
}

.message-header-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.message-actions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-msg-tool {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-msg-tool:hover {
  background: rgba(37, 99, 235, 0.1);
}

.message-textarea {
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 10px;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 90px;
  max-height: 280px;
  color: var(--text-primary);
  font-family: var(--font-family);
}

.message-textarea.collapsed {
  max-height: 68px;
  overflow: hidden;
}

/* Notes Field */
.card-notes-row {
  margin-bottom: 14px;
}

.notes-input {
  font-size: 0.82rem;
  padding: 6px 10px;
  background: var(--bg-muted);
  border-color: var(--border-subtle);
}

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

/* Card Action Buttons */
.card-actions-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   Mobile Floating Action Bar
   ========================================================================== */
.mobile-floating-bar {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  z-index: 40;
  pointer-events: none;
}

.btn-floating {
  pointer-events: auto;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(255, 255, 255, 0.4);
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-full);
}

@media (min-width: 600px) {
  /* On desktop, sticky nav bar has next-unsent, mobile floating bar can be hidden */
  .mobile-floating-bar {
    display: none;
  }
  body {
    padding-bottom: 40px;
  }
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

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

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.theme-picker-group {
  display: flex;
  gap: 8px;
}

.theme-choice-btn {
  flex: 1;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.theme-choice-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.danger-zone {
  border-top: 1px dashed var(--danger-color);
  padding-top: 16px;
}

/* Backup & Sync sections */
.backup-section h3 {
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
}

.file-drop-area {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-input-hidden {
  display: none;
}

.selected-file-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #f8fafc;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastSlideUp 0.25s ease-out;
}

.toast.toast-success {
  background: #064e3b;
  color: #a7f3d0;
  border: 1px solid #059669;
}

.toast.toast-warning {
  background: #451a03;
  color: #fde68a;
  border: 1px solid #d97706;
}

.toast.toast-danger {
  background: #4c0519;
  color: #fecdd3;
  border: 1px solid #e11d48;
}

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

/* Empty State & Loading State */
.empty-state, .loading-state {
  text-align: center;
  padding: 48px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px auto;
}

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

/* Helpers */
.hidden {
  display: none !important;
}
