/*
 * FitRun - SaaS Gym Management Application
 * Custom styles (Bootstrap 5.3 loaded via CDN)
 */

/* ===== Sidebar Variables ===== */
:root {
  --sidebar-bg: #ffffff;
  --sidebar-color: #5e6278;
  --sidebar-hover-bg: #f5f8fa;
  --sidebar-hover-color: var(--fitrun-primary);
  --sidebar-active-bg: rgba(99, 89, 233, 0.08);
  --sidebar-active-color: var(--fitrun-primary);
  --sidebar-border: #efefef;
  --sidebar-logo-color: #1a1a2e;
  --sidebar-muted: #a1a5b7;
}

[data-bs-theme="dark"] {
  --sidebar-bg: #1e1e2d;
  --sidebar-color: #a1a5b7;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.03);
  --sidebar-hover-color: #ffffff;
  --sidebar-active-bg: rgba(99, 89, 233, 0.15);
  --sidebar-active-color: var(--fitrun-primary);
  --sidebar-border: #2b2b40;
  --sidebar-logo-color: #ffffff;
  --sidebar-muted: #5e6278;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 70px;
  min-height: 100vh;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
  background-color: var(--sidebar-bg) !important;
  border-right: 1px solid var(--sidebar-border);
  overflow-x: hidden;
}

.sidebar.expanded {
  width: 250px;
}

.sidebar .nav-link {
  padding: 0.75rem 0.85rem;
  color: var(--sidebar-color);
  border-radius: 0.5rem;
  margin: 0.25rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
  color: var(--sidebar-hover-color);
  background-color: var(--sidebar-hover-bg);
}

.sidebar .nav-link.active {
  color: var(--sidebar-active-color);
  background-color: var(--sidebar-active-bg);
  font-weight: 600;
}

.sidebar .nav-link i {
  font-size: 1.25rem;
  min-width: 1.25rem;
  text-align: center;
}

@media (min-width: 768px) {
  .sidebar:not(.expanded) .link-text {
    display: none !important;
  }
}

.sidebar-logo-text {
  color: var(--sidebar-logo-color);
}

.sidebar-muted-text {
  color: var(--sidebar-muted);
}

.sidebar-border-bottom {
  border-bottom: 1px solid var(--sidebar-border) !important;
}

.sidebar-border-top {
  border-top: 1px solid var(--sidebar-border) !important;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: 70px;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
}

.sidebar.pinned~.main-content {
  margin-left: 250px;
}

/* ===== Top Bar ===== */
.top-bar {
  height: 64px;
  border-bottom: 1px solid var(--bs-border-color);
}

/* ===== Dashboard Cards ===== */
.dashboard-card {
  border: none;
  border-radius: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(99, 89, 233, 0.12);
}

.dashboard-card .card-body {
  padding: 1.25rem 1.5rem;
}

.card-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-body-color);
  letter-spacing: 0.01em;
}

.dashboard-stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--bs-body-color);
}

.dashboard-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2em 0.55em;
  border-radius: 0.35rem;
}

.dashboard-badge.badge-up {
  color: #0d9b5c;
  background-color: rgba(13, 155, 92, 0.1);
}

.dashboard-badge.badge-down {
  color: #dc3545;
  background-color: rgba(220, 53, 69, 0.1);
}

/* Legend dots */
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Donut center label */
.donut-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

/* Dashboard table */
.dashboard-table thead {
  background-color: #f8f7fe;
}

.dashboard-table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #eee;
  padding: 0.6rem 0.75rem;
}

.dashboard-table tbody td {
  font-size: 0.85rem;
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f3f3f3;
}

.dashboard-table tbody tr:hover {
  background-color: #faf9ff;
}

/* Button toggle group (Today / Week / Month) */
.btn-fitrun-toggle {
  background: transparent;
  border: 1px solid #e0dff5;
  color: #888;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.9rem;
  border-radius: 0.5rem !important;
  transition: all 0.15s ease;
}

.btn-fitrun-toggle:hover {
  background: #f0effe;
  color: var(--fitrun-primary);
}

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

/* Outline fitrun button */
.btn-outline-fitrun {
  color: var(--fitrun-primary);
  border-color: var(--fitrun-primary);
}

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

/* Quick stat items */
.quick-stat-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: var(--bs-body-bg);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.15s ease;
}

.quick-stat-item:hover {
  background: #faf9ff;
}

.quick-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.bg-fitrun-light {
  background-color: rgba(99, 89, 233, 0.1);
}

.bg-success-light {
  background-color: rgba(25, 135, 84, 0.1);
}

.bg-info-light {
  background-color: rgba(13, 202, 240, 0.1);
}

.bg-warning-light {
  background-color: rgba(255, 193, 7, 0.1);
}

.bg-danger-light {
  background-color: rgba(220, 53, 69, 0.1);
}

/* ===== Stat Cards (legacy support) ===== */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-change {
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-card .stat-change.positive {
  color: #198754;
}

.stat-card .stat-change.negative {
  color: #dc3545;
}

/* ===== Badge Styles ===== */
.badge-soft-primary {
  background-color: rgba(99, 89, 233, 0.1);
  color: #6359e9;
}

.badge-soft-success {
  background-color: rgba(25, 135, 84, 0.1);
  color: #198754;
}

.badge-soft-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.badge-soft-warning {
  background-color: rgba(255, 193, 7, 0.1);
  color: #997404;
}

/* ===== Primary Purple Theme ===== */
:root {
  --fitrun-primary: #6359e9;
  --fitrun-primary-light: #8b83ef;
  --fitrun-primary-dark: #4a41c7;
}

.bg-fitrun-primary {
  background-color: var(--fitrun-primary) !important;
}

.text-fitrun-primary {
  color: var(--fitrun-primary) !important;
}

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

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

/* ===== Table Styles ===== */
.table-fitrun thead {
  background-color: var(--fitrun-primary);
  color: #fff;
}

.table-fitrun thead th {
  font-weight: 600;
  border: none;
}

/* ===== Form Switch Purple ===== */
.form-check-input:checked {
  background-color: var(--fitrun-primary);
  border-color: var(--fitrun-primary);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* ===== Animations ===== */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Sidebar Location Selector ===== */
.sidebar-location-section {
  padding: 0.5rem 0.5rem;
}

.sidebar-location-section .location-expanded-content {
  display: none;
}

.sidebar.expanded .sidebar-location-section .location-expanded-content {
  display: block;
}

.sidebar-location-section .location-icon-collapsed {
  display: block;
  padding: 0.25rem 0;
}

.sidebar.expanded .sidebar-location-section .location-icon-collapsed {
  display: none;
}

.sidebar-select {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--sidebar-border);
  font-size: 0.8rem;
}

.sidebar-select:focus {
  border-color: var(--fitrun-primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 89, 233, 0.25);
  outline: none;
}

.sidebar-select option {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

/* ===== Login Page (Split Screen) ===== */
.login-split {
  min-height: 100vh;
  display: flex;
}

/* ── Left: Gym image panel ── */
.login-split__image {
  flex: 0 0 55%;
  background-image: url('https://images.unsplash.com/photo-1534438327276-14e5300c3a48?w=1400&q=80');
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.login-split__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(10, 8, 30, 0.30) 0%,
    rgba(10, 8, 30, 0.80) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3rem;
}

.login-split__brand {
  display: flex;
  align-items: center;
}

.login-split__tagline-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: rgba(255, 255, 255, 0.90);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-split__headline {
  font-size: 3rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.login-split__subline {
  color: rgba(255, 255, 255, 0.65);
  font-size: 1rem;
  max-width: 340px;
  line-height: 1.6;
  margin-top: 0.75rem;
}

.login-split__stats {
  display: flex;
  gap: 2.5rem;
}

.login-split__stat {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Right: Form panel ── */
.login-split__form {
  flex: 1;
  background: #0f0d1a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
}

.login-form-inner {
  width: 100%;
  max-width: 380px;
}

.login-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.4rem;
}

.login-input {
  background-color: #1a1730 !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
  border-radius: 0.6rem !important;
  padding: 0.65rem 0.9rem !important;
  font-size: 0.95rem !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  border-color: var(--fitrun-primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 89, 233, 0.20) !important;
  background-color: #1e1b36 !important;
  outline: none;
}

.login-input::placeholder {
  color: rgba(255, 255, 255, 0.25) !important;
}

.login-toggle-pw {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.40);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  transition: color 0.2s;
}

.login-toggle-pw:hover {
  color: rgba(255, 255, 255, 0.75);
}

.login-check {
  background-color: #1a1730;
  border-color: rgba(255, 255, 255, 0.20);
}

.login-form-muted {
  color: rgba(255, 255, 255, 0.45);
}

.login-btn {
  padding: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
  transition: transform 0.15s, box-shadow 0.15s !important;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 89, 233, 0.45) !important;
}

.login-btn:active {
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .login-split {
    flex-direction: column;
  }

  .login-split__image {
    flex: none;
    min-height: 240px;
  }

  .login-split__headline {
    font-size: 2rem;
  }

  .login-split__stats {
    gap: 1.5rem;
  }

  .login-split__form {
    padding: 2.5rem 1.5rem;
  }
}

/* ===== Sidebar Submenus ===== */
.sidebar .submenu-chevron {
  transition: transform 0.2s ease;
}

.sidebar .has-submenu.submenu-open .submenu-chevron {
  transform: rotate(180deg);
}

.sidebar-submenu .nav-link {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  margin: 0.1rem 0.25rem;
}

.sidebar-submenu .nav-link i {
  font-size: 1rem;
}

/* Expanded sidebar: Stimulus-managed submenu visibility */
.sidebar.expanded .sidebar-submenu {
  display: none;
}

.sidebar.expanded .has-submenu.submenu-open .sidebar-submenu {
  display: block;
}

@media (min-width: 768px) {
  .sidebar:not(.expanded) .has-submenu {
    position: relative;
  }

  /* Transparent bridge over the 5px gap so hover doesn't break */
  .sidebar:not(.expanded) .has-submenu::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 0;
    width: 5px;
    height: 100%;
    background: transparent;
  }

  .sidebar:not(.expanded) .sidebar-submenu {
    display: none !important;
    position: absolute;
    left: calc(100% + 5px);
    top: 0;
    width: 200px;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    padding: 0.5rem;
  }

  /* Reset Bootstrap collapse transitions */
  .sidebar:not(.expanded) .sidebar-submenu.collapsing {
    height: auto !important;
    overflow: visible !important;
    transition: none !important;
    display: none !important;
  }

  /* Show floating menu on hover, focus, or when .submenu-open is toggled via click */
  .sidebar:not(.expanded) .has-submenu:hover .sidebar-submenu,
  .sidebar:not(.expanded) .has-submenu:focus-within .sidebar-submenu,
  .sidebar:not(.expanded) .has-submenu:hover .sidebar-submenu.collapsing,
  .sidebar:not(.expanded) .has-submenu:focus-within .sidebar-submenu.collapsing,
  .sidebar:not(.expanded) .has-submenu.submenu-open .sidebar-submenu {
    display: block !important;
  }

  /* Override text hiding inside the floating submenu */
  .sidebar:not(.expanded) .sidebar-submenu .link-text {
    display: inline-block !important;
  }

  /* Adjust padding from submenu list */
  .sidebar:not(.expanded) .sidebar-submenu > ul {
    padding-left: 0 !important;
  }
}

/* ===== Sidebar Overlay (mobile backdrop) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1039;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== Mobile: off-canvas drawer (< 768px) ===== */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    transition: transform 0.3s ease;
  }

  .sidebar.expanded {
    transform: translateX(0);
    width: 270px !important;
  }

  /* Using natural display for link-text inside the mobile drawer */

  .sidebar-location-section .location-expanded-content {
    display: block !important;
  }

  .sidebar-location-section .location-icon-collapsed {
    display: none !important;
  }


  /* Main content spans full width on mobile */
  .main-content {
    margin-left: 0 !important;
  }

  .sidebar.expanded~.main-content {
    margin-left: 0 !important;
  }
}


/* ===== Exercise Card Category Colors ===== */
.exercise-category-strength {
  background: rgba(99, 89, 233, 0.1);
}

.exercise-category-cardio {
  background: rgba(231, 76, 60, 0.1);
}

.exercise-category-flexibility {
  background: rgba(39, 174, 96, 0.1);
}

.exercise-category-balance {
  background: rgba(243, 156, 18, 0.1);
}

.exercise-category-plyometrics {
  background: rgba(142, 68, 173, 0.1);
}

.exercise-category-hiit {
  background: rgba(230, 126, 34, 0.1);
}

.exercise-category-yoga {
  background: rgba(22, 160, 133, 0.1);
}


/* ===== Invoice Canvas (DIY Invoice Builder) ===== */
.invoice-canvas {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.08);
  padding: 36px 40px;
  border: 1px solid #f0f0f0;
}

/* Transparent inline inputs that look like document text */
.invoice-inline-input {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  outline: none;
}

.invoice-inline-input:hover {
  background: rgba(99, 89, 233, 0.03);
  border-radius: 3px;
}

.invoice-inline-input:focus {
  outline: 1px dashed #c5c0f5;
  border-radius: 3px;
  background: rgba(99, 89, 233, 0.04);
}

/* Canvas header */
.inv-logo {
  height: 56px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid #eee;
}

.inv-logo-placeholder {
  width: 56px;
  height: 56px;
  border: 1px dashed #ddd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.inv-biz-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.3px;
}

.inv-biz-sub {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.inv-gstin-badge {
  display: inline-block;
  font-size: 10px;
  color: #888;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 1px 7px;
  margin-top: 4px;
  font-family: monospace;
  letter-spacing: 0.05em;
}

.inv-title-input-wrap {
  margin-bottom: 2px;
}

.inv-title-input {
  font-size: 1.4rem;
  font-weight: 800;
  color: #6359e9;
  letter-spacing: 0.1em;
  text-align: right;
  max-width: 200px;
}

.inv-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-top: 2px;
}

.inv-date-line {
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
}

/* Parties row */
.inv-parties-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.inv-party-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #aaa;
  margin-bottom: 5px;
  font-weight: 700;
}

.inv-party-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 3px;
}

.inv-party-detail {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

/* Section label above items table */
.inv-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #aaa;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Line items table */
.inv-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.inv-items-table thead tr {
  background: #6359e9;
}

.inv-items-table thead th {
  padding: 10px 12px;
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  border: none;
}

.inv-items-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
  font-size: 13px;
  color: #444;
}

.inv-items-table tbody tr:last-child td {
  border-bottom: none;
}

/* Totals block */
.inv-totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.inv-totals-table {
  width: 300px;
  border-collapse: collapse;
}

.inv-totals-table td {
  padding: 5px 12px;
  font-size: 13px;
  color: #666;
}

.inv-totals-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: #444;
}

.inv-divider-row td {
  border-top: 1px dashed #e8e8e8;
  padding-top: 8px;
  color: #888 !important;
  font-size: 12px !important;
}

.inv-total-row td {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #6359e9 !important;
  border-top: 2px solid #6359e9 !important;
  padding-top: 10px !important;
}

/* Quick action links below totals */
.inv-quick-actions {
  padding-top: 8px;
  border-top: 1px dashed #eee;
}

/* ===== Invoice Builder UI (sidebar + sticky bar) ===== */

/* Sticky top action bar */
.billing-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 1020;
  margin: 0 -12px 0.25rem -12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .billing-sticky-bar {
  background: rgba(30, 30, 46, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.billing-sticky-bar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.25rem;
  flex-wrap: wrap;
}

.billing-sticky-bar__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.billing-sticky-bar__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 89, 233, 0.12);
  color: var(--fitrun-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.billing-sticky-bar__heading h5 {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.billing-sticky-bar__sub {
  font-size: 0.72rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 1px;
}

.billing-sticky-bar__total {
  text-align: right;
  padding: 0 1rem;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  line-height: 1.1;
}

[data-bs-theme="dark"] .billing-sticky-bar__total {
  border-left-color: rgba(255, 255, 255, 0.08);
  border-right-color: rgba(255, 255, 255, 0.08);
}

.billing-sticky-bar__total-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  font-weight: 600;
}

.billing-sticky-bar__total-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fitrun-primary);
  letter-spacing: -0.01em;
}

.billing-sticky-bar__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .billing-sticky-bar__inner { gap: 0.5rem; }
  .billing-sticky-bar__total { padding: 0 0.5rem; }
  .billing-sticky-bar__total-value { font-size: 1.1rem; }
  .billing-sticky-bar__heading h5 { font-size: 0.9rem; }
}

/* Step cards — numbered sidebar cards */
.step-card {
  background: var(--bs-body-bg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

[data-bs-theme="dark"] .step-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.step-card:hover {
  box-shadow: 0 3px 14px rgba(99, 89, 233, 0.08);
}

.step-card__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .step-card__header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.step-card__header h6 {
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.step-card__body {
  padding: 0.9rem;
}

.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--fitrun-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.peak-pill {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Customer quick-preview chip */
.customer-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: rgba(99, 89, 233, 0.05);
  border: 1px dashed rgba(99, 89, 233, 0.25);
  border-radius: 10px;
  min-height: 46px;
}

[data-bs-theme="dark"] .customer-chip {
  background: rgba(99, 89, 233, 0.12);
  border-color: rgba(99, 89, 233, 0.35);
}

.customer-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fitrun-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.customer-chip__body {
  min-width: 0;
  flex: 1;
}

.customer-chip__name {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bs-body-color);
}

.customer-chip__meta {
  font-size: 0.68rem;
  color: #888;
  margin-top: 2px;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-chip__meta:empty { display: none; }

.customer-chip__dot { opacity: 0.5; }

/* Payment status segmented pills */
.payment-status-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.payment-status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  background: rgba(0, 0, 0, 0.03);
  color: #666;
  user-select: none;
}

[data-bs-theme="dark"] .payment-status-pill {
  background: rgba(255, 255, 255, 0.04);
  color: #aaa;
}

.payment-status-pill:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .payment-status-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-check:checked + .payment-status-pill--pending {
  background: rgba(255, 193, 7, 0.15);
  color: #cc8a00;
  border-color: rgba(255, 193, 7, 0.45);
}

.btn-check:checked + .payment-status-pill--paid {
  background: rgba(25, 135, 84, 0.15);
  color: #198754;
  border-color: rgba(25, 135, 84, 0.45);
}

.btn-check:checked + .payment-status-pill--cancelled {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border-color: rgba(220, 53, 69, 0.45);
}

[data-bs-theme="dark"] .btn-check:checked + .payment-status-pill--pending { color: #ffca2c; }
[data-bs-theme="dark"] .btn-check:checked + .payment-status-pill--paid    { color: #52c98b; }
[data-bs-theme="dark"] .btn-check:checked + .payment-status-pill--cancelled { color: #f27474; }

.mark-paid-shortcut {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  color: #198754;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.mark-paid-shortcut:hover {
  background: rgba(25, 135, 84, 0.1);
}

/* GST type segmented control */
.gst-type-segmented {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 10px;
}

.gst-type-segmented__label {
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.gst-type-segmented__control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px;
  border-radius: 8px;
}

.gst-type-seg-btn {
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  margin: 0;
  user-select: none;
}

.btn-check:checked + .gst-type-seg-btn {
  background: var(--fitrun-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99, 89, 233, 0.3);
}

/* Peak surcharge alert — cleaned up version */
.peak-surcharge-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.04));
  border: 1px solid rgba(255, 193, 7, 0.4);
  font-size: 12px;
  color: #856404;
}

[data-bs-theme="dark"] .peak-surcharge-alert {
  background: rgba(255, 193, 7, 0.08);
  color: #ffca2c;
}

/* Canvas status chip — driven by form-level :has() selector */
.invoice-canvas--builder {
  position: relative;
}

.canvas-status-chip {
  display: none;
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 2;
  border: 2px solid;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.canvas-status-chip--pending   { color: #cc8a00; border-color: #ffc107; }
.canvas-status-chip--paid      { color: #198754; border-color: #198754; }
.canvas-status-chip--cancelled { color: #dc3545; border-color: #dc3545; }

.billing-form:has(input[name="billing[payment_status]"][value="pending"]:checked)
  .canvas-status-chip--pending { display: inline-flex; align-items: center; }
.billing-form:has(input[name="billing[payment_status]"][value="paid"]:checked)
  .canvas-status-chip--paid { display: inline-flex; align-items: center; }
.billing-form:has(input[name="billing[payment_status]"][value="cancelled"]:checked)
  .canvas-status-chip--cancelled { display: inline-flex; align-items: center; }

/* Quick action pills (replaces text links) */
.inv-quick-actions--pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  border-top: 1px dashed #eee;
  padding-top: 12px;
}

.inv-quick-actions--pills .btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
}

.inv-quick-actions--pills [data-billing-form-target="additionalChargesInputWrap"] {
  display: inline-flex;
  align-items: center;
}

/* ===== CRM Module ===== */

/* Segment badges */
.segment-badge-lead {
  background: rgba(99, 89, 233, 0.12);
  color: #6359e9;
}
.segment-badge-prospect {
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
}
.segment-badge-client {
  background: rgba(25, 135, 84, 0.12);
  color: #198754;
}
.segment-badge-churned {
  background: rgba(108, 117, 125, 0.12);
  color: #6c757d;
}

[data-bs-theme="dark"] .segment-badge-lead {
  background: rgba(99, 89, 233, 0.22);
  color: #a89df0;
}
[data-bs-theme="dark"] .segment-badge-prospect {
  background: rgba(13, 110, 253, 0.22);
  color: #5fa8fd;
}
[data-bs-theme="dark"] .segment-badge-client {
  background: rgba(25, 135, 84, 0.22);
  color: #52c98b;
}
[data-bs-theme="dark"] .segment-badge-churned {
  background: rgba(108, 117, 125, 0.22);
  color: #9ea5ad;
}

/* Activity timeline */
.activity-timeline {
  position: relative;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bs-border-color);
  opacity: 0.5;
}
.activity-item {
  position: relative;
  padding-left: 52px;
  margin-bottom: 1.25rem;
}
.activity-icon {
  position: absolute;
  left: 8px;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  z-index: 1;
}
.activity-icon.type-call      { background: rgba(25, 135, 84, 0.15); }
.activity-icon.type-email     { background: rgba(13, 110, 253, 0.15); }
.activity-icon.type-whatsapp  { background: rgba(25, 135, 84, 0.15); }
.activity-icon.type-meeting   { background: rgba(255, 193, 7, 0.2); }
.activity-icon.type-note      { background: rgba(108, 117, 125, 0.15); }
.activity-icon.type-follow_up { background: rgba(13, 202, 240, 0.15); }

.activity-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  transition: box-shadow 0.15s;
}
.activity-card:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .activity-card {
  background: var(--bs-tertiary-bg);
}

/* Activity status badges */
.status-badge-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #856404;
}
.status-badge-completed {
  background: rgba(25, 135, 84, 0.15);
  color: #198754;
}
.status-badge-cancelled {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

[data-bs-theme="dark"] .status-badge-pending   { color: #ffc107; }
[data-bs-theme="dark"] .status-badge-completed { color: #52c98b; }
[data-bs-theme="dark"] .status-badge-cancelled { color: #f27474; }

/* CRM stat cards */
.crm-stat-card {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.crm-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}
.crm-stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

/* CRM segment tabs */
.crm-segment-tabs .nav-link {
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 1rem;
  color: var(--bs-secondary-color);
  border: none;
}
.crm-segment-tabs .nav-link.active {
  background: var(--bs-primary);
  color: #fff;
}
.crm-segment-tabs .nav-link:hover:not(.active) {
  background: var(--bs-secondary-bg);
}

/* Contact avatar */
.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(99, 89, 233, 0.15);
  color: #6359e9;
}

/* Contact hero */
.contact-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(99, 89, 233, 0.2), rgba(99, 89, 233, 0.05));
  color: #6359e9;
  flex-shrink: 0;
}

/* ============================================================
   Flatpickr — FitRun Custom Theme
   Overrides flatpickr.min.css (loaded via CDN before this file)
   Supports light/dark via [data-bs-theme="dark"] on <html>
   ============================================================ */

/* ── Calendar container ── */
.flatpickr-calendar {
  font-family: inherit;
  border-radius: 0.75rem;
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 8px 32px rgba(99, 89, 233, 0.15);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  padding: 0.25rem;
  width: 307px !important;
  overflow: visible;
}

/* ── Month navigation header ── */
.flatpickr-months {
  background: var(--fitrun-primary);
  border-radius: 0.65rem 0.65rem 0 0;
  padding: 0.35rem 0.5rem;
}

.flatpickr-months .flatpickr-month {
  color: #fff;
  fill: #fff;
}

.flatpickr-current-month {
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: transparent;
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
  background: rgba(255, 255, 255, 0.15);
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
  background: #ffffff;
  color: #1a1a2e;
}

.flatpickr-current-month input.cur-year {
  color: #fff !important;
  font-weight: 700;
  background: transparent;
  border: none;
  padding: 0 4px;
  border-radius: 4px;
}

.flatpickr-current-month input.cur-year:hover {
  background: rgba(255, 255, 255, 0.15);
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  color: rgba(255, 255, 255, 0.85) !important;
  fill: rgba(255, 255, 255, 0.85) !important;
  border-radius: 0.4rem;
  padding: 4px 6px;
  transition: background 0.15s ease;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  fill: #fff !important;
}

/* ── Weekday labels ── */
.flatpickr-weekdays {
  background: transparent;
  padding-top: 0.35rem;
}

.flatpickr-weekday {
  color: var(--fitrun-primary) !important;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Day cells ── */
.flatpickr-day {
  border-radius: 0.4rem;
  color: var(--bs-body-color);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.flatpickr-days {
  margin-left: -9px;
}

.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
  background: rgba(99, 89, 233, 0.1);
  border-color: transparent;
  color: var(--fitrun-primary);
}

.flatpickr-day.today {
  border-color: var(--fitrun-primary) !important;
  color: var(--fitrun-primary) !important;
  font-weight: 700;
}

.flatpickr-day.today:hover {
  background: var(--fitrun-primary) !important;
  color: #fff !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--fitrun-primary) !important;
  border-color: var(--fitrun-primary) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99, 89, 233, 0.4);
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: var(--bs-secondary-color);
  opacity: 0.45;
}

.flatpickr-day.disabled,
.flatpickr-day.disabled:hover {
  color: var(--bs-secondary-color);
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── altInput display field — styled like Bootstrap form-control ── */
.flatpickr-input.form-control[readonly]:not([style*="display: none"]),
.flatpickr-input.form-control-sm[readonly]:not([style*="display: none"]) {
  background: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
  cursor: pointer;
  border-color: var(--bs-border-color);
}

.flatpickr-input.form-control[readonly]:focus,
.flatpickr-input.form-control-sm[readonly]:focus,
.flatpickr-input.form-control[readonly]:focus-visible,
.flatpickr-input.form-control-sm[readonly]:focus-visible {
  outline: none;
  border-color: var(--fitrun-primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 89, 233, 0.2);
}

/* ── Positioning — ensure calendar renders above Bootstrap modals ── */
.flatpickr-calendar.open {
  z-index: 9999 !important;
}

/* ── Dark mode overrides ── */
[data-bs-theme="dark"] .flatpickr-calendar {
  background: #1e1e2d;
  border-color: #2b2b40;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  color: #a1a5b7;
}

[data-bs-theme="dark"] .flatpickr-day {
  color: #a1a5b7;
}

[data-bs-theme="dark"] .flatpickr-day:hover {
  background: rgba(99, 89, 233, 0.18);
  color: #fff;
}

[data-bs-theme="dark"] .flatpickr-day.today {
  border-color: var(--fitrun-primary) !important;
  color: var(--fitrun-primary) !important;
}

[data-bs-theme="dark"] .flatpickr-day.selected,
[data-bs-theme="dark"] .flatpickr-day.selected:hover {
  background: var(--fitrun-primary) !important;
  border-color: var(--fitrun-primary) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .flatpickr-day.prevMonthDay,
[data-bs-theme="dark"] .flatpickr-day.nextMonthDay {
  color: #5e6278;
}

[data-bs-theme="dark"] .flatpickr-weekday {
  color: var(--fitrun-primary-light) !important;
}

[data-bs-theme="dark"] .flatpickr-input.form-control[readonly]:not([style*="display: none"]),
[data-bs-theme="dark"] .flatpickr-input.form-control-sm[readonly]:not([style*="display: none"]) {
  background: #1e1e2d !important;
  color: #a1a5b7 !important;
  border-color: #2b2b40;
}

/* Dark theme — fix .table-light white header background and alignment */
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table > thead.table-light,
[data-bs-theme="dark"] .table-light > tr,
[data-bs-theme="dark"] .table-light > tr > th,
[data-bs-theme="dark"] .table-light > tr > td,
[data-bs-theme="dark"] thead.table-light th {
  --bs-table-bg: #1e1e2d;
  --bs-table-color: #e4e6ef;
  --bs-table-border-color: #2b2b40;
  background-color: #1e1e2d !important;
  color: #e4e6ef !important;
  border-color: #2b2b40 !important;
}

[data-bs-theme="dark"] .table thead th {
  vertical-align: middle;
}

/* Import Roster — drag-drop dropzone */
.import-dropzone { transition: background 0.2s, border-color 0.2s; }
.import-dropzone.drag-active { background: #eeecff !important; border-color: #4b40c8 !important; }
