/* Mobile-First Sub-Meter & Rent Billing Management System */
/* Professional UI/UX Design System - Al-Rashed Complex MS */

* {
  -webkit-tap-highlight-color: transparent;
}

button, a, input, select, textarea, .btn, .sidebar-link, .nav-tabs a {
  touch-action: manipulation;
}

:root {
  /* Brand & Core Accents */
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-active: #1e3a8a;
  --primary-light: #eff6ff;
  --primary-focus: rgba(37, 99, 235, 0.18);
  --primary-gradient: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  
  --secondary: #0f172a;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #3b82f6;
  
  /* Semantic Status Colors */
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-dark: #047857;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-dark: #b45309;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-dark: #b91c1c;
  --danger-border: #fecaca;

  /* Feature-specific Streams */
  --meter-color: #0284c7;
  --meter-bg: #f0f9ff;
  --meter-border: #bae6fd;
  --rent-color: #ea580c;
  --rent-bg: #fff7ed;
  --rent-border: #fed7aa;
  
  /* Modern Layered Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 20px -4px rgba(15, 23, 42, 0.09), 0 4px 8px -3px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  
  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Nav & Heights */
  --nav-height: 64px;
  --header-height: 58px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* BASE RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--nav-height) + 20px);
  letter-spacing: -0.01em;
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
    font-size: 14.5px;
  }
}

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

button, input, select, textarea {
  font-family: inherit;
}

/* NUMERICAL & DATA ALIGNMENT HELPERS */
.tabular-nums, 
.stat-value, 
.due-box-val, 
.due-col-val, 
.app-table td.text-right, 
.invoice-table td.text-right,
.calc-row span:last-child,
.invoice-grand-total {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum', 'cv02', 'cv03', 'cv04', 'cv11';
}

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.font-mono-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.font-extrabold { font-weight: 800 !important; }

.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: #15803d !important; }
.text-danger { color: #b91c1c !important; }
.text-warning { color: #b45309 !important; }
.text-rent { color: var(--rent-color) !important; }
.text-meter { color: var(--meter-color) !important; }

/* APP SHELL LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.desktop-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    background: #0f172a;
    color: #ffffff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  .main-content-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
}

.main-content-wrapper {
  width: 100%;
  max-width: 1200px;
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 1024px) {
  .main-content-wrapper {
    margin-left: 260px;
    max-width: calc(100% - 260px);
  }
}

/* APP HEADER */
.app-header {
  height: var(--header-height);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.header-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

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

.header-btn {
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-body);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}

.header-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
}

/* SIDEBAR STYLES (Desktop) */
.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header .logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.sidebar-header p {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.sidebar-link i {
  width: 20px;
  font-size: 15px;
  text-align: center;
  color: #64748b;
  transition: var(--transition);
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.sidebar-link:hover i {
  color: #93c5fd;
}

.sidebar-link.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
}

.sidebar-link.active i {
  color: #ffffff;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* MOBILE BOTTOM NAVIGATION */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  padding: 0 4px;
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  flex: 1;
  height: 100%;
  gap: 3px;
  transition: var(--transition);
}

.bottom-nav-item i {
  font-size: 17px;
  transition: transform 0.15s ease;
}

.bottom-nav-item:active i {
  transform: scale(0.9);
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.bottom-nav-item.nav-btn-highlight {
  position: relative;
}

.nav-btn-highlight .highlight-circle {
  width: 46px;
  height: 46px;
  background: var(--primary-gradient);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -18px;
  box-shadow: 0 6px 14px rgba(30, 64, 175, 0.4);
  font-size: 19px;
  border: 3px solid #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-btn-highlight:active .highlight-circle {
  transform: scale(0.93);
}

.nav-btn-highlight span {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

/* MAIN CONTENT CONTAINER */
.page-content {
  padding: 16px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 1024px) {
  .page-content {
    padding: 24px 32px;
  }
}

/* PAGE HEADER */
.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* METRIC / KPI STATS CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #059669; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* OVERVIEW BANNER CARDS */
.due-summary-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px -5px rgba(30, 64, 175, 0.35), 0 8px 10px -6px rgba(30, 64, 175, 0.2);
  margin-bottom: 18px;
  position: relative;
  text-align: center;
  overflow: hidden;
}

.due-summary-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.due-summary-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bfdbfe;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 6px;
}

.due-summary-total {
  font-size: 34px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.due-breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

.due-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.due-summary-card .due-box {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.due-box.rent {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.due-summary-card .due-box.rent {
  background: rgba(234, 88, 12, 0.2);
  border-color: rgba(254, 215, 170, 0.4);
}

.due-box.meter {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.due-summary-card .due-box.meter {
  background: rgba(2, 132, 199, 0.2);
  border-color: rgba(186, 230, 253, 0.4);
}

.due-box-label {
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.due-box.rent .due-box-label { color: #c2410c; }
.due-summary-card .due-box.rent .due-box-label { color: #fed7aa; }

.due-box.meter .due-box-label { color: #0369a1; }
.due-summary-card .due-box.meter .due-box-label { color: #bae6fd; }

.due-box-val {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.due-box.rent .due-box-val { color: #ea580c; }
.due-summary-card .due-box.rent .due-box-val { color: #ffffff; }

.due-box.meter .due-box-val { color: #0284c7; }
.due-summary-card .due-box.meter .due-box-val { color: #ffffff; }

/* CUSTOMER LIST ITEMS (Mobile Card) */
.customer-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.customer-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.customer-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.customer-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.customer-meter-badge {
  font-size: 11px;
  background: #f1f5f9;
  color: #334155;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.customer-phone {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-weight: 500;
}

.customer-due-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 6px;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 10px 0;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.due-col-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.due-col-val {
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 2px;
}

.due-col-val.rent { color: #ea580c; }
.due-col-val.meter { color: #0284c7; }
.due-col-val.total { color: #b91c1c; font-weight: 800; }

.customer-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  min-height: 40px;
  line-height: 1;
  white-space: nowrap;
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 30px;
  border-radius: var(--radius-xs);
  gap: 4px;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 15px;
  min-height: 46px;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: white;
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.3);
}

.btn-success {
  background: #15803d;
  color: white;
}

.btn-success:hover {
  background: #166534;
  color: white;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
  color: white;
}

.btn-outline {
  background: white;
  border-color: var(--border);
  color: var(--text-body);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-main);
}

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

.btn-outline-primary:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.btn-meter {
  background: #0284c7;
  color: white;
}

.btn-meter:hover {
  background: #0369a1;
  color: white;
}

.btn-rent {
  background: #ea580c;
  color: white;
}

.btn-rent:hover {
  background: #c2410c;
  color: white;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.badge-paid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-due {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-partial {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-cancelled {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-meter {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-rent {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* FORMS & INPUTS */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
  gap: 4px;
}

.form-label .req {
  color: var(--danger);
  font-weight: 700;
}

.form-control, .form-select {
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

textarea.form-control {
  height: auto;
  min-height: 75px;
  padding: 10px 12px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* LIVE CALCULATION BOX */
.calc-breakdown-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.calc-breakdown-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
  color: #334155;
}

.calc-row.highlight {
  font-weight: 700;
  color: #0f172a;
}

.calc-row.total {
  border-top: 1.5px solid #86efac;
  margin-top: 8px;
  padding-top: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #15803d;
}

/* TABS */
.nav-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-item {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: var(--transition);
}

.nav-tab-item:hover {
  color: var(--primary);
}

.nav-tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* TABLES & ALIGNMENT */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  box-shadow: var(--shadow-xs);
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  background: white;
}

.app-table th {
  background: #f8fafc;
  padding: 9px 12px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.app-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  vertical-align: middle;
}

.app-table tr:last-child td {
  border-bottom: none;
}

.app-table tbody tr:hover {
  background-color: #f8fafc;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  box-shadow: var(--shadow-xl);
}

@media (min-width: 640px) {
  .modal-dialog {
    border-radius: var(--radius-md);
    transform: translateY(20px);
  }
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text-main);
}

/* PRINT & INVOICE FORMATTING */
.invoice-wrapper {
  background: white;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.invoice-header {
  text-align: center;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.invoice-property-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.invoice-badge-title {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.invoice-table th {
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 11.5px;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
}

.invoice-table td {
  padding: 8px 10px;
  font-size: 12.5px;
  border: 1px solid #e2e8f0;
}

.invoice-total-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: right;
  margin-top: 12px;
}

.invoice-grand-total {
  font-size: 19px;
  font-weight: 800;
  color: var(--primary);
}

/* THERMAL PRINT (80mm) STYLES */
@media print {
  body {
    background: white;
    padding: 0;
    color: black;
  }

  .desktop-sidebar,
  .app-header,
  .bottom-nav,
  .no-print {
    display: none !important;
  }

  .main-content-wrapper {
    margin: 0 !important;
    max-width: 100% !important;
  }

  .page-content {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .invoice-wrapper {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .thermal-receipt {
    width: 80mm;
    margin: 0 auto;
    font-size: 12px;
    font-family: monospace, sans-serif;
  }
}

/* ALERTS & FLASH MESSAGES */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.alert-success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: var(--success-dark);
}

.alert-danger {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger-dark);
}

/* PWA INSTALL BANNER */
.pwa-banner {
  background: var(--primary-gradient);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ============================================================= */
/* PROFESSIONAL PAYMENT SUCCESS ANIMATIONS & HERO CARD           */
/* ============================================================= */
.payment-success-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 28px 20px 24px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.15), 0 8px 10px -6px rgba(16, 185, 129, 0.1);
  animation: cardFadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-animation-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* Ripple waves behind checkmark */
.success-ripple {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.25);
  animation: rippleGlow 2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
  z-index: 1;
}

.success-ripple:nth-child(2) {
  animation-delay: 0.6s;
}

/* Checkmark SVG Animation */
.success-checkmark-svg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: block;
  stroke-width: 3.5;
  stroke: #ffffff;
  stroke-miterlimit: 10;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  position: relative;
  z-index: 2;
  animation: checkmarkScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s both;
}

.success-checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3.5;
  stroke-miterlimit: 10;
  stroke: #10b981;
  fill: #10b981;
  animation: strokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke: #ffffff;
  animation: strokeCheck 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.45s forwards;
}

/* Amount Pill Badge */
.success-amount-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  margin-top: 10px;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
  animation: badgePop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s both;
}

.success-amount-badge::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shimmerGlow 2.5s infinite 1s;
}

/* Success Header text */
.success-title {
  font-size: 20px;
  font-weight: 800;
  color: #065f46;
  letter-spacing: -0.02em;
  margin-top: 4px;
  animation: textSlideUp 0.4s ease 0.3s both;
}

.success-subtitle {
  font-size: 13.5px;
  color: #047857;
  font-weight: 500;
  margin-top: 2px;
  animation: textSlideUp 0.4s ease 0.4s both;
}

/* Confetti canvas overlay */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
}

/* Action Button glowing pulse on 1-click print */
.btn-print-pulse {
  position: relative;
  overflow: hidden;
  animation: pulseButton 2s infinite;
}

/* Keyframes */
@keyframes cardFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes strokeCircle {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes strokeCheck {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes checkmarkScale {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes rippleGlow {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes badgePop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes textSlideUp {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmerGlow {
  0% {
    left: -100%;
  }
  100% {
    left: 200%;
  }
}

@keyframes pulseButton {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.35);
  }
  50% {
    box-shadow: 0 4px 20px rgba(21, 128, 61, 0.65);
  }
}
