/* ═══════════════════════════════════════════════════════════════════════════
   D-DEY PMS — COMPONENT STYLES v4.0
   Phase 2: Header, Bottom Nav, Bottom Sheet, All Page Components
═══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════ */
#app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: transparent;
}

/* ══════════════════════════════════════════════════════
   TOP HEADER BAR — Refined, frosted glass
══════════════════════════════════════════════════════ */
.top-bar {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  /* Enhanced frosted glass effect */
  background: var(--surface-overlay);
  backdrop-filter: blur(28px) saturate(2.0);
  -webkit-backdrop-filter: blur(28px) saturate(2.0);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-slow) ease, border-color var(--t-slow) ease;
}

/* Subtle teal accent line at top of header */
.top-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--brand-sky), transparent);
  opacity: 0.6;
}

body.dark-mode .top-bar {
  background: rgba(10,14,26,0.95);
  border-bottom-color: rgba(255,255,255,0.05);
}

/* User section */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 55%;
  cursor: default;
}

#user-photo {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
  box-shadow: var(--shadow-primary);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 1px;
}

#header-company-name {
  color: var(--text-main);
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

#user-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* Header action buttons */
.header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  position: relative;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast),
    transform var(--t-fast) var(--ease-spring);
  position: relative;
}

.icon-btn:hover { background: var(--input-bg); color: var(--text-main); border-radius: 10px; }
.icon-btn:active { transform: scale(0.90); }
.icon-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
}
.icon-btn:hover::after { opacity: 0.06; }

.icon-btn .material-icons-outlined { font-size: 1.25rem; }

/* Notification badge */
#notif-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--surface);
  animation: livePulse 2s ease infinite;
}

/* Voice button — sky blue accent */
#header-voice-btn { color: var(--brand-sky); }
#header-voice-btn:hover { background: rgba(14,165,233,0.10); }

/* Upgrade button — refined */
#header-upgrade-btn {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--t-base) var(--ease-out);
  white-space: nowrap;
}
#header-upgrade-btn:hover {
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
  transform: translateY(-1px);
}
#header-upgrade-btn:active { transform: scale(0.96); }
#header-upgrade-btn .material-icons-outlined { font-size: 0.95rem; }

/* ── DROPDOWN MENU ───────────────────────────────────────────────────── */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 220px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
  animation: slideDown var(--t-slow) var(--ease-smooth) both;
}

.menu-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.menu-select {
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  outline: none;
  width: 100%;
  cursor: pointer;
}

.menu-item-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
}
.menu-item-btn:hover { background: var(--input-bg); }

/* ── NOTIFICATION DROPDOWN ───────────────────────────────────────────── */
.notif-container { position: relative; }

#notif-dropdown {
  top: calc(100% + 8px);
  width: 300px;
  max-height: 360px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAVIGATION — Apple-grade pill nav
══════════════════════════════════════════════════════ */
#bottom-nav {
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface-overlay);
  backdrop-filter: blur(28px) saturate(2.0);
  -webkit-backdrop-filter: blur(28px) saturate(2.0);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
  transition: background var(--t-slow) ease;
}

/* Subtle gradient fade at top of nav */
#bottom-nav::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(13,148,136,0.3) 30%,
    rgba(14,165,233,0.3) 70%,
    transparent 100%
  );
}

body.dark-mode #bottom-nav {
  background: rgba(16,30,46,0.95);
}

.nav-item {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 4px;
  padding: 8px 4px;
  position: relative;
  transition:
    color var(--t-base) var(--ease-out),
    transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.nav-item:active { transform: scale(0.90); }

/* Nav icon */
.nav-item .material-icons-outlined {
  font-size: 1.4rem;
  transition: transform var(--t-slow) cubic-bezier(0.22, 1, 0.36, 1), color var(--t-base);
}

/* Nav label */
.nav-item span:not(.material-icons-outlined) {
  font-size: 0.60rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--t-base);
}

/* Active state — pill background */
.nav-item.active {
  color: var(--primary);
}

.nav-item.active .material-icons-outlined {
  transform: translateY(-1px) scale(1.08);
}

/* Active indicator pill */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 32px;
  background: rgba(13,148,136,0.12);
  border-radius: var(--radius-full);
  border: 1px solid rgba(13,148,136,0.18);
  animation: scaleIn var(--t-slow) var(--ease-spring) both;
}

body.dark-mode .nav-item.active::before {
  background: rgba(45,212,191,0.12);
  border-color: rgba(45,212,191,0.18);
}

/* ══════════════════════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════════════════════ */
#main-content {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn var(--t-slow) var(--ease-smooth) both;
}

/* ── PAGE HEADER (Stock page etc.) ───────────────────────────────────── */
.page-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.page-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ══════════════════════════════════════════════════════
   BILLING PAGE
══════════════════════════════════════════════════════ */

/* Search bar */
.search-wrapper {
  margin: 0 0 12px;
  z-index: 20;
  position: relative;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0 10px 0 6px;
  height: 52px;
  transition: border-color var(--t-base) ease, box-shadow 0.28s cubic-bezier(0.22,1,0.36,1);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm), var(--glow-teal);
}

.scan-trigger {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: rgba(13,148,136,0.08);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease-spring);
}
.scan-trigger:hover { background: rgba(13,148,136,0.15); }
.scan-trigger:active { transform: scale(0.88); }
.scan-trigger .material-icons-outlined { font-size: 1.3rem; }

#medicine-search {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  padding: 0 10px;
  outline: none;
}
#medicine-search::placeholder { color: var(--text-light); }

.search-icon { color: var(--text-light); font-size: 1.15rem !important; }

/* Search results dropdown */
.dropdown-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  animation: slideDown var(--t-base) var(--ease-smooth) both;
}

/* Billing split layout */
.billing-main-layout {
  flex: 1;
  display: flex;
  gap: 12px;
  overflow: hidden;
}

.billing-left-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
}
/* Inner top-edge shine */
.billing-left-card::after,
.billing-right-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  pointer-events: none;
  opacity: 0.6;
}
body.dark-mode .billing-left-card::after,
body.dark-mode .billing-right-card::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.billing-right-card {
  width: 200px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Bill header */
.bill-header {
  padding: 14px 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bill-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-main);
}

.bill-items-header {
  display: grid;
  grid-template-columns: 1fr 60px 70px 36px;
  gap: 4px;
  padding: 8px 16px;
  background: var(--input-bg);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.scrollable-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.empty-cart-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text-light);
  padding: 40px;
  text-align: center;
}

.empty-cart-visual .material-icons-outlined {
  font-size: 2.5rem;
  opacity: 0.4;
}

.empty-cart-visual p {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* Summary section */
.summary-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-main);
  margin-bottom: 14px;
}

.summary-rows { flex: 1; }

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.80rem;
  color: var(--text-secondary);
}

.summary-row span:last-child {
  color: var(--text-main);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.summary-row.divider {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.discount-row .icon-edit-btn {
  width: 20px; height: 20px;
  border: none;
  background: var(--input-bg);
  border-radius: var(--radius-xs);
  color: var(--text-light);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.discount-row .icon-edit-btn .material-icons-outlined { font-size: 0.85rem; }
.discount-row .icon-edit-btn:hover { background: var(--border); color: var(--text-main); }

.grand-total-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin: 8px 0;
}

.grand-total-section span:first-child {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.grand-total-section #cart-total {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

/* Payment mode select */
#payment-mode {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-base);
  -webkit-appearance: none;
}
#payment-mode:focus { border-color: var(--primary); box-shadow: var(--glow-teal); }

/* Hold / Print buttons */
.btn-hold-modern {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all var(--t-base) var(--ease-out);
}
.btn-hold-modern:hover { background: var(--border); color: var(--text-main); }
.btn-hold-modern:active { transform: scale(0.97); }

.btn-print-modern {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow-primary);
  transition: all var(--t-base) var(--ease-out);
  letter-spacing: 0.02em;
}
.btn-print-modern:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 24px rgba(13,148,136,0.38);
  transform: translateY(-2px);
}
.btn-print-modern:active { transform: scale(0.97) translateY(0); }

/* Developer credit */
.developer-credit {
  font-size: 0.60rem;
  color: var(--text-light);
  text-align: center;
  padding: 6px;
  opacity: 0.5;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}

/* Resume bill btn */
.resume-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--warning);
  background: rgba(245,158,11,0.10);
  color: var(--warning);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-base);
}
.resume-btn:hover { background: rgba(245,158,11,0.18); }

.text-danger-btn {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), transform var(--t-fast) var(--ease-spring);
}
.text-danger-btn:hover { background: rgba(239,68,68,0.10); }
.text-danger-btn:active { transform: scale(0.88); }

/* ══════════════════════════════════════════════════════
   INVENTORY PAGE
══════════════════════════════════════════════════════ */
.filter-container {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.filter-container::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-base) var(--ease-out);
  flex-shrink: 0;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

.filter-btn:not(.active):hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Table wrapper */
.table-wrapper {
  flex: 1;
  overflow: auto;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-height: 0;
}

/* Inventory table */
#inventory-table, .history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.80rem;
}

#inventory-table th, .history-table th {
  background: var(--input-bg);
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

#inventory-table td, .history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.80rem;
  vertical-align: middle;
}

#inventory-table tr:last-child td,
.history-table tr:last-child td {
  border-bottom: none;
}

#inventory-table tbody tr {
  transition: background var(--t-fast);
}

#inventory-table tbody tr:hover {
  background: var(--input-bg);
}

/* Stock search */
#stock-search {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  max-width: 150px;
}
#stock-search:focus { border-color: var(--primary); box-shadow: var(--glow-teal); }

/* Action btn (Add button) */
.action-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: all var(--t-base) var(--ease-out);
  white-space: nowrap;
}
.action-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.action-btn:active { transform: scale(0.96); }
.action-btn .material-icons-outlined { font-size: 1rem; }

/* ══════════════════════════════════════════════════════
   ANALYTICS PAGE
══════════════════════════════════════════════════════ */
.analytics-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 20px;
  -webkit-overflow-scrolling: touch;
}

/* Analytics search */
#analytics-search {
  width: 100%;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  padding: 11px 16px;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
#analytics-search:focus { border-color: var(--primary); box-shadow: var(--glow-teal); }

/* Filter pills */
.an-filter-pill {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-base) var(--ease-out);
}

.an-filter-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

.an-filter-pill:not(.active):hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════
   PROFILE PAGE — Redesigned, iOS Settings aesthetic
══════════════════════════════════════════════════════ */

/* Profile scrollable container */
#profile-page {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Profile hero card */
.profile-header-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 28px 20px 24px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Ambient teal glow top */
.profile-header-card::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 120px;
  background: radial-gradient(ellipse, rgba(13,148,136,0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* Profile avatar ring */
.profile-image-container {
  width: 88px; height: 88px;
  margin-bottom: 14px;
  position: relative;
  border-radius: var(--radius-full);
  padding: 3px;
  background: linear-gradient(135deg, var(--primary), var(--brand-sky));
  box-shadow: var(--shadow-primary);
}

#profile-pic-large {
  width: 100%; height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--card-bg);
  background: var(--input-bg);
  display: block;
}

#profile-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-main);
  margin-bottom: 3px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

#profile-email {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 10px;
  font-family: 'DM Sans', sans-serif;
}
#profile-email a { color: var(--text-light); text-decoration: none; }

/* Profile grid — grouped sections */
.profile-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Section label inside profile */
.profile-section-header {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 14px 4px 6px;
  font-family: 'DM Sans', sans-serif;
}

/* Profile card — grouped rows */
.profile-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--border);
  transition:
    background var(--t-fast),
    transform var(--t-fast) var(--ease-spring),
    box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.profile-card:hover { background: var(--input-bg); }
.profile-card:active { transform: scale(0.98); }

/* Group consecutive cards with shared border radius */
.profile-card-group {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.profile-card-group .profile-card {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

.profile-card-group .profile-card:last-child {
  border-bottom: none;
}

/* Icon container — unified style, color via inline var */
.p-card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-right: 14px;
  flex-shrink: 0;
  font-size: 1.1rem;
  background: rgba(13,148,136,0.10);
  color: var(--primary);
}

.p-card-text { flex: 1; min-width: 0; }
.p-card-text h3 {
  font-size: 0.90rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1px;
  font-family: 'DM Sans', sans-serif;
}
.p-card-text p {
  font-size: 0.72rem;
  color: var(--text-light);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow {
  color: var(--text-light);
  opacity: 0.35;
  font-size: 1.1rem !important;
}

/* Logout card */
.logout-card {
  background: var(--card-bg) !important;
  border-color: rgba(239,68,68,0.15) !important;
  margin-top: 10px;
}

.logout-card:hover {
  background: rgba(239,68,68,0.04) !important;
}

/* ══════════════════════════════════════════════════════
   FULL-SCREEN MODALS — slide up from bottom
══════════════════════════════════════════════════════ */
.full-screen-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg-gradient);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  animation: slideUpSpring var(--t-page) var(--ease-smooth) both;
  will-change: transform;
}

.fs-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  gap: 12px;
}

.fs-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-main);
  flex: 1;
}

.fs-back-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--input-bg);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-spring);
}
.fs-back-btn:hover { background: var(--border); color: var(--text-main); }
.fs-back-btn:active { transform: scale(0.88); }

.fs-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* ══════════════════════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: fadeIn var(--t-base) var(--ease-out) both;
}

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinPulse 0.8s linear infinite;
}

.loading-overlay-msg {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════
   DEMO BANNER
══════════════════════════════════════════════════════ */
.demo-banner {
  background: linear-gradient(90deg, rgba(245,158,11,0.15), rgba(245,158,11,0.08));
  border-bottom: 1px solid rgba(245,158,11,0.25);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warning);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   CART ITEM ROWS
══════════════════════════════════════════════════════ */
.cart-item {
  display: grid;
  grid-template-columns: 1fr 60px 70px 36px;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background var(--t-fast);
  animation: slideUp var(--t-base) var(--ease-smooth) both;
}

.cart-item:hover { background: var(--input-bg); }
.cart-item:last-child { border-bottom: none; }

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

.cart-item-sub {
  font-size: 0.68rem;
  color: var(--text-light);
  margin-top: 1px;
}

.cart-qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-qty-btn {
  width: 22px; height: 22px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--t-fast) var(--ease-spring);
}
.cart-qty-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.cart-qty-btn:active { transform: scale(0.85); }

.cart-item-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}

.cart-remove-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin: 0 auto;
  transition: all var(--t-fast) var(--ease-spring);
}
.cart-remove-btn:hover { background: rgba(239,68,68,0.10); color: var(--danger); }
.cart-remove-btn:active { transform: scale(0.85); }
.cart-remove-btn .material-icons-outlined { font-size: 1rem; }

/* ══════════════════════════════════════════════════════
   SUBSCRIPTION / PLAN CARDS
══════════════════════════════════════════════════════ */
.sub-plan-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.plan-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-main);
}

.plan-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(16,185,129,0.12);
  color: var(--success);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════
   MODAL OVERLAY (generic)
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--t-base) var(--ease-out) both;
}

/* ══════════════════════════════════════════════════════
   DESKTOP SIDEBAR NAV (768px+)
══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #app-container {
    display: grid;
    grid-template-areas:
      "sidebar header"
      "sidebar main";
    grid-template-columns: 220px 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100dvh;
    overflow: hidden;
  }

  .top-bar {
    grid-area: header;
    position: relative;
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    border-radius: 0;
  }

  /* Keep subtle teal accent line on desktop too */
  .top-bar::before {
    display: block;
    opacity: 0.35;
  }

  #main-content {
    grid-area: main;
    margin-top: 0;
    padding: 0;
    background: var(--bg-gradient);
    overflow: hidden;
  }

  .page-view {
    max-width: 100%;
    padding: 24px;
    height: 100%;
  }

  /* Sidebar nav */
  #bottom-nav {
    grid-area: sidebar;
    position: relative;
    height: 100%;
    width: 100%;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-top: none;
    z-index: 50;
    overflow-y: auto;
  }

  #bottom-nav::before { display: none; }

  /* Sidebar logo area */
  #bottom-nav::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--brand-sky));
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 18px;
    gap: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    height: auto;
    flex: none;
    transition: all var(--t-base) var(--ease-out);
    margin: 2px 12px;
    border-radius: var(--radius-md);
  }

  .nav-item:active { transform: scale(0.98); }

  .nav-item .material-icons-outlined { font-size: 1.2rem; }

  .nav-item span:not(.material-icons-outlined) {
    font-size: 0.88rem;
    letter-spacing: 0;
  }

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

  .nav-item.active {
    background: var(--primary);
    color: white !important;
    box-shadow: var(--shadow-primary);
  }

  .nav-item.active .material-icons-outlined { transform: none; }

  /* Remove pill indicator on desktop */
  .nav-item.active::before { display: none; }

  /* Billing split */
  .billing-main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: 100%;
    padding: 0;
  }

  .billing-left-card, .billing-right-card {
    height: 100%;
    min-height: 0;
    margin-bottom: 0;
  }

  .billing-right-card { width: auto; }

  /* Stock table full height */
  #inventory-page {
    height: 100%;
    overflow: hidden;
  }

  .table-wrapper { height: calc(100% - 80px); }
}


/* ── Udhaar & Supplier panel: hidden until .open ── */
#udhaar-detail-panel,
#supplier-detail-panel {
    visibility: hidden;
    transition: transform 0.36s cubic-bezier(0.22,1,0.36,1), visibility 0s linear 0.36s;
}
#udhaar-detail-panel.open,
#supplier-detail-panel.open {
    visibility: visible;
    transition: transform 0.36s cubic-bezier(0.22,1,0.36,1), visibility 0s linear 0s;
}
