/* ============================================================
   BillCrisp Premium UI — v2 Design System
   Light-first, glassmorphism, subtle 3D, micro-interactions
   Loaded after billcrisp-premium.css
   ============================================================ */

/* ---------- 1. Base polish ---------- */
body {
  font-feature-settings: 'cv11', 'ss01';
  letter-spacing: -0.006em;
}

::selection { background: rgba(99,102,241,0.22); }

:focus-visible {
  outline: 2px solid var(--bc-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

kbd, .kbd {
  background: var(--bc-surface-3);
  border: 1px solid var(--bc-border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bc-text-secondary);
  font-family: inherit;
}

/* ---------- 2. Page entrance ---------- */
@keyframes bcPageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.bc-main, .bc-main-full { animation: bcPageIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes bcFadeUp {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card, .bc-stat-card, .bc-quick-action, .bc-page-header {
  animation: bcFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.card:nth-child(2), .bc-stat-card:nth-child(2), .bc-quick-action:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3), .bc-stat-card:nth-child(3), .bc-quick-action:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4), .bc-stat-card:nth-child(4), .bc-quick-action:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5), .bc-stat-card:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(6) { animation-delay: 0.2s; }

/* scroll reveal (added via JS) */
.bc-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.bc-reveal.revealed { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .bc-reveal, .card, .bc-stat-card, .bc-quick-action, .bc-page-header,
  .bc-main, .bc-main-full { animation: none; transition: none; opacity: 1; transform: none; }
}

/* ---------- 3. Cards ---------- */
.card {
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-card-radius);
  background: var(--bc-surface);
  box-shadow: var(--bc-card-shadow);
  transition: transform var(--bc-transition), box-shadow var(--bc-transition), border-color var(--bc-transition);
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  border-radius: var(--bc-card-radius) var(--bc-card-radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.35), rgba(6,182,212,0.35), transparent);
  opacity: 0;
  transition: opacity var(--bc-transition);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--bc-card-shadow-hover);
  border-color: rgba(99,102,241,0.25);
}
.card:hover::before { opacity: 1; }

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--bc-border-light);
  padding: 1.05rem 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-header:first-child { border-radius: var(--bc-card-radius) var(--bc-card-radius) 0 0; }
.card-body { padding: 1.35rem; }
.card-footer {
  background: var(--bc-surface-2);
  border-top: 1px solid var(--bc-border-light);
  border-radius: 0 0 var(--bc-card-radius) var(--bc-card-radius);
  padding: 0.9rem 1.35rem;
}

/* ---------- 4. Buttons ---------- */
.btn {
  border-radius: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.55rem 1.15rem;
  transition: transform var(--bc-transition-fast), box-shadow var(--bc-transition-fast),
              background-color var(--bc-transition-fast), color var(--bc-transition-fast),
              border-color var(--bc-transition-fast);
  position: relative;
  overflow: hidden;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(37,99,235,0.32), 0 1px 3px rgba(30,64,175,0.2);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(37,99,235,0.4), 0 2px 6px rgba(30,64,175,0.25);
}
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(16,185,129,0.28);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,185,129,0.38); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(239,68,68,0.26);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(239,68,68,0.36); }
.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,0.28);
}
.btn-warning:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(245,158,11,0.38); }
.btn-info {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(6,182,212,0.26);
}
.btn-info:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(6,182,212,0.36); }
.btn-outline-primary {
  color: var(--bc-primary);
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.04);
}
.btn-outline-primary:hover {
  background: rgba(99,102,241,0.1);
  border-color: var(--bc-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99,102,241,0.18);
}
.btn-outline-secondary, .btn-outline-light {
  color: var(--bc-text-secondary);
  border-color: var(--bc-border);
  background: var(--bc-surface);
}
.btn-outline-secondary:hover, .btn-outline-light:hover {
  color: var(--bc-primary);
  border-color: rgba(99,102,241,0.4);
  background: var(--bc-surface);
  transform: translateY(-2px);
}
.btn-ghost, .btn-light {
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
  color: var(--bc-text-secondary);
}
.btn-ghost:hover, .btn-light:hover {
  background: var(--bc-surface-3);
  color: var(--bc-primary);
  border-color: rgba(99,102,241,0.3);
}
.btn-link { font-weight: 600; color: var(--bc-primary); text-underline-offset: 3px; }
.btn-sm { border-radius: 9px; padding: 0.38rem 0.85rem; }
.btn-lg { border-radius: 14px; padding: 0.75rem 1.6rem; }

/* ripple */
.bc-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: bcRipple 0.6s ease-out forwards;
  pointer-events: none;
}
.btn-outline-primary .bc-ripple, .btn-outline-secondary .bc-ripple,
.btn-ghost .bc-ripple, .btn-light .bc-ripple { background: rgba(99,102,241,0.22); }
@keyframes bcRipple { to { transform: scale(2.6); opacity: 0; } }

/* loading / success button states */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bcSpin 0.7s linear infinite;
}
.btn-outline-primary.is-loading::after, .btn-outline-secondary.is-loading::after,
.btn-ghost.is-loading::after { border-color: rgba(99,102,241,0.25); border-top-color: var(--bc-primary); }
@keyframes bcSpin { to { transform: rotate(360deg); } }
.btn.is-success { background: var(--bc-success) !important; box-shadow: 0 4px 14px rgba(16,185,129,0.35) !important; }

/* ---------- 5. Badges & chips ---------- */
.badge {
  font-weight: 600;
  padding: 0.42em 0.75em;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.badge.bg-primary { background: rgba(99,102,241,0.12) !important; color: var(--bc-primary-dark); }
.badge.bg-success { background: rgba(16,185,129,0.12) !important; color: #047857; }
.badge.bg-warning { background: rgba(245,158,11,0.14) !important; color: #b45309; }
.badge.bg-danger { background: rgba(239,68,68,0.12) !important; color: #b91c1c; }
.badge.bg-info { background: rgba(6,182,212,0.12) !important; color: #0e7490; }
.badge.bg-secondary { background: var(--bc-surface-3) !important; color: var(--bc-text-secondary); }
.badge.bg-dark, .badge.bg-light { background: var(--bc-surface-3) !important; color: var(--bc-text); }
.badge.bg-primary.text-white, .badge.bg-success.text-white,
.badge.bg-warning.text-white, .badge.bg-danger.text-white,
.badge.bg-info.text-white, .badge.bg-dark.text-white {
  background: var(--bc-primary-gradient) !important; color: #fff !important;
}
[data-bs-theme="dark"] .badge.bg-primary { color: #a5b4fc; }
[data-bs-theme="dark"] .badge.bg-success { color: #6ee7b7; }
[data-bs-theme="dark"] .badge.bg-warning { color: #fcd34d; }
[data-bs-theme="dark"] .badge.bg-danger { color: #fca5a5; }
[data-bs-theme="dark"] .badge.bg-info { color: #67e8f9; }

.bc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bc-text-secondary);
}

.bc-chip-info { background: rgba(14, 165, 233, 0.1); border-color: rgba(14, 165, 233, 0.25); color: #0284c7; }
.bc-chip-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.25); color: #059669; }
.bc-chip-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.25); color: #d97706; }
.bc-chip-danger { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.25); color: #dc2626; }
.bc-chip-purple { background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.25); color: #7c3aed; }

/* ---------- 5b. Badges (premium pill badges) ---------- */
.bc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.bc-badge-success { background: rgba(16, 185, 129, 0.12); color: #059669; border: 1px solid rgba(16, 185, 129, 0.3); }
.bc-badge-warning { background: rgba(245, 158, 11, 0.12); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.3); }
.bc-badge-danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.3); }
.bc-badge-info { background: rgba(14, 165, 233, 0.12); color: #0284c7; border: 1px solid rgba(14, 165, 233, 0.3); }
.bc-badge-primary { background: rgba(99, 102, 241, 0.12); color: #4f46e5; border: 1px solid rgba(99, 102, 241, 0.3); }
.bc-badge-purple { background: rgba(139, 92, 246, 0.12); color: #7c3aed; border: 1px solid rgba(139, 92, 246, 0.3); }
.bc-badge-muted { background: rgba(148, 163, 184, 0.12); color: #64748b; border: 1px solid rgba(148, 163, 184, 0.3); }

/* ---------- 5c. Alerts (premium callouts) ---------- */
.bc-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.85rem 1.1rem;
  border-radius: var(--bc-card-radius, 14px);
  border: 1px solid var(--bc-border);
  font-size: 0.875rem;
  font-weight: 500;
}
.bc-alert i { font-size: 1.05rem; }
.bc-alert-info { background: rgba(14, 165, 233, 0.08); border-color: rgba(14, 165, 233, 0.3); color: #0369a1; }
.bc-alert-success { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.3); color: #047857; }
.bc-alert-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.3); color: #b45309; }
.bc-alert-danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.3); color: #b91c1c; }

/* ---------- 6. Tables (premium grid) ---------- */
.table-responsive { border-radius: var(--bc-border-radius); }
.table {
  --bs-table-bg: transparent;
  --bs-table-accent-bg: transparent;
  margin-bottom: 0;
}
.table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bc-text-muted);
  background: var(--bc-surface-2);
  border-bottom: 1px solid var(--bc-border);
  padding: 0.85rem 1rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--bc-border-light);
  vertical-align: middle;
  font-size: 0.88rem;
  color: var(--bc-text);
}
.table tbody tr {
  transition: background-color var(--bc-transition-fast), transform var(--bc-transition-fast);
}
.table-hover tbody tr:hover {
  background: rgba(99,102,241,0.045);
}
.table tbody tr:last-child td { border-bottom: none; }
.table-striped > tbody > tr:nth-of-type(odd) {
  --bs-table-striped-color: var(--bc-text);
  background-color: rgba(99,102,241,0.02);
}
.table .form-check-input { margin-top: 0; }
.table .btn-sm { padding: 0.28rem 0.65rem; font-size: 0.78rem; }

/* row action buttons inside tables */
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0.5; transition: opacity var(--bc-transition-fast); }
.table tr:hover .row-actions { opacity: 1; }

/* pagination */
.pagination { gap: 4px; }
.page-link {
  border: 1px solid var(--bc-border);
  background: var(--bc-surface);
  color: var(--bc-text-secondary);
  border-radius: 10px !important;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  transition: all var(--bc-transition-fast);
  margin: 0;
}
.page-link:hover {
  background: rgba(99,102,241,0.08);
  color: var(--bc-primary);
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-1px);
}
.page-item.active .page-link {
  background: var(--bc-primary-gradient);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99,102,241,0.32);
}

/* ---------- 7. Forms ---------- */
/* ---------- 7. Forms ---------- */
.form-control {
  border: 1.5px solid var(--bc-border);
  border-radius: 11px;
  background: var(--bc-surface);
  color: var(--bc-text);
  padding: 0.62rem 0.9rem;
  font-size: 0.9rem;
  transition: border-color var(--bc-transition-fast), box-shadow var(--bc-transition-fast), background var(--bc-transition-fast);
}
.form-control:focus {
  border-color: rgba(99,102,241,0.55);
  background: var(--bc-surface);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
  color: var(--bc-text);
}
.form-control::placeholder { color: var(--bc-text-muted); }

/* ✨ Single-Chevron Modern Redesign for .form-select */
.form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  display: block;
  width: 100%;
  padding: 0.62rem 2.5rem 0.62rem 0.95rem;
  font-size: 0.89rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--bc-text);
  background-color: var(--bc-surface) !important;
  background-image: var(--bs-form-select-bg-img) !important;
  background-repeat: no-repeat !important;
  background-position: right 0.85rem center !important;
  background-size: 14px 10px !important;
  border: 1.5px solid var(--bc-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select::-ms-expand {
  display: none !important;
}

.form-select:hover:not(:disabled) {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.08);
}

.form-select:focus {
  border-color: #2563eb;
  outline: 0;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(37, 99, 235, 0.08);
}

.form-select:disabled {
  background-color: var(--bc-bg-alt, #f8fafc) !important;
  border-color: var(--bc-border);
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.form-select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
  padding: 8px 12px;
  font-weight: 500;
}

.form-select-sm {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  padding-left: 0.75rem;
  padding-right: 2.1rem;
  font-size: 0.82rem;
  border-radius: 9px;
  background-size: 12px 9px !important;
  background-position: right 0.65rem center !important;
}

.form-select-lg {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  padding-left: 1.1rem;
  padding-right: 2.8rem;
  font-size: 1rem;
  border-radius: 14px;
  background-size: 16px 12px !important;
  background-position: right 0.95rem center !important;
}

[data-bs-theme="dark"] .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2360a5fa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  background-color: var(--bc-surface) !important;
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--bc-text);
  background-image: var(--bs-form-select-bg-img) !important;
}

[data-bs-theme="dark"] .form-select option {
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-select:hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2), 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .form-select:hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2), 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* Input group alignment anti-glitch rules */
.input-group > .form-select:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group > .form-select:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.form-label { font-weight: 600; font-size: 0.8rem; color: var(--bc-text-secondary); letter-spacing: 0.02em; }
.form-text { color: var(--bc-text-muted); font-size: 0.78rem; }
.form-check-input {
  width: 1.1em;
  height: 1.1em;
  border-color: var(--bc-border);
  background-color: var(--bc-surface);
}
.form-check-input:checked {
  background-color: var(--bc-primary);
  border-color: var(--bc-primary);
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.5); }
.is-invalid, .was-validated .form-control:invalid {
  border-color: var(--bc-danger);
}
.is-invalid:focus, .was-validated .form-control:invalid:focus {
  box-shadow: 0 0 0 4px rgba(239,68,68,0.12);
}
.input-group-text {
  background: var(--bc-surface-2);
  border: 1.5px solid var(--bc-border);
  border-radius: 0;
  color: var(--bc-text-secondary);
  font-size: 0.88rem;
}
.input-group .form-control:first-child { border-radius: 11px 0 0 11px; }
.input-group .btn:last-child { border-radius: 0 11px 11px 0; }

/* floating labels */
.form-floating > .form-control, .form-floating > .form-select {
  border-radius: 12px;
}
.form-floating > label { color: var(--bc-text-muted); font-weight: 500; }

/* range */
.form-range::-webkit-slider-thumb {
  background: var(--bc-primary);
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}

/* detail pages: key-value grid */
.bc-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--bc-border);
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  overflow: hidden;
}
.bc-detail-grid .bc-detail-item { background: var(--bc-surface); padding: 0.9rem 1.1rem; }
.bc-detail-grid .bc-detail-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bc-text-muted); margin-bottom: 0.25rem; }
.bc-detail-grid .bc-detail-value { font-size: 0.95rem; font-weight: 600; color: var(--bc-text-primary); word-break: break-word; }

/* django-rendered form fields ({{ field }}) inside form cards */
.bc-form-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
.bc-form-card select,
.bc-form-card textarea {
  display: block;
  width: 100%;
  padding: 0.62rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bc-text);
  background: var(--bc-surface);
  border: 1.5px solid var(--bc-border);
  border-radius: 11px;
  transition: border-color var(--bc-transition-fast), box-shadow var(--bc-transition-fast), background var(--bc-transition-fast);
}
.bc-form-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):focus,
.bc-form-card select:focus,
.bc-form-card textarea:focus {
  border-color: rgba(99,102,241,0.55);
  background: var(--bc-surface);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
  outline: none;
}
.bc-form-card input::placeholder, .bc-form-card textarea::placeholder { color: var(--bc-text-muted); }
.bc-form-card input[type="checkbox"], .bc-form-card input[type="radio"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--bc-primary);
  margin-right: 0.25rem;
}
.bc-form-card select { font-size: 0.89rem; }
.bc-form-card .helptext { display: block; color: var(--bc-text-muted); font-size: 0.78rem; margin-top: 0.3rem; }
.bc-form-card .errorlist { list-style: none; padding: 0; margin: 0.35rem 0 0; font-size: 0.78rem; font-weight: 600; color: var(--bc-danger); }
.bc-form-card .errorlist.nonfield { margin-bottom: 0.6rem; }
.bc-form-card label:not(.form-check-label) { font-weight: 600; font-size: 0.8rem; color: var(--bc-text-secondary); letter-spacing: 0.02em; margin-bottom: 0.35rem; display: inline-block; }

/* ---------- 8. Dropdowns ---------- */.dropdown-menu {
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(30,33,64,0.14), 0 4px 12px rgba(30,33,64,0.06);
  padding: 0.45rem;
  animation: bcDropdownIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bcDropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-item {
  border-radius: 9px;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--bc-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dropdown-item i { width: 18px; text-align: center; }
.dropdown-item:hover, .dropdown-item:focus {
  background: rgba(99,102,241,0.08);
  color: var(--bc-primary);
}
.dropdown-item.active { background: var(--bc-primary-soft); color: var(--bc-primary-dark); font-weight: 600; }
.dropdown-item.text-danger:hover { background: rgba(239,68,68,0.08); color: var(--bc-danger); }
.dropdown-header { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--bc-text-muted); font-weight: 700; }
.dropdown-divider { border-color: var(--bc-border-light); }

/* ---------- 9. Modals ---------- */
.modal-content {
  border: 1px solid var(--bc-border);
  border-radius: 22px;
  background: var(--bc-surface);
  box-shadow: 0 32px 80px rgba(30,33,64,0.2);
}
.modal.show .modal-content { animation: bcModalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes bcModalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal { z-index: 1060 !important; }
.modal-backdrop { z-index: 1050 !important; }
.modal-backdrop.show { opacity: 0.45; backdrop-filter: blur(4px); }
/* Fail-safe backdrop pointer-events guard to prevent screen freezing */
body:not(.modal-open) .modal-backdrop {
  display: none !important;
  pointer-events: none !important;
}
.modal-header { border-bottom: 1px solid var(--bc-border-light); padding: 1.15rem 1.4rem; }
.modal-header .modal-title { font-weight: 700; letter-spacing: -0.01em; }
.modal-footer { border-top: 1px solid var(--bc-border-light); padding: 1rem 1.4rem; }
.modal-body { padding: 1.4rem; }
.modal-header .btn-close { filter: none; }

/* ---------- 10. Alerts ---------- */
.alert {
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  padding: 0.85rem 1.1rem;
  position: relative;
  overflow: hidden;
}
.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
}
.alert-success { background: rgba(16,185,129,0.08); color: #047857; border-color: rgba(16,185,129,0.2); }
.alert-success::before { background: #10b981; }
.alert-danger { background: rgba(239,68,68,0.07); color: #b91c1c; border-color: rgba(239,68,68,0.18); }
.alert-danger::before { background: #ef4444; }
.alert-warning { background: rgba(245,158,11,0.08); color: #b45309; border-color: rgba(245,158,11,0.2); }
.alert-warning::before { background: #f59e0b; }
.alert-info { background: rgba(6,182,212,0.07); color: #0e7490; border-color: rgba(6,182,212,0.18); }
.alert-info::before { background: #06b6d4; }
[data-bs-theme="dark"] .alert-success { color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger { color: #fca5a5; }
[data-bs-theme="dark"] .alert-warning { color: #fcd34d; }
[data-bs-theme="dark"] .alert-info { color: #67e8f9; }

/* ---------- 11. Toasts ---------- */
.toast {
  border: 1px solid var(--bc-border);
  border-radius: 16px;
  background: var(--bc-surface);
  box-shadow: 0 18px 48px rgba(30,33,64,0.16);
  overflow: hidden;
}
.toast.show { animation: bcToastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes bcToastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ---------- 12. Nav tabs / pills ---------- */
.nav-pills .nav-link {
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--bc-text-secondary);
  padding: 0.5rem 1rem;
  transition: all var(--bc-transition-fast);
}
.nav-pills .nav-link:hover { background: rgba(99,102,241,0.07); color: var(--bc-primary); }
.nav-pills .nav-link.active {
  background: var(--bc-primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.32);
}
.nav-tabs { border-bottom-color: var(--bc-border-light); }
.nav-tabs .nav-link {
  border: none;
  color: var(--bc-text-secondary);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.6rem 1rem;
  position: relative;
}
.nav-tabs .nav-link::after {
  content: '';
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: -1px;
  height: 2.5px;
  border-radius: 4px 4px 0 0;
  background: var(--bc-primary-gradient);
  transform: scaleX(0);
  transition: transform var(--bc-transition);
}
.nav-tabs .nav-link:hover { color: var(--bc-primary); }
.nav-tabs .nav-link.active { color: var(--bc-primary); font-weight: 700; }
.nav-tabs .nav-link.active::after { transform: scaleX(1); }

/* ---------- 13. Progress ---------- */
.progress {
  background: var(--bc-surface-3);
  border-radius: 999px;
  height: 8px;
}
.progress-bar {
  background: var(--bc-primary-gradient);
  border-radius: 999px;
}

/* ---------- 14. Lists ---------- */
.list-group-item {
  background: transparent;
  border-color: var(--bc-border-light);
  color: var(--bc-text);
  padding: 0.85rem 1.1rem;
  transition: background-color var(--bc-transition-fast);
}
.list-group-item:first-child { border-radius: 14px 14px 0 0; }
.list-group-item:last-child { border-radius: 0 0 14px 14px; }
.list-group-item:hover { background: rgba(99,102,241,0.03); }
.list-group-item.active { background: var(--bc-primary-soft); border-color: var(--bc-border); color: var(--bc-primary-dark); }

/* ---------- 15. Sidebar refinements ---------- */
.bc-sidebar::-webkit-scrollbar { width: 4px; }
.bc-sidebar-item {
  border-radius: 11px;
  margin: 2px 10px;
  padding: 0.58rem 0.85rem;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--bc-text-secondary);
  display: flex;
  align-items: center;
  gap: 11px;
  position: relative;
  transition: all var(--bc-transition-fast);
}
.bc-sidebar-item i { font-size: 1.05rem; width: 20px; text-align: center; transition: transform var(--bc-transition-fast); }
.bc-sidebar-item:hover {
  background: rgba(99,102,241,0.07);
  color: var(--bc-primary);
  transform: translateX(3px);
}
.bc-sidebar-item:hover i { transform: scale(1.15); }
.bc-sidebar-item.active {
  background: var(--bc-primary-soft);
  color: var(--bc-primary-dark);
  font-weight: 700;
}
.bc-sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 20%;
  bottom: 20%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--bc-primary-gradient);
  box-shadow: 0 0 12px rgba(99,102,241,0.55);
}
[data-bs-theme="dark"] .bc-sidebar-item.active { color: #a5b4fc; }

.bc-sidebar-section {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bc-text-muted);
  padding: 1rem 1.2rem 0.4rem;
}

/* ---------- 16. Topbar refinements ---------- */
.bc-topbar {
  box-shadow: 0 1px 0 var(--bc-border-light), 0 8px 32px rgba(30,33,64,0.05);
}
.bc-topbar-btn {
  position: relative;
}
.bc-topbar-btn:hover { transform: translateY(-1px); }
.bc-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--bc-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
}
.bc-clock i { color: var(--bc-primary); font-size: 0.85rem; }

/* ---------- 17. Back to top ---------- */
.bc-back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: var(--bc-primary-gradient);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 10px 26px rgba(99,102,241,0.4);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bc-back-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.bc-back-top:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(99,102,241,0.5); }

/* ---------- 18. Stat cards & quick actions (Clean 2D elevation) ---------- */
.bc-stat-card {
  transform: translateY(0);
  transition: transform var(--bc-transition), box-shadow var(--bc-transition);
}
.bc-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -4px rgba(14, 165, 233, 0.12), 0 4px 12px rgba(15, 23, 42, 0.04);
}
.bc-stat-card .stat-icon {
  transition: transform var(--bc-transition-bounce);
}
.bc-stat-card:hover .stat-icon {
  transform: scale(1.08);
}

.bc-quick-action {
  transition: transform var(--bc-transition), box-shadow var(--bc-transition), border-color var(--bc-transition);
}
.bc-quick-action:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 34px rgba(99,102,241,0.16);
}

/* ---------- 19. Empty states ---------- */
.bc-empty-state .empty-icon {
  animation: bcFloatY 3.2s ease-in-out infinite;
}
@keyframes bcFloatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------- 20. Auth pages ---------- */
.bc-login-page .card, .bc-login-page .bc-stat-card,
.bc-login-page .bc-quick-action, .bc-login-page .bc-page-header { animation: none; }

/* ---------- 21. Print ---------- */
@media print {
  .bc-back-top, .bc-bottom-nav { display: none !important; }
  .card { box-shadow: none !important; }
  .card:hover { transform: none; }
}

/* ---------- 22. Misc helpers ---------- */
.text-gradient {
  background: linear-gradient(135deg, #4f46e5 0%, #a855f7 60%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.divider-glow {
  height: 1px;
  border: none;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.3), rgba(6,182,212,0.3), transparent);
}

/* -- Mobile touch targets (44px minimum) -- */
@media (max-width: 575.98px) {
  .btn,
  .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
  .bc-sidebar-item,
  .bc-bottom-nav-item,
  .dropdown-item,
  .page-link,
  .bc-breadcrumb a {
    min-height: 44px;
  }
}
