/* ============================================================
   Saikrupa Lemon Traders — Main Stylesheet
   Mobile-first, lemon-green theme
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --primary:        #1B5E20;
  --primary-light:  #2E7D32;
  --primary-dark:   #145214;
  --accent:         #F9A825;
  --accent-light:   #FDD835;
  --bg:             #F1F8E9;
  --white:          #FFFFFF;
  --text:           #212121;
  --text-secondary: #616161;
  --text-light:     #9E9E9E;
  --border:         #E0E0E0;
  --success:        #2E7D32;
  --danger:         #C62828;
  --warning:        #E65100;
  --info:           #1565C0;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.08);
  --shadow:         0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.16);
  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      20px;
  --bottom-nav-h:   64px;
  --top-bar-h:      56px;
  --transition:     0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

body.page-transitioning {
  opacity: 0.98;
}

body.theme-dark {
  --bg: #0f1713;
  --white: #16221c;
  --text: #e7f1eb;
  --text-secondary: #a9b9b0;
  --text-light: #7f9288;
  --border: #2a3a32;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.35);
  --shadow: 0 2px 12px rgba(0,0,0,0.42);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);
}

body.theme-dark .login-card,
body.theme-dark .modal,
body.theme-dark .overlay-sheet,
body.theme-dark .bill-preview {
  background: #16221c;
  color: var(--text);
}

body.theme-dark .overlay-header {
  border-bottom-color: #2a4a38;
}

body.theme-dark .overlay-footer {
  border-top-color: #2a4a38;
  background: #16221c;
}

body.theme-dark .overlay-footer .btn {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

body.theme-dark .overlay-title {
  color: #e8f5e9;
}

body.theme-dark .bottom-nav {
  background: #122019;
}

body.theme-dark .form-input,
body.theme-dark .chip,
body.theme-dark .input-unit,
body.theme-dark .btn-outline,
body.theme-dark .btn-secondary {
  background: #1a2821;
  color: var(--text);
  border-color: var(--border);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-bar-h);
  background: linear-gradient(120deg, rgba(10, 60, 25, 0.72), rgba(27, 94, 32, 0.58));
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  border-bottom: 1px solid rgba(195, 255, 206, 0.28);
  color: var(--white);
  z-index: 2000;
  box-shadow: 0 10px 24px rgba(7, 43, 18, 0.28);
  isolation: isolate;
}

body.theme-dark .app-bar {
  background: linear-gradient(120deg, rgba(15, 61, 32, 0.9), rgba(26, 90, 48, 0.85));
  border-bottom-color: rgba(144, 238, 144, 0.15);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

body.theme-dark .app-bar-title {
  color: #ffffff;
}

body.theme-dark .app-bar-actions .icon-btn {
  color: #ffffff;
}
.app-bar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 10px;
}
.app-bar-logo {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.24);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-bar-logo svg { width: 18px; height: 18px; }
.app-bar-title {
  flex: 1;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-bar-actions { display: flex; gap: 4px; }

/* ── Dynamic App Header ────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-bar-h);
  background: linear-gradient(120deg, rgba(5, 30, 15, 0.65), rgba(10, 50, 22, 0.55));
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  border-bottom: 1px solid rgba(184, 255, 184, 0.15);
  color: var(--text);
  z-index: 2000;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.app-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  gap: 12px;
  max-width: 100%;
}

.app-header-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8f5e9;
  flex-shrink: 0;
}

.app-header-back:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.app-header-back svg {
  width: 24px;
  height: 24px;
}

#headerTitle {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
  color: #e8f5e9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

.app-header-spacer {
  width: 40px;
  flex-shrink: 0;
}

body.theme-dark .app-header {
  background: linear-gradient(120deg, rgba(5, 30, 15, 0.85), rgba(13, 50, 20, 0.75));
  border-bottom-color: rgba(184, 255, 184, 0.15);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

body.theme-dark .app-header-title {
  color: #b8ffb8;
}

body.theme-dark .app-header-back {
  color: #b8ffb8;
}

.page-content {
  padding-top: calc(var(--top-bar-h) + 8px);
  padding-bottom: calc(var(--bottom-nav-h) + 70px + 16px);
  min-height: 100vh;
}

/* ── Bottom Navigation ──────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 2000;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  isolation: isolate;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-light);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color var(--transition);
  padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:active { opacity: 0.7; }
.nav-icon {
  width: 22px;
  height: 22px;
  transition: stroke var(--transition);
}
.bottom-nav-item.active .nav-icon { stroke: var(--primary); }

/* ── Sections ───────────────────────────────────────────────── */
.section {
  padding: 12px 16px;
}
.section-sm { padding: 8px 16px; }
.section-actions { padding: 8px 16px 16px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Cards Grid ─────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cards-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-compact {
  padding: 10px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.card-buy    { border-left: 4px solid #1565C0; }
.card-sell   { border-left: 4px solid #2E7D32; }
.card-profit { border-left: 4px solid var(--accent); }
.card-expense{ border-left: 4px solid #C62828; }
.card-net    { border-left: 4px solid #6A1B9A; }
.card-due    { border-left: 4px solid #E65100; }

.card-icon  { font-size: 1.6rem; flex-shrink: 0; }
.card-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}
.card-body  { flex: 1; min-width: 0; }
.card-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 2px; }
.card-value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.card-value-sm { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.card-sub   { font-size: 0.72rem; color: var(--text-light); }

/* ── Price Banner ───────────────────────────────────────────── */
.price-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--white);
  box-shadow: var(--shadow);
}
.price-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.price-label  { font-size: 0.78rem; opacity: 0.85; margin-bottom: 4px; }
.price-display{ font-size: 1.6rem; font-weight: 700; }

/* ── Action Buttons (BUY / SELL) ────────────────────────────── */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn-action {
  height: 90px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-action:active { transform: scale(0.97); box-shadow: var(--shadow-sm); }
.btn-action .btn-icon { font-size: 1.6rem; }
.btn-action .btn-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}
.btn-action small,
.btn-action span:last-child:not(:only-child) { font-size: 0.72rem; font-weight: 400; opacity: 0.85; letter-spacing: 0; }
.btn-buy  { background: #1565C0; color: var(--white); }
.btn-sell { background: var(--primary-light); color: var(--white); }

/* ── Analytics Promo Link ───────────────────────────────────── */
.analytics-promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD REDESIGN — Modern & Clean Interface
   ═══════════════════════════════════════════════════════════════ */

/* Dashboard Header */
.dashboard-header {
  padding: 16px;
  padding-bottom: 12px;
}
.dashboard-title {
  margin-bottom: 16px;
}
.dashboard-greeting {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.dashboard-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

/* Summary Card Full Width */
.summary-card-full {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 4px;
}
.summary-card-full:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}
.summary-card-full .summary-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.summary-card-full .summary-card-body {
  padding-left: 48px;
}
.summary-card-full .summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Summary Cards */
.summary-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.summary-card:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

.summary-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.summary-card.card-buy .summary-icon {
  background: rgba(21, 101, 192, 0.12);
  color: #1565C0;
}

.summary-card.card-sell .summary-icon {
  background: rgba(46, 125, 50, 0.12);
  color: var(--primary);
}

.summary-card.card-profit .summary-icon {
  background: rgba(249, 168, 37, 0.12);
  color: var(--accent);
}

.summary-card.card-netqty .summary-icon,
.summary-card-full.card-netqty .summary-icon {
  background: rgba(106, 27, 154, 0.12);
  color: #6A1B9A;
}

.summary-label-group {
  flex: 1;
}

.summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0;
}

.summary-card-body {
  padding-left: 48px;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px 0;
}

.summary-sub {
  font-size: 0.7rem;
  color: var(--text-light);
  margin: 0;
}

/* Dashboard Price Section */
.dashboard-price {
  padding: 12px 16px;
}

.price-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--white);
  box-shadow: var(--shadow);
}

.price-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.price-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon-small:active {
  background: rgba(255, 255, 255, 0.25);
}

.btn-icon-small svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.price-card-display {
  text-align: center;
}

.price-display {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

/* Dashboard Actions */
.dashboard-actions {
  position: fixed;
  bottom: var(--bottom-nav-h);
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.actions-label {
  display: none;
}

.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-action-large {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: auto;
}

.btn-action-large:active {
  transform: scale(0.96);
}

.btn-action-large.btn-buy {
  background: #1565C0;
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-action-large.btn-buy:active {
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2), var(--shadow-sm);
}

.btn-action-large.btn-sell {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-action-large.btn-sell:active {
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2), var(--shadow-sm);
}

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-icon.buy-icon {
  background: rgba(21, 101, 192, 0.12);
  color: #1565C0;
}

.action-icon.sell-icon {
  background: rgba(46, 125, 50, 0.12);
  color: var(--primary);
}

.btn-action-large.btn-buy .action-icon {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.btn-action-large.btn-sell .action-icon {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.action-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.action-text {
  flex: 1;
}

.action-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1px 0;
  letter-spacing: 0.5px;
}

.btn-action-large.btn-buy .action-title,
.btn-action-large.btn-sell .action-title {
  color: var(--white);
}

.action-subtitle {
  font-size: 0.65rem;
  color: var(--text-light);
  margin: 0;
}

.btn-action-large.btn-buy .action-subtitle,
.btn-action-large.btn-sell .action-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* Dashboard Footer */
.dashboard-footer {
  padding: 16px;
  padding-top: 8px;
}

.analytics-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: box-shadow 0.2s ease;
}

.analytics-card:active {
  box-shadow: var(--shadow-sm);
}

.analytics-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(46, 125, 50, 0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.analytics-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.analytics-content {
  flex: 1;
}

.analytics-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px 0;
}

.analytics-desc {
  font-size: 0.75rem;
  color: var(--text-light);
  margin: 0;
}

.arrow-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Dark Mode Support */
body.theme-dark .dashboard-greeting,
body.theme-dark .dashboard-date {
  color: #e8f5e9;
}

body.theme-dark .summary-card {
  background: #16221c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #e8f5e9;
}

body.theme-dark .summary-value,
body.theme-dark .summary-label {
  color: #e8f5e9;
}

body.theme-dark .price-card {
  background: linear-gradient(135deg, #0f3d20 0%, #1a5a30 100%);
  color: #e8f5e9;
}

body.theme-dark .price-label {
  color: #c8e6c9;
  opacity: 0.95;
}

body.theme-dark .price-display {
  color: #e8f5e9;
}

body.theme-dark .btn-action-large,
body.theme-dark .analytics-card {
  background: #16221c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #e8f5e9;
}

body.theme-dark .dashboard-actions {
  background: #16221c;
  border-top-color: #2a4a38;
}

body.theme-dark .btn-action-large.btn-buy {
  background: #1565C0;
  color: var(--white);
}

body.theme-dark .btn-action-large.btn-sell {
  background: var(--primary);
  color: var(--white);
}

body.theme-dark .action-title,
body.theme-dark .analytics-title {
  color: #e8f5e9;
}

body.theme-dark .action-subtitle,
body.theme-dark .analytics-desc {
  color: #9ccc65;
}

body.theme-dark .btn-action-large.btn-buy .action-title,
body.theme-dark .btn-action-large.btn-sell .action-title {
  color: var(--white);
}

body.theme-dark .btn-action-large.btn-buy .action-subtitle,
body.theme-dark .btn-action-large.btn-sell .action-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 640px) {
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .btn-action-large {
    padding: 12px;
    gap: 10px;
  }
  
  .action-icon {
    width: 36px;
    height: 36px;
  }
  
  .action-title {
    font-size: 0.85rem;
  }
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,94,32,0.12);
}
.form-input::placeholder { color: var(--text-light); }
.form-input-sm { padding: 7px 10px; font-size: 0.85rem; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23616161' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px; }
.form-row { display: flex; gap: 10px; }
.input-wrapper { position: relative; }
.input-toggle-btn {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}
.input-group { display: flex; align-items: stretch; }
.input-group .form-input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-unit {
  background: #F5F5F5;
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* ── Calculations Display ───────────────────────────────────── */
.calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #F9FBE7;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.calc-label { color: var(--text-secondary); font-weight: 500; }
.calc-value { font-weight: 700; }
.highlight-green { color: var(--success); }
.highlight-red   { color: var(--danger); }
.highlight-amount { color: var(--primary); font-size: 1.05rem; }
.highlight-box { background: #E8F5E9; border: 1px solid #A5D6A7; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: none;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: 0.8; transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--primary); color: var(--white); font-weight: 600; }
.btn-success   { background: var(--success); color: var(--white); font-weight: 600; }
.btn-danger    { background: var(--danger);  color: var(--white); font-weight: 600; }
.btn-warning   { background: var(--warning); color: var(--white); font-weight: 600; }
.btn-secondary { background: #E0E0E0; color: var(--text); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline-yellow { background: transparent; border: 1.5px solid rgba(255,255,255,0.7); color: var(--white); }
.btn-dark {
  background: #1a1f1c;
  color: #f2f8f4;
  border: 1px solid #2f3833;
}
.btn-dark:hover { background: #0f1411; }
.btn-full  { width: 100%; }
.btn-lg    { padding: 13px 20px; font-size: 1rem; }
.btn-sm    { padding: 6px 12px; font-size: 0.8rem; min-height: 34px; }
.btn-row   { display: flex; gap: 10px; }
.icon-btn  {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: inherit;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(0,0,0,0.07); }

/* ── Login Page ─────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 18%, rgba(255, 241, 118, 0.26), transparent 30%),
    radial-gradient(circle at 86% 4%, rgba(255, 255, 255, 0.28), transparent 24%),
    linear-gradient(170deg, #0d4f19 0%, #1B5E20 48%, #2e7d32 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: stretch;
}

.login-phone {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-hero {
  padding: 38px 22px 24px;
  color: #f2fff0;
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.login-brand { text-align: left; width: 100%; }
.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin-bottom: 14px;
  padding: 8px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.login-logo img {
  max-width: 52px;
  max-height: 52px;
  width: auto;
  height: auto;
  display: block;
}
.login-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: #f6fff4;
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}
.login-subtitle {
  font-size: 0.9rem;
  color: rgba(237,255,235,0.88);
  margin-bottom: 8px;
}
.login-tagline {
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(240,255,238,0.75);
  max-width: 320px;
}

.login-panel {
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px 20px;
  box-shadow: 0 -14px 36px rgba(6, 30, 11, 0.33);
}

.login-panel-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.login-panel .form-input {
  border-radius: 12px;
  min-height: 46px;
}

.login-panel .btn {
  border-radius: 12px;
}

.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 16px;
}

@media (min-width: 720px) {
  .login-shell {
    place-items: center;
    padding: 28px 0;
  }
  .login-phone {
    width: min(430px, 96vw);
    min-height: 860px;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(5, 18, 10, 0.45);
    border: 1px solid rgba(255,255,255,0.25);
  }
  .login-panel {
    border-radius: 24px 24px 0 0;
    padding: 20px 22px 24px;
  }
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  margin-bottom: 14px;
  line-height: 1.4;
}
.alert-danger  { background: #FFEBEE; color: #B71C1C; border-left: 3px solid var(--danger); }
.alert-success { background: #E8F5E9; color: var(--primary-dark); border-left: 3px solid var(--success); }
.alert-warning { background: #FFF8E1; color: #E65100; border-left: 3px solid var(--accent); }
.alert-info    { background: #E3F2FD; color: var(--info); border-left: 3px solid var(--info); }

/* ── Overlays (Bottom Sheet) ────────────────────────────────── */
.overlay {
  position: fixed;
  top: var(--top-bar-h);
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-h);
  z-index: 1999;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.overlay.open {
  opacity: 1;
  pointer-events: all;
}
.overlay-sheet {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  transform: translateY(50px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}
.overlay.open .overlay-sheet { transform: translateY(0); }
.overlay-form { max-height: 94vh; }
.overlay-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.overlay-header {
  display: flex;
  align-items: center;
  padding: 10px 16px 8px;
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.overlay-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}
.overlay-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.overlay-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.overlay-footer .btn {
  flex: 1;
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  font-weight: 600;
  padding: 10px 12px;
  font-size: 0.9rem;
  min-height: 44px;
}

.bill-actions {
  width: 100%;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.bill-actions .btn {
  flex: 1;
  min-width: 80px;
  font-size: 0.85rem;
  padding: 10px 12px;
  min-height: 44px;
}

/* ── Profile Search List ────────────────────────────────────── */
.search-box-wrapper {
  margin-bottom: 8px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-box-wrapper::before {
  content: '';
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}
.search-input {
  border-radius: 24px;
  padding-left: 40px;
  flex: 1;
}
body.theme-dark .search-box-wrapper::before {
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
}
.profile-list { margin-top: 6px; }
.profile-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.profile-list-item:hover, .profile-list-item:active { background: var(--bg); }
.profile-avatar-sm {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-info-name   { font-weight: 600; font-size: 0.9rem; }
.profile-info-mobile { font-size: 0.78rem; color: var(--text-secondary); }
.list-empty { text-align: center; color: var(--text-light); padding: 20px; font-size: 0.87rem; }

/* ── Selected Profile Card ──────────────────────────────────── */
.selected-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.profile-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.profile-name   { font-weight: 600; font-size: 0.95rem; }
.profile-mobile { font-size: 0.78rem; color: var(--text-secondary); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-buy, .badge-farmer          { background: #E3F2FD; color: #1565C0; }
.badge-sell, .badge-business_person{ background: #E8F5E9; color: var(--primary); }
.badge-full                        { background: #E8F5E9; color: var(--success); }
.badge-partial                     { background: #FFF8E1; color: var(--warning); }
.badge-pay_later                   { background: #FFEBEE; color: var(--danger); }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2001;
  display: none;
}
.modal-backdrop.open { display: block; }
.modal {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 2002;
  max-height: 85vh;
  overflow-y: auto;
  transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}
.modal.open { bottom: 0; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 16px; }

/* ── History List ───────────────────────────────────────────── */
.tx-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.tx-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tx-name   { font-weight: 600; font-size: 0.9rem; }
.tx-amount { font-weight: 700; font-size: 0.95rem; }
.tx-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.tx-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-tx-action {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  min-height: 30px;
}
.btn-tx-action.danger { border-color: #FFCDD2; color: var(--danger); }
.btn-tx-action.primary { border-color: #BBDEFB; color: #1565C0; }

/* ── Expense List ───────────────────────────────────────────── */
.exp-item {
  background: var(--white);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.exp-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.exp-category { font-weight: 600; font-size: 0.87rem; }
.exp-amount   { font-weight: 700; color: var(--danger); }
.exp-meta     { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 8px; }
.exp-actions  { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Filter / Chips ─────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.filter-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 34px;
}
.chip-active, .chip.chip-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.filter-date-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.filter-date-group .form-label { margin-bottom: 0; }

/* ── Skeleton Loader ────────────────────────────────────────── */
.skeleton-list { padding: 4px 0; }
.skeleton-item {
  height: 72px;
  background: linear-gradient(90deg, #F0F0F0 25%, #E8E8E8 37%, #F0F0F0 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius);
  margin-bottom: 8px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-icon { font-size: 3rem; margin-bottom: 10px; }
.empty-icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.8;
}
.empty-state p { font-size: 0.9rem; }

/* ── Account / Profile Page ─────────────────────────────────── */
.account-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.account-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid rgba(27, 94, 32, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.account-avatar svg {
  width: 28px;
  height: 28px;
  stroke: var(--primary);
  stroke-width: 1.9;
}
.account-avatar img.avatar-photo {
  width: 60px; height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

/* ── Admin / Profile Photo Upload ───────────────────────────── */
.photo-change-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--primary);
  cursor: pointer;
  line-height: 1;
  margin-top: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.photo-change-btn svg { flex-shrink: 0; }
.photo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.photo-thumb {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.7rem;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.photo-pick-btn { border-radius: 20px !important; }

/* ── Profile avatar with photo ──────────────────────────────── */
.profile-avatar-sm img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.account-name { font-weight: 700; font-size: 1.05rem; }
.account-sub  { font-size: 0.8rem; color: var(--text-secondary); }

.list-actions { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.list-action-item, .list-action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.list-action-item:last-child, .list-action-btn:last-child { border-bottom: none; }
.list-action-item:hover, .list-action-btn:hover { background: var(--bg); }
.list-action-danger { color: var(--danger); }

.settings-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}
.language-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.lang-pill {
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 68px;
}
.lang-pill.active {
  background: var(--primary);
  color: var(--white);
}
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}
.switch input { display: none; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #c5d1ca;
  border-radius: 999px;
  transition: all 0.2s ease;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-slider {
  background: var(--primary);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* Profile management list */
.profile-manage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}
.profile-manage-info { flex: 1; min-width: 0; }
.profile-manage-name   { font-weight: 600; font-size: 0.88rem; }
.profile-manage-mobile { font-size: 0.75rem; color: var(--text-secondary); }
.profile-manage-actions { display: flex; gap: 4px; }

/* ── Charts ─────────────────────────────────────────────────── */
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.chart-wrapper     { position: relative; height: 220px; }
.chart-wrapper-sm  { position: relative; height: 180px; max-width: 280px; margin: 0 auto; }

/* ── Bill Preview ───────────────────────────────────────────── */
.bill-preview { background: #FFFDE7; border-radius: var(--radius-sm); overflow: hidden; }
.bill-sheet { padding: 20px; max-width: 380px; margin: 0 auto; }
.bill-header { text-align: center; margin-bottom: 12px; }
.bill-logo {
  margin-bottom: 4px;
}
.bill-logo svg {
  width: 34px;
  height: 34px;
  color: var(--primary);
}
.bill-company { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.bill-tagline { font-size: 0.78rem; color: var(--text-secondary); }
.bill-divider { border: none; border-top: 1px dashed var(--border); margin: 10px 0; }
.bill-meta    { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.bill-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.bill-party { margin-bottom: 4px; }
.bill-section-title { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.bill-party-name    { font-weight: 700; font-size: 1rem; }
.bill-party-mobile  { font-size: 0.82rem; color: var(--text-secondary); }
.bill-table  { width: 100%; border-collapse: collapse; font-size: 0.83rem; margin-bottom: 8px; }
.bill-table td { padding: 4px 0; color: var(--text); }
.bill-table .text-right { text-align: right; }
.bill-net-row { background: #F9FBE7; }
.bill-net-row td { padding: 6px 4px; color: var(--primary); }
.bill-total-box {
  display: flex;
  justify-content: space-between;
  background: var(--primary);
  color: var(--white);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
}
.bill-due-row td { color: var(--danger); font-weight: 600; }
.text-danger { color: var(--danger); }
.bill-notes  { font-size: 0.82rem; color: var(--text-secondary); }
.bill-footer { text-align: center; font-size: 0.78rem; color: var(--text-secondary); padding-top: 4px; }
.bill-actions {
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.bill-actions .btn { flex: 1; min-width: 90px; font-size: 0.82rem; padding: 8px 12px; }

/* ── Toast Notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px);
  left: 16px; right: 16px;
  background: #323232;
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.87rem;
  text-align: center;
  z-index: 500;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  max-width: 480px;
  margin: 0 auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: var(--primary); }
.toast.toast-error   { background: var(--danger); }

/* ── Loading Screen ────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: var(--top-bar-h);
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-h);
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
}
.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Circular ring spinner animation */
.spinner-ring {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(27, 94, 32, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  animation: spin-ring 1s linear infinite;
}

@keyframes spin-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
}
body.theme-dark .loading-overlay {
  background: rgba(6,10,8,0.42);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ──────────────────────────────────────────────── */
.flex-1   { flex: 1; }
.mt-1     { margin-top: 8px; }
.mt-2     { margin-top: 12px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.setup-steps { margin-top: 8px; }
.setup-steps p { margin-bottom: 8px; font-size: 0.87rem; color: var(--text-secondary); }
.setup-steps code { background: #F5F5F5; padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.82rem; }
.help-text {
  margin-bottom: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-secondary);
}
.help-text:last-child { margin-bottom: 0; }

.icon-inline {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-right: 6px;
  stroke-width: 2;
}

/* ── Tablet / Desktop Enhancements ─────────────────────────── */
@media (min-width: 600px) {
  .page-content { max-width: 600px; margin: 0 auto; }
  .bottom-nav   { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-lg) var(--radius-lg) 0 0; border: 1px solid var(--border); border-bottom: none; }
  .app-bar-inner { max-width: 600px; margin: 0 auto; }

  .overlay-sheet, .modal {
    max-width: 520px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    border-radius: var(--radius-lg);
    bottom: auto;
    top: 50%;
    margin-top: -5vh;
  }
  .overlay.open .overlay-sheet { transform: translateX(-50%) translateY(0); }
  .modal.open { bottom: auto; transform: translateX(-50%) translateY(-50%); top: 50%; }
  .modal { transform: translateX(-50%) translateY(-40%); }
  .modal-backdrop.open .modal { bottom: auto; }
}

/* ── Print styles (for bill printing) ──────────────────────── */
@media print {
  .app-bar, .bottom-nav, .bill-actions,
  .toast, .loading-overlay,
  .overlay:not(#overlayBill),
  .modal { display: none !important; }
  .page-content { padding: 0; }
  .bill-sheet { max-width: 100%; }
  body { background: white; }
}
