@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-dark: #0B0F19;
  --bg-card: #151D2C;
  --bg-card-hover: #1C2638;
  --border-color: #263347;
  --border-highlight: #3B82F6;
  
  --primary-emerald: #059669;
  --primary-teal: #0284C7;
  --gradient-emerald: #059669;
  --gradient-accent: #0284C7;
  --gradient-gold: #D97706;
  --gradient-danger: #DC2626;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --accent-gold: #F59E0B;
  --accent-rose: #EF4444;
  --accent-purple: #8B5CF6;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-glow: none;
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.25);
  --transition: all 0.2s ease-in-out;

  /* Device Safe Area Insets for iPhones (Notch/Dynamic Island) & Android Gesture Nav */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  background-image: none;
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6, .brand-title {
  font-family: 'Outfit', sans-serif;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(1rem + var(--sat)) calc(1rem + var(--sar)) calc(3rem + var(--sab)) calc(1rem + var(--sal));
  width: 100%;
}

@media (min-width: 768px) {
  .container {
    padding: calc(1.5rem + var(--sat)) calc(1.75rem + var(--sar)) calc(4rem + var(--sab)) calc(1.75rem + var(--sal));
  }
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 0 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
  .app-header {
    padding: 1rem 0 2rem 0;
    margin-bottom: 2.25rem;
  }
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-badge {
  width: clamp(40px, 6vw, 48px);
  height: clamp(40px, 6vw, 48px);
  border-radius: var(--radius-md);
  background: #059669;
  border: 1px solid #047857;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  box-shadow: none;
  flex-shrink: 0;
}

.brand-title {
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2px;
}

.bharat-flag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(to right, #FF9933, #FFFFFF, #128807);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }
  .brand-wrapper {
    justify-content: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .header-actions > * {
    flex: 1 1 auto;
  }
  .auth-header-pill {
    width: 100%;
  }
  .auth-header-pill .auth-btn,
  .auth-header-pill .vendor-profile-badge {
    width: 100%;
    justify-content: center;
  }
}

.lang-select, .action-btn {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: clamp(0.82rem, 1.8vw, 0.9rem);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  backdrop-filter: blur(8px);
  min-height: 42px;
  touch-action: manipulation;
}

.lang-select:hover, .action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.lang-select:focus, .action-btn:focus {
  outline: none;
  border-color: var(--primary-emerald);
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 2rem;
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (min-width: 680px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem;
  }
}

@media (min-width: 1025px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.4rem) clamp(1rem, 2.5vw, 1.5rem);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.cash::before { background: var(--primary-emerald); }
.stat-card.udhaar::before { background: var(--accent-gold); }
.stat-card.customers::before { background: var(--primary-teal); }
.stat-card.reminders::before { background: var(--accent-rose); }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: clamp(0.78rem, 1.8vw, 0.875rem);
  font-weight: 500;
  margin-bottom: 0.5rem;
  gap: 0.65rem;
}

.stat-header span {
  flex: 1;
  line-height: 1.35;
  word-break: break-word;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.stat-card.cash .stat-icon { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.stat-card.udhaar .stat-icon { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.stat-card.customers .stat-icon { background: rgba(6, 182, 212, 0.15); color: #22D3EE; }
.stat-card.reminders .stat-icon { background: rgba(244, 63, 94, 0.15); color: #FB7185; }

.stat-value {
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-footer {
  font-size: clamp(0.72rem, 1.6vw, 0.78rem);
  color: var(--text-dim);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: normal;
  line-height: 1.3;
}

/* Central Voice Section */
.voice-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3.5vw, 2.25rem) clamp(1rem, 3vw, 2rem);
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-card);
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
  overflow: hidden;
}

.voice-title {
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.voice-desc {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  max-width: 620px;
  margin: 0 auto clamp(1.25rem, 3vw, 2rem) auto;
  line-height: 1.5;
}

.voice-mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  position: relative;
}

.mic-button {
  width: clamp(80px, 18vw, 100px);
  height: clamp(80px, 18vw, 100px);
  border-radius: 50%;
  background: #059669;
  border: 3px solid #263347;
  color: #FFF;
  font-size: clamp(2rem, 5vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
  position: relative;
  outline: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.mic-button:hover {
  transform: scale(1.04);
  background: #047857;
  border-color: #334155;
}

.mic-button:active {
  transform: scale(0.96);
}

.mic-button.recording {
  background: #DC2626;
  border-color: #B91C1C;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3);
}

.recording-status {
  margin-top: 1rem;
  font-weight: 600;
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--primary-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  padding: 0 0.5rem;
}

.recording-status.listening {
  color: var(--accent-rose);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.recording-status.listening .pulse-dot {
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  0% { opacity: 0.2; }
  100% { opacity: 1; }
}

/* Audio Waveform Animation */
.waveform-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin-top: 0.5rem;
}

.bar {
  width: 4px;
  height: 6px;
  background: var(--accent-rose);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.recording .bar {
  animation: wave-bar 0.8s ease-in-out infinite alternate;
}

.bar:nth-child(1) { animation-delay: 0.1s; }
.bar:nth-child(2) { animation-delay: 0.3s; }
.bar:nth-child(3) { animation-delay: 0.5s; }
.bar:nth-child(4) { animation-delay: 0.2s; }
.bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-bar {
  0% { height: 6px; }
  100% { height: 26px; }
}

/* Presets & Manual Input */
.preset-section-title {
  font-size: clamp(0.75rem, 1.8vw, 0.85rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.presets-flex {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}

.preset-chip {
  background: rgba(31, 41, 55, 0.7);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: clamp(0.78rem, 1.8vw, 0.85rem);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  touch-action: manipulation;
  min-height: 38px;
}

.preset-chip:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary-emerald);
  color: var(--text-main);
  transform: translateY(-1px);
}

.preset-chip .chip-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-gold);
}

.text-fallback-wrapper {
  max-width: 650px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

@media (max-width: 580px) {
  .text-fallback-wrapper {
    flex-direction: column;
    gap: 0.6rem;
  }
  .parse-btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }
}

.transcript-input {
  flex: 1;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  outline: none;
  transition: var(--transition);
  min-height: 46px;
  width: 100%;
}

.transcript-input:focus {
  border-color: var(--primary-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.parse-btn {
  background: #059669;
  border: 1px solid #047857;
  color: #FFF;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  touch-action: manipulation;
  flex-shrink: 0;
  box-shadow: none;
}

.parse-btn:hover {
  background: #047857;
  transform: none;
}

/* Extracted Entity Card */
.extraction-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.2rem, 3vw, 1.75rem);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
  animation: fadeInSlide 0.35s ease-out;
}

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

.extraction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.extraction-title {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #10B981;
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 580px) {
  .entity-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.entity-field {
  background: #0F1623;
  border: 1px solid var(--border-color);
  padding: 0.9rem;
  border-radius: var(--radius-md);
}

.entity-field input.transcript-input {
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  font-size: 16px;
  background: #0B1019;
  border: 1px solid var(--border-color);
}

.entity-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-val {
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: var(--text-main);
}

.entity-val.highlight-cash { color: #34D399; }
.entity-val.highlight-udhaar { color: #FBBF24; }

.raw-transcript-box {
  background: #0B1019;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: clamp(0.82rem, 2vw, 0.88rem);
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
  border-left: 3px solid #0284C7;
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  word-break: break-word;
}

.extraction-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .extraction-actions {
    flex-direction: column-reverse;
  }
  .extraction-actions > * {
    width: 100%;
    justify-content: center;
    min-height: 46px;
  }
}

.btn-confirm {
  background: #059669;
  border: 1px solid #047857;
  color: #FFF;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: none;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-confirm:hover {
  background: #047857;
}

.btn-discard {
  background: #1C2433;
  border: 1px solid #451A1A;
  color: #F87171;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
  transition: var(--transition);
}

.btn-discard:hover {
  background: #2B1818;
}

.btn-tts {
  background: #1C2433;
  border: 1px solid #2B3A50;
  color: #94A3B8;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  touch-action: manipulation;
  transition: var(--transition);
}

.btn-tts:hover {
  background: #253347;
  color: #F8FAFC;
}

/* Sections Layout */
.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* 2-Column Split View only on Wide Desktop Screens (1080px and above) */
@media (min-width: 1080px) {
  .section-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.15fr);
  }
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow: hidden; /* Critical: contains table scroll without blowing out card boundaries */
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  display: block;
}

.table-wrapper::-webkit-scrollbar {
  height: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.4);
}

table.ledger-table {
  width: 100%;
  min-width: 480px; /* Guarantees columns retain structure while smoothly scrolling within table-wrapper */
  border-collapse: collapse;
  text-align: left;
  font-size: clamp(0.82rem, 1.8vw, 0.9rem);
}

table.ledger-table th {
  background: rgba(31, 41, 55, 0.5);
  padding: 0.75rem 0.9rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.ledger-table td {
  padding: clamp(0.75rem, 1.8vw, 1rem) 0.9rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

table.ledger-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-paid { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-udhaar { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-overdue { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-offline-ml { background: rgba(245, 158, 11, 0.18); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.45); }
.badge-online-ai { background: rgba(59, 130, 246, 0.18); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.45); }
.badge-category { background: rgba(139, 92, 246, 0.15); color: #C4B5FD; border: 1px solid rgba(139, 92, 246, 0.3); }

.customer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(0.75rem, 2vw, 0.95rem);
  background: rgba(31, 41, 55, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  transition: var(--transition);
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

.customer-item:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
}

.cust-name {
  font-weight: 600;
  font-size: clamp(0.9rem, 2vw, 0.98rem);
  word-break: break-word;
}

.cust-phone {
  font-size: clamp(0.75rem, 1.8vw, 0.82rem);
  color: var(--text-dim);
  margin-top: 2px;
}

.cust-debt {
  text-align: right;
  flex-shrink: 0;
}

.cust-debt-val {
  font-weight: 700;
  color: var(--accent-gold);
  font-size: clamp(0.88rem, 2vw, 0.95rem);
}

.cust-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.btn-clear-due {
  background: #059669;
  color: #FFFFFF;
  border: 1px solid #047857;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: var(--transition);
  min-height: 38px;
  touch-action: manipulation;
  white-space: nowrap;
}

.btn-clear-due:hover {
  background: #047857;
}

.btn-whatsapp {
  background: #16A34A;
  color: #FFFFFF;
  border: 1px solid #15803D;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: var(--transition);
  text-decoration: none;
  min-height: 38px;
  touch-action: manipulation;
  white-space: nowrap;
}

.btn-whatsapp:hover {
  background: #15803D;
}

.btn-call {
  background: #0284C7;
  color: #FFFFFF;
  border: 1px solid #0369A1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: var(--transition);
  text-decoration: none;
  min-height: 38px;
  touch-action: manipulation;
  white-space: nowrap;
}

.btn-call:hover {
  background: #0369A1;
}

@media (max-width: 580px) {
  .customer-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .cust-debt {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed var(--border-color);
    padding-top: 0.6rem;
    text-align: left;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .cust-actions {
    margin-top: 0;
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }
  .cust-actions .btn-clear-due,
  .cust-actions .btn-whatsapp,
  .cust-actions .btn-call {
    flex: 1 1 auto;
    margin-top: 0;
    padding: 0.5rem 0.75rem;
    justify-content: center;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(1.5rem + var(--sab));
  right: calc(1.5rem + var(--sar));
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: calc(100vw - 2rem);
}

@media (max-width: 640px) {
  .toast-container {
    left: calc(1rem + var(--sal));
    right: calc(1rem + var(--sar));
    bottom: calc(1rem + var(--sab));
    align-items: center;
    max-width: none;
  }
  .toast {
    width: 100%;
    justify-content: center;
    animation: slideUpMobile 0.3s ease !important;
  }
}

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

.toast {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--primary-emerald);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  padding: calc(1rem + var(--sat)) calc(1rem + var(--sar)) calc(1rem + var(--sab)) calc(1rem + var(--sal));
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Vendor Authentication & Header Styles */
.auth-header-pill {
  display: flex;
  align-items: center;
}

.vendor-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 42px;
}

.vendor-name {
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

@media (min-width: 640px) {
  .vendor-name {
    max-width: 260px;
  }
}

.online-indicator {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  flex-shrink: 0;
}

.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.2s;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.auth-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.auth-btn:hover {
  background-color: #1e293b;
  border-color: #38bdf8;
}

/* Auth Landing & Gatekeeper View (Solid, Minimalist, No Glow) */
.auth-landing-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background-color: var(--bg-main, #0b0f19);
}

html:not(.has-auth-session) #mainDashboard {
  display: none !important;
}

html:not(.has-auth-session) #authLandingView {
  display: flex !important;
}

html.has-auth-session #authLandingView {
  display: none !important;
}

html.has-auth-session #mainDashboard {
  display: block !important;
}

.auth-landing-card {
  background-color: #151d2c;
  border: 1px solid #263347;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  padding: 2rem 1.75rem;
  color: #f8fafc;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.auth-landing-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo-badge {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.auth-brand-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.auth-brand-hindi {
  font-weight: 400;
  font-size: 1.2rem;
  color: #94a3b8;
}

.auth-brand-tagline {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.auth-badge-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
}

.auth-guest-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 0.85rem;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-guest-divider::before,
.auth-guest-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #263347;
}

.auth-guest-divider span {
  padding: 0 0.75rem;
}

.btn-guest-access {
  width: 100%;
  background-color: transparent;
  border: 1px dashed #334155;
  color: #94a3b8;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn-guest-access:hover {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: #64748b;
}

/* Auth Modal Card (For in-dashboard re-auth if needed) */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: calc(1rem + var(--sat)) calc(1rem + var(--sar)) calc(1rem + var(--sab)) calc(1rem + var(--sal));
}

.auth-modal-card {
  background: #151d2c;
  border: 1px solid #263347;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  position: relative;
  color: #f8fafc;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 18px;
  padding-right: 20px;
}

.auth-title {
  font-size: clamp(1.2rem, 3vw, 1.4rem);
  font-weight: 700;
  margin-bottom: 6px;
  color: #f8fafc;
}

.auth-subtitle {
  font-size: clamp(0.78rem, 1.8vw, 0.85rem);
  color: #94a3b8;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: #0f172a;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: clamp(0.82rem, 1.8vw, 0.88rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.auth-tab.active {
  background: #334155;
  color: #ffffff;
}

.auth-form .form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: clamp(0.8rem, 1.8vw, 0.85rem);
  color: #cbd5e1;
  font-weight: 500;
}

.auth-form input {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  outline: none;
  transition: border-color 0.2s;
  min-height: 44px;
}

.auth-form input:focus {
  border-color: #818cf8;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.auth-submit-btn {
  width: 100%;
  background: #059669;
  border: 1px solid #047857;
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: var(--transition);
  min-height: 46px;
  touch-action: manipulation;
}

.auth-submit-btn:hover {
  background: #047857;
}

/* Global Modern Dark Scrollbar for PC / Desktops */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.4);
}

/* Custom Popup Dialog System (for Clear Due, Phone Number, etc.) */
.popup-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

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

.popup-dialog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  color: var(--text-main);
  animation: slideUpModal 0.2s ease-out;
}

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

.popup-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.popup-dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.popup-dialog-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.popup-dialog-close:hover {
  color: #FFF;
}

.popup-cust-banner {
  background: #0E1522;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-cust-name {
  font-weight: 700;
  font-size: 1rem;
  color: #FFF;
}

.popup-cust-balance {
  font-weight: 700;
  font-size: 1.05rem;
  color: #F59E0B;
}

.popup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.popup-actions > * {
  flex: 1;
  min-height: 42px;
  justify-content: center;
}

.btn-add-phone {
  background: #1C2638;
  color: #60A5FA;
  border: 1px solid #2B3A50;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
  margin-top: 2px;
}

.btn-add-phone:hover {
  background: #25354D;
  border-color: #3B82F6;
  color: #93C5FD;
}

.btn-phone-edit {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 0.35rem;
}

.btn-phone-edit:hover {
  color: #93C5FD;
}

/* Smart WhatsApp Reminder Modal & UPI Styling */
.smart-reminder-card {
  max-width: 480px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
}

.smart-upi-section {
  background: #0E1522;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.5rem;
}

.smart-upi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.smart-upi-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.qr-thumbnail-box {
  background: #FFFFFF;
  padding: 5px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.qr-thumbnail-img,
.qr-thumbnail-canvas {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
}

.template-chips-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.template-chip {
  background: #1C2638;
  border: 1px solid #2B3A50;
  color: #94A3B8;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.template-chip:hover {
  background: #25354D;
  color: #FFFFFF;
}

.template-chip.active {
  background: #059669;
  border-color: #10B981;
  color: #FFFFFF;
}

.wa-preview-bubble {
  background: #0B141B;
  border: 1px solid #263347;
  border-left: 3px solid #10B981;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  max-height: 160px;
  overflow-y: auto;
}

.btn-copy-preview {
  background: transparent;
  border: 1px solid #2B3A50;
  color: #94A3B8;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-preview:hover {
  border-color: #38BDF8;
  color: #FFFFFF;
}

.btn-whatsapp-send {
  background: #16A34A;
  border: 1px solid #15803D;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-whatsapp-send:hover {
  background: #15803D;
}

/* =============================================================
   App Multi-View Architecture & Floating Navigation Island
   ============================================================= */

.app-view {
  display: none;
  padding-bottom: 120px; /* Essential clearance for floating bottom dock */
  animation: fadeInView 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-view.active {
  display: block;
}

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

/* Floating Bottom Navigation Island (iOS Design System) */
.floating-nav-island {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 990;
  width: calc(100% - 32px);
  max-width: 440px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 38px;
  box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.6), 
              0 0 0 1px rgba(255, 255, 255, 0.06),
              inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 12px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide floating nav island on auth landing page or non-authenticated sessions */
html:not(.has-auth-session) .floating-nav-island {
  display: none !important;
}

.floating-nav-tab {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 4px 6px;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.floating-nav-tab:active {
  transform: scale(0.92);
}

.floating-nav-tab .nav-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: transparent;
  color: #94A3B8;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-nav-tab .nav-tab-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #94A3B8;
  margin-top: 2px;
  letter-spacing: 0.2px;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

/* Active Tab: Elevated Glow & Gradient Badge */
.floating-nav-tab.active .nav-icon-circle {
  background: linear-gradient(135deg, #F59E0B, #D4B574);
  color: #0F172A;
  transform: translateY(-6px) scale(1.12);
  box-shadow: 0 8px 18px -2px rgba(245, 158, 11, 0.5), 
              0 2px 6px rgba(0, 0, 0, 0.4);
}

.floating-nav-tab.active .nav-tab-label {
  color: #FBBF24;
  font-weight: 700;
}

.floating-nav-tab:hover:not(.active) .nav-icon-circle {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.floating-nav-tab:hover:not(.active) .nav-tab-label {
  color: #E2E8F0;
}

/* View 2: Customer Khata Directory Styling */
.khata-directory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.khata-quick-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.khata-stat-pill {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FBBF24;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.khata-stat-pill strong {
  color: #F59E0B;
  font-weight: 700;
  font-size: 1rem;
  margin-left: 4px;
}

.directory-toolbar {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-box-wrapper {
  flex: 1;
  min-width: 220px;
}

.cust-search-input {
  width: 100%;
  background: rgba(31, 41, 55, 0.55);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #FFFFFF;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cust-search-input:focus {
  border-color: #38BDF8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.sort-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cust-sort-select {
  background: #1E293B;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #F8FAFC;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.cust-sort-select:focus {
  border-color: #F59E0B;
}

.filter-chips-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid var(--border-color);
  color: #94A3B8;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-chip:hover {
  background: rgba(51, 65, 85, 0.7);
  color: #FFFFFF;
}

.filter-chip.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.35));
  border-color: #10B981;
  color: #34D399;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

/* Customer Directory Cards Grid */
.customer-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.cust-card {
  background: rgba(31, 41, 55, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(8px);
}

.cust-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4);
}

.cust-card-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.cust-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cust-avatar.has-udhaar {
  background: linear-gradient(135deg, #F59E0B, #B45309);
}

.cust-avatar.settled {
  background: linear-gradient(135deg, #10B981, #047857);
}

.cust-meta {
  flex: 1;
  min-width: 0;
}

.cust-meta .name {
  font-weight: 700;
  font-size: 1rem;
  color: #FFFFFF;
  word-break: break-word;
}

.cust-meta .phone-wrap {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cust-meta .phone-text {
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
}

.cust-meta .phone-text:hover {
  color: #93C5FD;
}

.cust-card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.cust-card-stats .stat-item {
  display: flex;
  flex-direction: column;
}

.cust-card-stats .stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.cust-card-stats .stat-val-udhaar {
  font-size: 1.15rem;
  font-weight: 800;
  color: #F59E0B;
}

.cust-card-stats .stat-val-settled {
  font-size: 1.15rem;
  font-weight: 800;
  color: #34D399;
}

.cust-card-stats .due-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.due-badge.urgent {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.due-badge.normal {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.due-badge.settled {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cust-card-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.cust-card-actions > * {
  flex: 1;
  min-height: 38px;
  font-size: 0.78rem;
}

/* View 4: Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.btn-link-action {
  background: transparent;
  border: none;
  color: #F59E0B;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-link-action:hover {
  color: #FBBF24;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .floating-nav-island {
    bottom: 16px;
    width: calc(100% - 24px);
    padding: 6px 8px;
  }
  .floating-nav-tab .nav-icon-circle {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }
  .floating-nav-tab.active .nav-icon-circle {
    transform: translateY(-4px) scale(1.08);
  }
  .floating-nav-tab .nav-tab-label {
    font-size: 0.64rem;
  }
  .customer-directory-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}


