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

:root {
  /* Color System */
  --bg-main: #0b0f19;
  --bg-card: #151f32;
  --bg-card-hover: #1e2d4a;
  --bg-input: #0e1624;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --gold-primary: #d4af37;
  --gold-light: #f3d060;
  --gold-dark: #b8901c;
  --gold-glow: rgba(212, 175, 55, 0.25);
  
  --silver-primary: #cbd5e1;
  --silver-light: #f1f5f9;
  --silver-dark: #94a3b8;
  --silver-glow: rgba(203, 213, 225, 0.25);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --info: #3b82f6;
  
  --border: rgba(212, 175, 55, 0.15);
  --border-muted: rgba(148, 163, 184, 0.1);
  --border-focus: rgba(212, 175, 55, 0.5);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Global autofill reset */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #0e1624 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  transition: background-color 5000s ease-in-out 0s;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  background-image: radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.04) 0%, transparent 40%),
                    radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.03) 0%, transparent 50%);
  background-attachment: fixed;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  box-shadow: inset 0 0 24px 6px rgba(0, 114, 255, 0.85);
  z-index: 99999;
}

body[data-side-glow="disabled"]::after {
  display: none !important;
}

/* Day Mode (Light Theme) Overrides */
:root[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border: rgba(212, 175, 55, 0.4);
  --border-muted: #cbd5e1;
  --border-focus: rgba(212, 175, 55, 0.8);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .owner-profile-card-horizontal,
:root[data-theme="light"] .time-filter-container,
:root[data-theme="light"] .settings-card,
:root[data-theme="light"] .settings-pages-container,
:root[data-theme="light"] .settings-sidebar {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="light"] .nav-item {
  color: #475569 !important;
}

:root[data-theme="light"] .nav-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

:root[data-theme="light"] .nav-item.active {
  background: #0f172a !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25) !important;
}

:root[data-theme="light"] .nav-item.active i {
  color: #fbbf24 !important;
}

:root[data-theme="light"] .settings-tab-btn {
  color: #334155 !important;
}

:root[data-theme="light"] .settings-tab-btn:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

:root[data-theme="light"] .settings-tab-btn.active {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25) !important;
  font-weight: 700 !important;
}

:root[data-theme="light"] .settings-tab-btn.active i {
  color: #fbbf24 !important;
}

:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] #btn-save-restructured-settings,
:root[data-theme="light"] #btn-save-wizard-settings {
  background: linear-gradient(135deg, #d4af37 0%, #b8901c 100%) !important;
  color: #000000 !important;
  font-weight: 700 !important;
  border-color: #b8901c !important;
  box-shadow: 0 4px 12px rgba(184, 144, 28, 0.35) !important;
}

:root[data-theme="light"] .btn-primary:hover,
:root[data-theme="light"] #btn-save-restructured-settings:hover,
:root[data-theme="light"] #btn-save-wizard-settings:hover {
  background: linear-gradient(135deg, #e5c158 0%, #d4af37 100%) !important;
  color: #000000 !important;
}

:root[data-theme="light"] .form-control {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

:root[data-theme="light"] .form-control:focus {
  border-color: var(--gold-primary) !important;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2) !important;
}

:root[data-theme="light"] .form-control::placeholder {
  color: #94a3b8;
}

:root[data-theme="light"] body::after {
  box-shadow: inset 0 0 24px 6px rgba(0, 114, 255, 0.4);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 280px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.brand-logo {
  font-size: 2rem;
  color: var(--gold-primary);
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item button {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.nav-item button i {
  font-size: 1.1rem;
  transition: transform var(--transition-fast);
}

.nav-item button:hover {
  color: var(--text-main);
  background-color: var(--bg-card-hover);
  border-color: rgba(212, 175, 55, 0.1);
}

.nav-item button:hover i {
  transform: translateX(3px);
}

.nav-item.active button {
  color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.05);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border-muted);
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--bg-input);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
}

.status-dot.offline {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  width: calc(100% - 280px);
}

.tab-content {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-content.active {
  display: block;
}

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

/* Header & Typography */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-muted);
}

.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.section-title span {
  color: var(--gold-primary);
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* UI Elements: Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-primary) 100%);
  color: #000000 !important;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--gold-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--gold-glow);
}

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

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--gold-primary);
}

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

.btn-danger:hover {
  background-color: #ff5252;
  box-shadow: 0 4px 12px var(--danger-glow);
}

/* UI Elements: Badges */
.badge {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.05);
}

.badge-silver {
  background: rgba(203, 213, 225, 0.1);
  color: var(--silver-primary);
  border: 1px solid rgba(203, 213, 225, 0.25);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* UI Elements: Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

/* Date & Time Picker Global Styling */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
  color-scheme: dark;
  -webkit-text-fill-color: var(--text-main);
  color: var(--text-main);
  min-height: 42px;
  line-height: 1.4;
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  font-family: var(--font-body);
  box-sizing: border-box;
}

:root[data-theme="light"] input[type="date"],
:root[data-theme="light"] input[type="datetime-local"],
:root[data-theme="light"] input[type="month"],
:root[data-theme="light"] input[type="time"] {
  color-scheme: light;
  -webkit-text-fill-color: #0f172a;
  color: #0f172a;
  background-color: #ffffff;
  border-color: #cbd5e1;
}

/* Inputs with Icons Left Padding Protection */
.input-with-icon input,
.autocomplete-mobile-wrapper input,
#bill-cust-mobile,
#bill-cust-name,
#bill-cust-email,
#bill-cust-address,
#udhar-search-input,
#cust-search-input,
#sales-search-input,
.form-group div[style*="position: relative"] > input.form-control {
  padding-left: 2.75rem !important;
}

div[style*="position: relative"] > i.fa-solid,
.input-with-icon i,
.autocomplete-mobile-wrapper i.fa-solid {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  z-index: 2;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
}

.form-control::placeholder {
  color: rgba(148, 163, 184, 0.4);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* ==================== MODULE 1: INVENTORY UI ==================== */
.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  background-color: var(--bg-card);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-muted);
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-wrapper .form-control {
  padding-left: 2.5rem;
}

.filter-select {
  width: 200px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-bottom: 3rem;
}

.inventory-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.inventory-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.05);
}

.item-image-container {
  height: 200px;
  background-color: #0e1624;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-muted);
}

.item-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.inventory-card:hover .item-image-container img {
  transform: scale(1.05);
}

.placeholder-image {
  font-size: 3rem;
  color: var(--text-muted);
  opacity: 0.3;
}

.card-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-status-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.item-details-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.item-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  line-height: 1.3;
}

.item-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 0.5rem;
  column-gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-muted);
  padding-bottom: 0.75rem;
}

.spec-val {
  font-weight: 600;
  color: var(--text-main);
}

.card-charges-block {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.card-actions button {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.8rem;
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-container {
  width: 100%;
  max-width: 600px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  background-color: var(--bg-input);
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--gold-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  background-color: var(--bg-input);
  border-top: 1px solid var(--border-muted);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Image Upload Preview in Modal */
.image-upload-preview {
  width: 100%;
  height: 150px;
  background-color: var(--bg-input);
  border: 2px dashed var(--border-muted);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.image-upload-preview:hover {
  border-color: var(--gold-primary);
}

.image-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ==================== MODULE 2: BILL GENERATION ==================== */
.rates-config-panel {
  display: flex;
  gap: 1.5rem;
  background-color: var(--bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.03);
}

.rates-config-panel .rate-input-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rate-input-group span {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
}

.rate-input-group span.gold {
  color: var(--gold-primary);
}

.rate-input-group span.silver {
  color: var(--silver-primary);
}

.rate-input-group .form-control {
  width: 130px;
  text-align: right;
  font-weight: 700;
}

.bill-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}


/* Customer billing info card */
.billing-customer-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-muted);
}

.autocomplete-mobile-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: var(--shadow-md);
  margin-top: 2px;
}

.autocomplete-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.autocomplete-item:hover {
  background-color: var(--bg-card-hover);
}

.autocomplete-item-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.autocomplete-item-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Items details builder card */
.billing-items-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

/* Billing rows builder table */
.bill-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.bill-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 800px;
}

.bill-table th {
  background-color: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border-muted);
}

.bill-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.bill-table .form-control {
  padding: 6px 8px;
  font-size: 0.85rem;
  border-radius: 4px;
}

.bill-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

.bill-item-select {
  width: 180px;
}

.bill-rate-input {
  width: 115px !important;
  text-align: right;
}

.bill-weight-input {
  width: 85px !important;
  text-align: right;
}

/* Hide number spin buttons */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

.bill-charge-input {
  width: 110px !important;
  text-align: right;
}

.bill-row-total {
  font-weight: 700;
  text-align: right;
}

.delete-row-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color var(--transition-fast);
}

.delete-row-btn:hover {
  color: var(--danger);
}

.billing-summary-section {
  display: flex;
  justify-content: flex-end;
  border-top: 1px dashed var(--border-muted);
  padding-top: 1.5rem;
}

.summary-calculator-box {
  width: 320px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.summary-row.grand-total-row {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-primary);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.billing-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.billing-actions button {
  flex: 1;
}

/* ==================== MODULE 4: CUSTOMER TIMELINE ==================== */
.customer-history-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
}

.customer-sidebar-search {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 1.5rem;
}

.search-results-list {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-customer-item {
  padding: 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-customer-item:hover, .search-customer-item.active {
  border-color: var(--gold-primary);
  background-color: var(--bg-card-hover);
}

.search-cust-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.search-cust-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Timeline grid list */
.timeline-main-view {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 2rem;
  min-height: 500px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-muted);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.date-range-filter-box {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.date-range-filter-box span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.date-range-filter-box .form-control {
  width: 140px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.timeline-profile-card {
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 2.5rem;
}

.timeline-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.profile-stat-box {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-stat-val {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  margin-top: 2px;
}

.profile-stat-val.gold {
  color: var(--gold-primary);
}

/* Timeline Cards */
.customer-timeline-wrapper {
  position: relative;
  padding-left: 2rem;
}

.customer-timeline-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
  background-color: var(--border);
}

.timeline-node {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 3px solid var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
  z-index: 2;
}

.timeline-card {
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.timeline-card:hover {
  border-color: var(--gold-primary);
}

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

.timeline-inv-no {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}

.timeline-inv-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timeline-inv-actions {
  display: flex;
  gap: 0.5rem;
}

.timeline-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

.timeline-item-name-block {
  font-weight: 600;
}

.timeline-item-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

.timeline-card-totals {
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-muted);
  padding-top: 0.75rem;
}

.timeline-total-val {
  font-weight: 700;
  color: var(--gold-primary);
}

.timeline-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  text-align: center;
}

.timeline-empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border);
}

/* ==================== MODULE 5: SETTINGS TAB ==================== */
.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.settings-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.settings-integration-status {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.integration-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
}

.integration-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.integration-info i {
  font-size: 1.5rem;
}

.integration-info.google i {
  color: #ea4335;
}

.integration-info.smtp i {
  color: var(--gold-primary);
}

.integration-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.integration-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

@media print {
  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body * {
    visibility: hidden;
  }
  #print-area, #print-area * {
    visibility: visible;
  }
  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm;
    height: 297mm;
  }
}

/* ==================== DYNAMIC PUBLIC CATALOG CUSTOM STYLES ==================== */
.catalog-body {
  overflow-y: scroll;
}

/* Category Filter quick scroll styling */
#category-filter-container::-webkit-scrollbar {
  height: 4px;
}
#category-filter-container::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border-radius: 2px;
}
#category-filter-container::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

.catalog-cat-btn {
  border: 1px solid var(--border-muted);
  background-color: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.catalog-cat-btn:hover {
  color: var(--text-main);
  border-color: var(--border);
}

.catalog-cat-btn.active {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-primary) 100%);
  color: var(--bg-main) !important;
  border-color: var(--gold-primary);
  box-shadow: 0 4px 10px var(--gold-glow);
}

/* Hover Zoom and Card scale enhancements for catalog items */
.inventory-card:hover .btn-inquire-item {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-light) 100%);
  color: var(--bg-main);
}

.view-public-catalog-sidebar-btn:hover {
  background-color: var(--bg-card-hover);
  color: var(--gold-primary);
}

/* Administrator Portal Header Nav Enhancements */
.header-nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 0.85rem;
  padding: 0.5rem 1.15rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  font-family: var(--font-heading);
}

.header-nav-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active .header-nav-btn {
  color: var(--gold-primary) !important;
  background-color: rgba(212, 175, 55, 0.08) !important;
  border: 1px solid rgba(212, 175, 55, 0.25) !important;
  box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.05);
}

/* Sidebar Directory Toggle Highlights */
#btn-cust-type-buyer.active, #btn-udhar-type-buyer.active, #btn-calc-type-emi.active {
  background: var(--info) !important;
  color: white !important;
  border: 1px solid var(--info) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25) !important;
}

#btn-cust-type-loan.active, #btn-udhar-type-loan.active, #btn-calc-type-gold.active {
  background: var(--gold-primary) !important;
  color: var(--bg-main) !important;
  border: 1px solid var(--gold-primary) !important;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.35) !important;
}

/* Customer Search Item Highlights based on customer type */
.search-customer-item.buyer-item:hover,
.search-customer-item.buyer-item.active {
  border-color: var(--info) !important;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2) !important;
  background-color: var(--bg-card-hover) !important;
}

.search-customer-item.loan-item:hover,
.search-customer-item.loan-item.active {
  border-color: var(--gold-primary) !important;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.2) !important;
  background-color: var(--bg-card-hover) !important;
}

/* ==================== DASHBOARD & ANALYTICS OVERLAYS ==================== */
.dashboard-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .dashboard-grid-layout {
    grid-template-columns: 360px 1fr;
  }
}

.owner-profile-card {
  background: rgba(21, 31, 50, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 100px;
}

.kpi-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: linear-gradient(135deg, rgba(21, 31, 50, 0.95) 0%, rgba(30, 45, 74, 0.6) 100%);
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.08);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.kpi-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.25rem;
}

.kpi-value.gold {
  color: var(--gold-primary);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.kpi-value.success {
  color: var(--success);
}

.kpi-value.danger {
  color: #fca5a5;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Duration Filter Button Styles */
.filter-duration-btn {
  background-color: rgba(30, 41, 59, 0.4) !important;
  border: 1px solid var(--border-muted) !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  transition: all var(--transition-fast) !important;
}

.filter-duration-btn:hover {
  background-color: rgba(212, 175, 55, 0.08) !important;
  border-color: rgba(212, 175, 55, 0.4) !important;
  color: var(--text-main) !important;
}

.filter-duration-btn.active {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-primary) 100%) !important;
  color: var(--bg-main) !important;
  border-color: var(--gold-light) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4) !important;
  transform: scale(1.05);
}

/* Premium Data Table Styles */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.data-table th {
  background-color: rgba(14, 22, 36, 0.6) !important;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1.25rem 1rem;
  border-bottom: 2px solid rgba(212, 175, 55, 0.2);
}

.data-table td {
  padding: 1.15rem 1rem;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
  font-size: 0.85rem;
  color: var(--text-main);
}

.data-table tr {
  transition: all var(--transition-fast);
}

.data-table tr:hover td {
  background-color: rgba(30, 45, 74, 0.35) !important;
}

/* Make calendar picker indicator icon visible on dark theme */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.9) brightness(1.2) contrast(1.2);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Sales Summary Bar & KPI Cells */
#sales-summary-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  background: rgba(21, 31, 50, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sales-kpi-cell {
  background: rgba(14, 22, 36, 0.6);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition-fast);
}

.sales-kpi-cell:hover {
  border-color: rgba(212, 175, 55, 0.3);
}

.skpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skpi-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-heading);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (Realme, iPhone, Android, iPad)
   Laptop / Desktop View (>992px) remains 100% unaffected.
   ========================================================================== */

/* Mobile Topbar & Backdrop - Hidden by default on Desktop */
.app-mobile-topbar {
  display: none;
}

.mobile-sidebar-backdrop {
  display: none;
}

.btn-close-mobile-sidebar {
  display: none;
}

/* Tablet & Mobile Breakpoint (<= 992px) */
@media (max-width: 992px) {
  /* Layout Flow */
  .app-container {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    position: relative !important;
  }

  /* Sticky Top Navigation Bar for Mobile */
  .app-mobile-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 60px !important;
    padding: 0 1rem !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-bottom: 1px solid var(--border) !important;
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 990 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  :root[data-theme="light"] .app-mobile-topbar {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
  }

  .mobile-topbar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    cursor: pointer !important;
    text-decoration: none !important;
  }

  .mobile-topbar-brand i {
    font-size: 1.4rem !important;
    color: var(--gold-primary) !important;
    filter: drop-shadow(0 0 6px var(--gold-glow)) !important;
  }

  .mobile-topbar-brand h1 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 1.1rem !important;
    letter-spacing: 0.5px !important;
    color: var(--text-main) !important;
    line-height: 1 !important;
    margin: 0 !important;
    text-transform: uppercase !important;
  }

  .mobile-topbar-brand span {
    font-size: 0.58rem !important;
    color: var(--gold-primary) !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    font-weight: 700 !important;
    background: rgba(212, 175, 55, 0.12) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
  }

  .mobile-topbar-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .mobile-hamburger-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 8px !important;
    background: rgba(212, 175, 55, 0.12) !important;
    border: 1px solid rgba(212, 175, 55, 0.35) !important;
    color: var(--gold-primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }

  .mobile-hamburger-btn:active {
    transform: scale(0.94) !important;
    background: rgba(212, 175, 55, 0.25) !important;
  }

  /* Off-canvas Sliding Drawer Sidebar */
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1010 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 6px 0 35px rgba(0, 0, 0, 0.7) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 1.25rem !important;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .btn-close-mobile-sidebar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--border-muted) !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    font-size: 1.2rem !important;
    transition: all 0.2s ease !important;
    margin-left: auto !important;
  }

  .btn-close-mobile-sidebar:hover {
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--danger) !important;
  }

  /* Backdrop Overlay */
  .mobile-sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(5, 8, 15, 0.75) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 1005 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
  }

  .mobile-sidebar-backdrop.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Main Viewport Container */
  .app-main {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 1rem 0.75rem 4rem 0.75rem !important;
    margin: 0 !important;
    flex: none !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    min-width: 0 !important;
  }

  /* Section Headers & Typography */
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.85rem !important;
    margin-bottom: 1.25rem !important;
    padding-bottom: 0.85rem !important;
    width: 100% !important;
  }

  .section-header > div:first-child {
    width: 100% !important;
  }

  .section-title {
    font-size: 1.35rem !important;
    line-height: 1.25 !important;
  }

  .section-desc {
    font-size: 0.82rem !important;
    line-height: 1.4 !important;
  }

  .section-header .btn,
  .section-header button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ==================== SETTINGS & TWO-COLUMN LAYOUTS MOBILE ==================== */
  .settings-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    width: 100% !important;
  }

  .settings-wizard-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    min-height: auto !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
  }

  .settings-sidebar {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    gap: 0.45rem !important;
    padding: 0.6rem !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 12px !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
  }

  .settings-sidebar::-webkit-scrollbar {
    display: none !important;
  }

  .settings-tab-btn {
    flex-shrink: 0 !important;
    width: auto !important;
    padding: 0.55rem 0.95rem !important;
    font-size: 0.8rem !important;
    border-radius: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .settings-pages-container {
    width: 100% !important;
    padding: 1.25rem 0.9rem !important;
    min-height: auto !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  /* Form Rows & Multi-Column Layouts Collapse to Single Column */
  .form-row {
    flex-direction: column !important;
    gap: 0.85rem !important;
    width: 100% !important;
    margin-bottom: 0.85rem !important;
  }

  .form-row .form-group {
    width: 100% !important;
    flex: 1 1 100% !important;
    margin-bottom: 0 !important;
  }

  /* Form Inputs & Controls */
  .form-control {
    font-size: 0.9rem !important;
    padding: 0.65rem 0.85rem !important;
    min-height: 42px;
    box-sizing: border-box !important;
  }

  /* Protected Table Form Controls (Must stay compact inside scrollable table rows) */
  .bill-table .form-control,
  .exchange-table .form-control,
  .data-table .form-control,
  .bill-custom-name-input,
  .bill-item-type-select,
  .bill-purity-select,
  .bill-pcs-input,
  .bill-rate-input,
  .bill-gross-weight-input,
  .bill-stone-weight-input,
  .bill-net-weight-input,
  .bill-weight-input,
  .bill-charge-input,
  .bill-charge-type-select,
  .bill-table select,
  .exchange-table select {
    padding: 4px 6px !important;
    font-size: 0.82rem !important;
    min-height: 30px !important;
    height: 30px !important;
    box-sizing: border-box !important;
  }

  .bill-table .bill-hsn-input,
  .bill-table .bill-huid-input {
    padding: 2px 4px !important;
    font-size: 0.72rem !important;
    height: 22px !important;
    min-height: 22px !important;
  }

  /* Rates Config Panel in Invoice / Settings */
  .rates-config-panel {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 1rem 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rates-config-panel .rate-input-group {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .rate-input-group .form-control {
    width: 130px !important;
  }

  /* Customer Billing Card & Summary */
  .billing-customer-card,
  .billing-items-card {
    padding: 1.15rem 0.85rem !important;
    border-radius: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .billing-customer-card div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
    width: 100% !important;
  }

  .billing-customer-card div[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
    width: 100% !important;
  }

  .bill-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    margin-bottom: 1rem !important;
    border: 1px solid var(--border-muted) !important;
    border-radius: 8px !important;
    background-color: var(--bg-card) !important;
  }

  #bill-items-table,
  #exchange-items-table {
    min-width: 980px !important;
    width: 980px !important;
    border-collapse: collapse !important;
  }

  .billing-summary-section {
    justify-content: stretch !important;
    width: 100% !important;
    padding-top: 1rem !important;
  }

  .summary-calculator-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  .billing-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  .billing-actions button {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.85rem !important;
    font-size: 0.9rem !important;
  }

  /* CA Accountant Tab Controls & Filters */
  #accountant-tab div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .acc-ledger-type-group {
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 0.4rem !important;
  }

  #acc-ledger-type {
    width: 100% !important;
    min-height: 42px !important;
    height: auto !important;
    padding: 0.6rem 0.85rem !important;
    font-size: 0.9rem !important;
  }

  #acc-date-filter-box,
  #acc-custom-date-inputs {
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #accountant-tab .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
  }

  #accountant-tab .data-table {
    min-width: 780px !important;
  }

  /* Udhar Khata Tab Controls & Tables */
  #udhar-tab div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }

  #udhar-bulk-panel {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }

  #udhar-search-input {
    width: 100% !important;
  }

  #udhar-tab .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    border-radius: 10px !important;
  }

  #udhar-tab .data-table {
    min-width: 780px !important;
  }

  /* Settings Page QR & Action Buttons */
  .settings-qr-card-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
  }

  .settings-qr-btn-group {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .settings-qr-btn-group button {
    flex: 1 1 auto !important;
    justify-content: center !important;
    min-width: 130px !important;
  }

  /* Gold Loan Tab Layout & Date Pickers */
  #loans-tab .form-row {
    flex-direction: column !important;
    gap: 0.85rem !important;
  }

  #loans-tab input[type="date"] {
    min-height: 44px !important;
    height: 44px !important;
    width: 100% !important;
  }

  #loans-tab div[style*="display: flex; gap: 1rem; margin-top: 2rem"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  #btn-save-loan,
  #btn-reset-loan {
    width: 100% !important;
    flex: 1 1 100% !important;
  }

  /* Universal Table Responsive Wrapper */
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
  }

  .data-table {
    min-width: 720px !important;
  }

  /* Sales Register & Tables */
  #sales-summary-bar {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    padding: 0.85rem !important;
  }

  .sales-kpi-cell {
    padding: 0.7rem !important;
  }

  .skpi-val {
    font-size: 0.98rem !important;
  }

  .filter-select {
    width: 100% !important;
    min-width: 100% !important;
  }

  .filters-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  /* Customer Ledger & Timeline */
  .customer-history-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    width: 100% !important;
  }

  .customer-sidebar-search {
    padding: 1.15rem 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .timeline-main-view {
    padding: 1.15rem 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .timeline-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.85rem !important;
  }

  .date-range-filter-box {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .date-range-filter-box .form-control {
    flex: 1 !important;
    min-width: 110px !important;
  }

  /* Dashboard Cards & Layout */
  .owner-profile-card-horizontal {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 1.15rem 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .owner-profile-card-horizontal > div:last-child {
    width: 100% !important;
    display: flex !important;
    gap: 0.5rem !important;
  }

  .owner-profile-card-horizontal > div:last-child button {
    flex: 1 !important;
    justify-content: center !important;
  }

  .time-filter-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.65rem !important;
    padding: 0.75rem 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .time-filter-buttons {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  .time-filter-buttons .btn {
    flex: 1 1 auto !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .kpi-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .kpi-card {
    padding: 1rem 0.85rem !important;
  }

  .kpi-value {
    font-size: 1.3rem !important;
  }

  /* Modal Windows */
  .modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px auto !important;
    max-height: 92vh !important;
    box-sizing: border-box !important;
  }

  .modal-header {
    padding: 1rem 1.15rem !important;
  }

  .modal-body {
    padding: 1.15rem 1rem !important;
  }

  .modal-footer {
    padding: 0.85rem 1rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .modal-footer button {
    flex: 1 !important;
    justify-content: center !important;
  }
}

/* Small Smartphone Breakpoint (<= 480px) */
@media (max-width: 480px) {
  .kpi-stats-grid {
    grid-template-columns: 1fr !important;
  }

  #sales-summary-bar {
    grid-template-columns: 1fr !important;
  }

  .time-filter-buttons {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.35rem !important;
  }

  .timeline-marker {
    left: -1.4rem !important;
  }

  .customer-timeline-wrapper {
    padding-left: 1.4rem !important;
  }
}





