/* SiteFlow Stylesheet */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --emerald: #10b981;
  --emerald-bg: #ecfdf5;
  --amber: #f59e0b;
  --amber-bg: #fffbeb;
  --rose: #ef4444;
  --rose-bg: #fef2f2;
  --indigo: #6366f1;
  --blue: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
}

/* App Containers */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.25);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

.login-brand h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}

.login-brand p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-quick-hints {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  text-align: center;
}

.login-quick-hints small {
  color: var(--text-muted);
  font-size: 11px;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

.quick-tags span {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.quick-tags span:hover {
  background: var(--primary);
  color: #fff;
}

/* Main Layout */
.main-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Top Nav */
.top-nav {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 20;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.user-pill {
  background: #f1f5f9;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.desktop-nav-links {
  display: none;
}

@media (min-width: 900px) {
  .desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px;
  }
}

.top-nav-link {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.top-nav-link:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.top-nav-link.active {
  color: var(--primary);
  background: #eff6ff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 15px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .top-nav {
    padding: 0 10px;
    height: 52px;
  }
  .app-logo {
    font-size: 15px;
  }
  .user-pill {
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    padding: 2px 6px;
  }
  .hide-mobile {
    display: none !important;
  }
  .nav-right {
    gap: 4px;
  }
  #btn-new-site-top {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* Mobile Upper Navigation Strip (Horizontal Scrollable Tabs) */
.mobile-sub-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  z-index: 15;
}

.mobile-sub-nav::-webkit-scrollbar {
  display: none;
}

.sub-nav-link {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.sub-nav-link.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

@media (min-width: 900px) {
  .mobile-sub-nav {
    display: none !important;
  }
}

/* Bottom Nav (Mobile Only - Fixed Permanently at screen bottom) */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 56px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 99999 !important;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

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

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
}

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

.nav-icon {
  font-size: 18px;
}

.btn-nav-center {
  position: relative;
  top: -12px;
  background: var(--primary);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37,99,235,0.4);
}

.nav-icon-plus {
  font-size: 26px;
  line-height: 1;
  color: #fff;
}

/* Content Area */
.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 85px; /* Ensures content is never covered by bottom nav */
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .content-scroll {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
    padding-bottom: 30px;
  }
}

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

@media (min-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
  }

  /* 6 Site KPI cards in 1 row (Image 2) */
  .kpi-grid.site-kpi-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }

  .kpi-grid.site-kpi-grid .kpi-card {
    padding: 10px 8px;
    gap: 8px;
    min-width: 0;
  }

  .kpi-grid.site-kpi-grid .kpi-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: var(--radius-sm);
  }

  .kpi-grid.site-kpi-grid .kpi-info {
    min-width: 0;
    overflow: hidden;
  }

  .kpi-grid.site-kpi-grid .kpi-label {
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kpi-grid.site-kpi-grid .kpi-val {
    font-size: 19px;
  }

  .kpi-grid.site-kpi-grid .kpi-sub {
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bg-indigo { background: #e0e7ff; color: #4338ca; }
.bg-emerald { background: #d1fae5; color: #047857; }
.bg-amber { background: #fef3c7; color: #b45309; }
.bg-blue { background: #dbeafe; color: #1d4ed8; }
.bg-rose { background: #ffe4e6; color: #e11d48; }
.text-rose { color: #e11d48 !important; }
.text-rose-light { color: #fda4af !important; }

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  margin: 2px 0;
}

.kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.text-emerald { color: #059669; }
.text-amber { color: #d97706; }
.text-blue { color: #2563eb; }

/* Financial Banner */
.financial-banner {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.fin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fin-title-row span {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.fin-three-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.fin-three-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.fin-three-box small {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
}

.fin-three-box strong {
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
}

.fin-three-box.highlight {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.text-emerald-light { color: #34d399 !important; }
.text-amber-light { color: #fbbf24 !important; }

.fin-splits {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fin-pill {
  flex: 1;
  min-width: 140px;
  background: rgba(255,255,255,0.06);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.fin-pill small {
  color: #94a3b8;
  font-size: 11px;
}

.fin-pill b {
  font-size: 15px;
  color: #f8fafc;
}

.finish-pending-pill {
  background: rgba(244, 63, 94, 0.18) !important;
  border: 1px solid rgba(244, 63, 94, 0.4) !important;
  transition: transform 0.15s ease, background 0.15s ease;
}

.finish-pending-pill:hover {
  background: rgba(244, 63, 94, 0.3) !important;
  transform: translateY(-1px);
}

/* Dashboard Side-by-Side: Complaints Pulse & Running Financials (Image 3) */
.dashboard-side-by-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

@media (min-width: 1024px) {
  .dashboard-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 14px;
    align-items: stretch;
  }
}

.side-panel {
  display: flex;
  flex-direction: column;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.side-panel-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.complaints-pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  flex: 1;
}

.complaints-pulse-grid .pulse-card {
  padding: 8px 10px;
  gap: 8px;
  margin-bottom: 0;
  border-radius: var(--radius-md);
  min-width: 0;
}

.complaints-pulse-grid .kpi-icon {
  width: 32px;
  height: 32px;
  font-size: 15px;
}

.complaints-pulse-grid .kpi-info {
  min-width: 0;
  overflow: hidden;
}

.complaints-pulse-grid .kpi-label {
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.complaints-pulse-grid .kpi-val {
  font-size: 18px;
  margin: 1px 0;
}

.complaints-pulse-grid .kpi-sub {
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-fin-banner {
  margin-bottom: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px !important;
}

.side-fin-banner .fin-title-row {
  margin-bottom: 6px;
}

.side-fin-banner .fin-three-grid {
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.side-fin-banner .fin-three-box {
  padding: 6px 10px;
}

.side-fin-banner .fin-three-box small {
  font-size: 10px;
}

.side-fin-banner .fin-three-box strong {
  font-size: 16px;
}

.side-fin-banner .fin-splits {
  gap: 8px;
}

.side-fin-banner .fin-pill {
  min-width: 90px;
  padding: 6px 8px;
}

.side-fin-banner .fin-pill small {
  font-size: 9.5px;
}

.side-fin-banner .fin-pill b {
  font-size: 13px;
}

/* Search & Filters */
.search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .search-filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 14px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Sites List & Cards */
.sites-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.site-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.site-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.site-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.site-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.site-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.site-actions-quick {
  display: flex;
  gap: 6px;
}

.btn-wa-icon {
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
}

.site-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 10px 0;
}

.site-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #334155;
  margin-bottom: 12px;
}

.site-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.site-bottom-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.site-bottom-box {
  display: flex;
  flex-direction: column;
}

.site-bottom-box small {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.site-bottom-box b {
  font-size: 13px;
  font-weight: 700;
}

.balance-pill {
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: 12px;
}

.balance-pill.pending {
  background: #fef2f2;
  color: #dc2626;
}

.balance-pill.clear {
  background: #ecfdf5;
  color: #059669;
}

/* Badges */
.badge-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-status.ACTIVE { background: #d1fae5; color: #047857; }
.badge-status.INACTIVE { background: #fef3c7; color: #b45309; }
.badge-status.COMPLETED { background: #dbeafe; color: #1d4ed8; }
.badge-status.COMPLETED_PENDING { background: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.badge-status.COMPLETED_CLEAR { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.badge-status.clickable {
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-status.clickable:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* Compact Site Card (Image 2 Redesign) */
.site-card-compact {
  padding: 10px 14px !important;
  gap: 8px !important;
}

.site-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.site-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.site-top-right {
  flex-shrink: 0;
}

.site-loc-pill {
  font-size: 11.5px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
}

.site-phone-pill {
  font-size: 11.5px;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 7px;
  border-radius: 4px;
}

.btn-call-sm {
  background: #3b82f6 !important;
  padding: 2px 6px !important;
  font-size: 11px !important;
}

.btn-wa-sm {
  background: #25D366 !important;
  padding: 2px 6px !important;
  font-size: 11px !important;
}

.site-card-ops-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 8px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 11px;
}

.site-ops-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-ops-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #64748b;
}

.quick-stage-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quick-stage-select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 175px;
}

.quick-stage-select:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}

.quick-stage-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.site-mistry-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #0369a1;
  font-weight: 600;
  background: #e0f2fe;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #bae6fd;
}

.site-mistry-badge.clickable {
  cursor: pointer;
  transition: all 0.15s ease;
}

.site-mistry-badge.clickable:hover {
  background: #bae6fd;
  border-color: #7dd3fc;
}

.site-mistry-badge.muted {
  background: #fffbeb;
  border: 1px dashed #fde68a;
  color: #b45309;
  padding: 3px 8px;
}

.site-mistry-badge.muted.clickable {
  cursor: pointer;
  transition: all 0.15s ease;
}

.site-mistry-badge.muted.clickable:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.mistry-call-link {
  color: #0284c7;
  text-decoration: none;
  font-weight: 700;
}

.mistry-remark-pill {
  color: #475569;
  font-style: italic;
  font-size: 10.5px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-warranty {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge-warranty.active { background: #d1fae5; color: #047857; }
.badge-warranty.expired { background: #f1f5f9; color: #64748b; }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  overflow: hidden;
  position: relative;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 860px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
  z-index: 10;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: #ffffff;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* Site Detail Specifics */
.site-detail-head h2 {
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}

.detail-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-site-num {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.status-action-bar {
  background: #f1f5f9;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.status-action-bar label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.site-fin-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

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

.sfin-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.sfin-box small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.sfin-box strong {
  font-size: 17px;
  font-weight: 800;
  margin-top: 2px;
}

.sub-progress {
  font-size: 10px;
  color: var(--text-muted);
}

.text-bill { color: #2563eb; }
.text-cash { color: #d97706; }

/* Detail Tabs */
.detail-tabs {
  display: flex;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.dtab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.dtab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.detail-tab-content {
  overflow-y: auto;
  flex: 1;
  padding: 16px;
}

.dtab-pane {
  display: none;
}

.dtab-pane.active {
  display: block;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pane-header h4 {
  font-size: 15px;
  font-weight: 700;
}

/* Stage Stepper */
.stage-stepper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: all 0.15s;
}

.stage-item.done {
  background: var(--emerald-bg);
  border-color: #a7f3d0;
}

.stage-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.stage-item.done .stage-num {
  background: var(--emerald);
  color: #fff;
}

.stage-info strong {
  font-size: 14px;
  display: block;
}

.stage-info small {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-stage-toggle {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.stage-item.done .btn-stage-toggle {
  background: #059669;
  color: #fff;
  border-color: #059669;
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.form-group.col {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 6px;
    align-items: flex-end;
  }
  .modal-card {
    max-height: 94dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .modal-body {
    padding: 14px;
    padding-bottom: 24px;
  }
  .modal-footer {
    padding: 12px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  .form-group input[type="date"] {
    min-height: 42px;
    font-size: 14px;
    width: 100%;
  }
}

.form-card-highlight {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.form-card-highlight h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.total-calc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 14px;
}

.total-calc-banner strong {
  font-size: 18px;
  color: var(--primary);
}

.inline-form-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.inline-form-card h5 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-main);
}

.btn-success {
  background: #10b981;
  color: #fff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.btn-danger-icon {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

/* History lists */
.payments-history-list,
.addons-list,
.vendors-list,
.complaints-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hist-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hist-left {
  display: flex;
  flex-direction: column;
}

.hist-left strong {
  font-size: 14px;
}

.hist-left small {
  font-size: 11px;
  color: var(--text-muted);
}

.hist-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hist-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.hist-badge.BILL { background: #dbeafe; color: #1d4ed8; }
.hist-badge.CASH { background: #fef3c7; color: #b45309; }

/* Notes Timeline */
.add-note-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.add-note-box textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 13px;
  outline: none;
  min-height: 60px;
}

.notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-bubble {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 10px 14px;
  font-size: 13px;
}

.note-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Warranty Status Card */
.warranty-status-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.wbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* Reports Period Bar */
.report-period-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.period-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.period-control-group label {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.period-control-group select {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  background: #fff;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.period-control-group select:focus {
  border-color: var(--primary);
}

.report-custom-dates {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
}

.report-custom-dates input[type="date"] {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  outline: none;
  background: #fff;
}

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

/* 5 Valuation Summary Cards (All-time & Period Business Pillars) */
.report-valuation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

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

@media (min-width: 1024px) {
  .report-valuation-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }
}

.val-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.val-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.val-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.val-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.val-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.val-amount {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin: 2px 0;
}

.val-sub {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.val-active {
  border-left: 4px solid #10b981;
}
.val-badge-active {
  background: #d1fae5;
  color: #065f46;
}

.val-inactive {
  border-left: 4px solid #f59e0b;
}
.val-badge-inactive {
  background: #fef3c7;
  color: #92400e;
}

.val-due {
  border-left: 4px solid #f43f5e;
}
.val-badge-due {
  background: #ffe4e6;
  color: #be123c;
}

.val-clear {
  border-left: 4px solid #059669;
}
.val-badge-clear {
  background: #d1fae5;
  color: #047857;
}

.val-grand {
  border-left: 4px solid #4f46e5;
  background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}
.val-badge-grand {
  background: #e0e7ff;
  color: #3730a3;
}

/* Reports */
.salesperson-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.sp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.sp-card small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.sp-card strong {
  font-size: 18px;
  display: block;
  margin: 2px 0;
  color: var(--primary);
}

.report-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.report-table-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.table-responsive {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.report-table th {
  background: #f8fafc;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Official Letterhead Styles for PDFs & Printouts */
.letterhead-header {
  text-align: center;
  border-bottom: 2px solid #002060;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.letterhead-header img {
  height: 52px;
  max-width: 280px;
  object-fit: contain;
}

.letterhead-title {
  font-size: 15px;
  font-weight: 800;
  color: #002060;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 6px;
}

.letterhead-footer {
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1.5px solid #002060;
  text-align: center;
  font-family: inherit;
}

.letterhead-footer-company {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.letterhead-footer-addr {
  font-size: 10.5px;
  color: #334155;
  margin-top: 3px;
  font-weight: 500;
}

.letterhead-footer-reg {
  font-size: 9.5px;
  color: #002060;
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Printable Ledger */
.printable-ledger {
  background: #fff;
  padding: 24px;
}

.ledger-head {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ledger-company h2 {
  font-size: 20px;
  font-weight: 800;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 20px;
}

.ledger-table th,
.ledger-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
  text-align: left;
}

.ledger-table th {
  background: #f1f5f9;
  font-weight: 700;
}

.ledger-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 12px;
  border-radius: var(--radius-sm);
}

/* Print Rules */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-site-ledger,
  #modal-site-ledger *,
  #modal-period-report,
  #modal-period-report *,
  #modal-delivery-challan,
  #modal-delivery-challan * {
    visibility: visible;
  }
  #modal-site-ledger,
  #modal-period-report,
  #modal-delivery-challan {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: #fff;
    padding: 0;
  }
  .modal-card {
    box-shadow: none;
    max-width: 100%;
    border: none;
  }
  .modal-header,
  .ledger-actions,
  .no-print {
    display: none !important;
  }
}

/* Attachments Grid */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.attachment-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.attach-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #e2e8f0;
  cursor: pointer;
}

.attach-pdf-icon {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: #f1f5f9;
  cursor: pointer;
}

.attach-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}

.attach-name {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

/* Due Date Alert Badges */
.badge-due-alert {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-due-alert.overdue {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.badge-due-alert.soon {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.badge-due-alert.today {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.badge-due-alert.normal {
  background: #f1f5f9;
  color: var(--text-muted);
}

.btn-reminder-sm {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  font-weight: 700;
}
.btn-reminder-sm:hover {
  background: #fde68a;
  color: #92400e;
}

/* ================= VENDOR LENA / DENA & INSTALLMENTS ================= */
.vendor-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.vkpi-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.vkpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.vkpi-card.vkpi-payable {
  border-left: 5px solid #ef4444;
  background: linear-gradient(135deg, #fff 0%, #fff1f2 100%);
}

.vkpi-card.vkpi-receivable {
  border-left: 5px solid #10b981;
  background: linear-gradient(135deg, #fff 0%, #f0fdf4 100%);
}

.vkpi-icon {
  font-size: 32px;
  line-height: 1;
}

.vkpi-info {
  display: flex;
  flex-direction: column;
}

.vkpi-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.vkpi-amount {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

.vkpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Complaints Master View Top KPI Grid (Image 1 - Single Line Row) */
.complaints-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 900px) {
  .complaints-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.complaints-kpi-grid .vkpi-card {
  padding: 12px 14px;
  gap: 12px;
  min-width: 0;
}

.complaints-kpi-grid .vkpi-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.complaints-kpi-grid .vkpi-info {
  min-width: 0;
  overflow: hidden;
}

.complaints-kpi-grid .vkpi-label {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.complaints-kpi-grid .vkpi-amount {
  font-size: 21px;
}

.complaints-kpi-grid .vkpi-sub {
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Vendor Cards in Master & Site Detail */
.vendor-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.vendor-card.payable {
  border-left: 4px solid #ef4444;
}

.vendor-card.receivable {
  border-left: 4px solid #10b981;
}

.vendor-card.settled {
  border-left: 4px solid #64748b;
  opacity: 0.9;
  background: #f8fafc;
}

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

.vcard-title h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vcard-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.direction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.direction-badge.payable {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.direction-badge.receivable {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-badge.settled {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.vcard-fin-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.vfin-col small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.vfin-col strong {
  font-size: 15px;
  font-weight: 700;
}

.vcard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.installment-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 10px;
}

.installment-table th,
.installment-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.installment-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text-muted);
}

/* Danger Zone Reset Modal */
.danger-zone {
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* Quick Actions & Shortcut Buttons */
.site-bottom-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-quick-pay {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-quick-pay:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

.btn-quick-ledger {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-quick-ledger:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

/* Mobile responsive for site card bottom */
@media (max-width: 640px) {
  .site-card-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .site-bottom-metrics {
    width: 100%;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .site-bottom-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 5px;
    border-top: 1px dashed #e2e8f0;
  }
  .btn-quick-pay,
  .btn-quick-ledger {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
  }
}

/* User Rights & Access Control Styles */
.perm-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  line-height: 1.3;
}
.perm-badge.perm-off {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
}
.perm-badge.perm-admin {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.perm-badge.perm-warn {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.perm-item {
  transition: background 0.15s ease;
}
.perm-item:hover {
  background: #f8fafc;
}


