/* CadCan Client Portal Design System — portal.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --color-primary: #2F55D7;
  --color-primary-hover: #2445B5;
  --color-primary-light: #EEF2FF;
  --color-bg: #F4F6FB;
  --color-surface: #FFFFFF;
  --color-text: #1F1F2B;
  --color-text-secondary: #6B7280;
  --color-border: #E5E7EB;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #3B82F6;
  --color-sidebar-bg: #1a1f36;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --font-body: 'Inter', 'Lato', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
}

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--color-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar .logo-container {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .logo-img {
  height: 32px;
  width: auto;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.sidebar .nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar .nav-item.active {
  background: rgba(47,85,215,0.2);
  color: var(--color-primary);
  border-left: 3px solid var(--color-primary);
}

.sidebar .nav-item i { width: 20px; text-align: center; }

.sidebar .sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar .user-info {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}

.sidebar .office-info {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 12px;
}

.main-content {
  margin-left: 260px;
  padding: 32px;
  overflow-y: auto;
  min-height: 100vh;
}

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

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

.card-header .card-title {
  font-size: 18px;
  font-weight: 600;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.stat-card .stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.stat-card .stat-label {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
}

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

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

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

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

.btn-danger:hover {
  background: #DC2626;
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Tables */
.table-wrapper { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: #F9FAFB;
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-secondary);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
}

.data-table tr:nth-child(even) td { background: #FAFAFA; }
.data-table tr:hover td { background: #F0F4FF; }

/* Badges */
.badge {
  display: inline-block;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
}

.badge-pending    { background: #FEF3C7; color: var(--color-warning); }
.badge-in_progress { background: var(--color-primary-light); color: var(--color-primary); }
.badge-completed  { background: #D1FAE5; color: var(--color-success); }
.badge-on_hold     { background: #FEE2E2; color: var(--color-danger); }
.badge-rescan_needed { background: #FED7AA; color: #EA580C; }

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

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47,85,215,0.12);
}

.form-textarea { resize: vertical; min-height: 80px; }

/* Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title { font-size: 24px; font-weight: 700; }

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  min-height: 100vh;
  background: var(--color-bg);
}

.login-page .login-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-page .login-card .logo-img {
  display: block;
  height: 40px;
  width: auto;
  margin: 0 auto 8px;
}

.login-page .login-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-page .error-msg {
  background: #FEE2E2;
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}

/* Registration */
.register-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 8vh;
  padding-bottom: 8vh;
  min-height: 100vh;
  background: var(--color-bg);
}

.register-page .register-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 560px;
}

.register-page .register-card .logo-img {
  display: block;
  height: 40px;
  width: auto;
  margin: 0 auto 8px;
}

.register-page .error-msg {
  background: #FEE2E2;
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.register-page .form-section {
  margin-bottom: 8px;
}

.register-page .form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.register-page .required {
  color: var(--color-danger);
}

/* Toast */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1a1f36;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  min-width: 240px;
  max-width: 360px;
}

.toast.toast-success { background: var(--color-success); }
.toast.toast-error   { background: var(--color-danger); }
.toast.toast-info    { background: var(--color-info); }
.toast.toast-warning { background: var(--color-warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 32px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 20px; font-size: 20px; }

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.pagination .page-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 13px;
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--color-text-secondary);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--color-border);
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Case Wizard */
.wizard-container {
  max-width: 800px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  flex: 1;
}

.wizard-step::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.wizard-step:last-child::before { display: none; }

.wizard-step .step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-secondary);
  position: relative;
  z-index: 1;
}

.wizard-step.active .step-circle {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.wizard-step.completed .step-circle {
  border-color: var(--color-success);
  background: var(--color-success);
  color: #fff;
}

.wizard-step .step-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: center;
}

.wizard-step.active .step-label {
  color: var(--color-primary);
  font-weight: 600;
}

.wizard-content {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 32px;
  margin-bottom: 24px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* File Upload */
.file-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--color-text-secondary);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.file-drop-zone i {
  font-size: 32px;
  margin-bottom: 8px;
}

.file-list {
  list-style: none;
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #F9FAFB;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.file-item i { color: var(--color-primary); }

.file-item .file-name { flex: 1; }

.file-item .file-remove {
  color: var(--color-danger);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

/* Prescription form */
.prescription-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.tooth-chart {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.tooth-chart .tooth-btn {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

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

.tooth-chart .tooth-btn:hover:not(.selected) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Rx radio pills — used by nightguard renderer (inline) AND crown renderer */
.rx-radio-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.rx-radio-pill { padding: 0.4rem 1rem; border: 2px solid var(--color-border); border-radius: 20px; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--color-text); transition: border-color 0.15s, background 0.15s; user-select: none; text-align: center; }
.rx-radio-pill:hover { border-color: var(--color-primary); background: var(--color-bg); }
.rx-radio-pill.selected { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.rx-radio-pill span { display: block; font-size: 0.7rem; color: var(--color-text-secondary); font-weight: 400; margin-top: 1px; }
.rx-slider-wrap { display: flex; align-items: center; gap: 0.5rem; }
.rx-slider-wrap input[type=range] { flex: 1; accent-color: var(--color-primary); }
.rx-slider-val { font-weight: 600; font-size: 0.95rem; color: var(--color-primary); min-width: 3rem; text-align: right; }

/* Crown / Inlay prescription styles */

.crown-tooth-chart {
  margin-top: 8px;
  overflow-x: auto;
}

.crown-arch-row {
  display: flex;
  flex-direction: row;
  gap: 4px;
  flex-wrap: nowrap;
}

.crown-arch-row .tooth-btn {
  flex: 1 1 0;
  min-width: 28px;
  padding: 6px 2px;
  font-size: 11px;
}

.crown-arch-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.crown-tooth-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: 12px;
  overflow: hidden;
}

.crown-tooth-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-surface-alt, #f8fafc);
  border-bottom: 1px solid var(--color-border);
}

.crown-tooth-card-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.crown-tooth-card-body {
  padding: 14px;
}

.crown-advanced-toggle {
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.crown-advanced-fields {
  margin-top: 8px;
}

/* Crown sub-page: Add Crown / Inlay flow */
.crown-add-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.crown-subpage-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.5rem;
}

.crown-subpage-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
}

.crown-subpage-empty {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0.5rem 0;
}

.crown-subpage-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tooth-btn-sub.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Shared prescription form layout */
.rx-form-grid { display: flex; flex-direction: column; gap: 1.1rem; max-width: 560px; }
.rx-arch-banner {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--color-primary-light); border-left: 3px solid var(--color-primary);
  padding: 0.6rem 1rem; border-radius: 4px; margin-bottom: 0.5rem;
  font-size: 0.875rem; color: var(--color-primary); font-weight: 500;
}
.rx-section-divider { border: none; border-top: 1px solid var(--color-border); margin: 0.4rem 0 0.2rem; }
.rx-return-date-stack { display: flex; flex-direction: column; gap: 0.5rem; }
.rx-rush-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 1rem; border: 2px solid var(--color-border);
  border-radius: 20px; cursor: pointer; font-size: 0.9rem; font-weight: 500;
  color: var(--color-text); background: var(--color-surface);
  transition: border-color 0.15s, background 0.15s; user-select: none; width: fit-content;
}
.rx-rush-btn:hover { border-color: var(--color-primary); background: var(--color-bg); }
.rx-rush-btn.selected { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: 20px;
  transition: 0.2s;
}
.switch input:checked + .switch-slider {
  background: var(--color-primary);
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar .logo-container .logo-img,
  .sidebar .nav-item span { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 14px; }
  .sidebar { width: 72px; }
  .main-content { margin-left: 72px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
  }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .prescription-grid { grid-template-columns: 1fr; }
  .wizard-steps { flex-wrap: wrap; gap: 16px; }
  .wizard-step::before { display: none; }
  .login-page .login-card,
  .register-card { max-width: 100% !important; }
}

/* Utilities */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.hidden { display: none; }

/* ============================================================
   LOGIN PAGE UX UPGRADE — April 2026
   ============================================================ */

.login-page {
  background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 50%, #f0f4ff 100%);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.login-page .login-card {
  animation: card-entrance 0.4s ease-out;
}

@keyframes card-entrance {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-page .login-card .logo-img {
  animation: logo-entrance 0.5s ease-out 0.15s both;
}

@keyframes logo-entrance {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.login-tagline {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 15px;
  margin: -4px 0 32px 0;
  letter-spacing: 0.01em;
}

/* Input with left icon */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--color-text-secondary);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.form-input.has-icon {
  padding-left: 42px;
}

.form-input.has-toggle {
  padding-right: 44px;
}

/* Password visibility toggle */
.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  border-radius: 4px;
}

.password-toggle:hover {
  opacity: 1;
  background: rgba(0,0,0,0.04);
}

/* Remember me row */
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  margin: 28px 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.login-divider span {
  padding: 0 16px;
}

/* Security note */
.security-note {
  margin-top: 28px;
  color: var(--color-text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.security-note i {
  color: var(--color-success);
  font-size: 14px;
}

/* Enhanced primary button */
.login-page .btn-primary {
  background: linear-gradient(135deg, #3B6AE8 0%, var(--color-primary) 100%);
  box-shadow: 0 4px 14px rgba(47, 85, 215, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-page .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(47, 85, 215, 0.45);
}

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

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Button loading spinner */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Success message */
.success-msg {
  background: #D1FAE5;
  color: #059669;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Forgot password card helpers */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  margin-bottom: 20px;
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--color-primary-hover); }
.forgot-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.forgot-subtitle { color: var(--color-text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ============================================================
   DASHBOARD UX UPGRADE — April 2026
   ============================================================ */

/* Personalized header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 24px;
}

.dashboard-greeting h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.dashboard-context {
  color: var(--color-text-secondary);
  font-size: 15px;
  margin: 0;
}

/* Enhanced stat cards with icons */
.stats-grid-enhanced {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card-enhanced {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.stat-card-enhanced:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon-pending  { background: #FEF3C7; color: #D97706; }
.stat-icon-progress { background: #DBEAFE; color: #2563EB; }
.stat-icon-completed{ background: #D1FAE5; color: #059669; }

.stat-content { flex: 1; }

/* Section header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 18px; font-weight: 600; margin: 0; }

/* Filter group grow */
.filter-group-grow { flex: 1; min-width: 200px; }

/* Enhanced empty state */
.empty-state-enhanced { padding: 64px 40px; }

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
}

.empty-state-icon i { font-size: 36px; color: var(--color-primary); opacity: 0.8; }

/* dashboard-page wrapper */
.dashboard-page { padding: 0; }

@media (max-width: 768px) {
  .stats-grid-enhanced { grid-template-columns: repeat(2, 1fr); }
  .dashboard-header { flex-direction: column; align-items: stretch; }
  .dashboard-greeting h1 { font-size: 22px; }
}

/* ============================================================
   BILLING PAGE — Redesign April 2026
   ============================================================ */

.billing-page {
  max-width: 860px;
}

.billing-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.billing-page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.billing-page-title i {
  color: var(--color-primary);
}

.billing-page-subtitle {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin: 0;
}

.billing-section {
  margin-bottom: 28px;
}

.billing-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.billing-section-label i {
  color: var(--color-primary);
  font-size: 12px;
}

/* ── Statement card ─────────────────────────────────────── */

.statement-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.statement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: linear-gradient(135deg, #1a1f36 0%, #2F55D7 100%);
  color: #fff;
}

.statement-header-period {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.65;
  margin-bottom: 4px;
}

.statement-header-range {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.statement-header-badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-lg);
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

/* Statement table */
.statement-table {
  width: 100%;
  border-collapse: collapse;
}

.statement-table thead th {
  padding: 10px 28px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary);
  background: #F9FAFB;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.statement-table thead th.st-num,
.statement-table thead th.st-amount {
  text-align: right;
}

.statement-table tbody td {
  padding: 14px 28px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 14px;
  color: var(--color-text);
}

.statement-table tbody tr:last-child td { border-bottom: none; }
.statement-table tbody tr:hover td { background: #F8FAFF; }

.statement-table .st-service { font-weight: 500; }
.statement-table .st-num  { text-align: right; color: var(--color-text-secondary); }
.statement-table .st-amount { text-align: right; font-weight: 500; }

.statement-table tfoot { border-top: 2px solid var(--color-border); }

.st-foot-row td { padding: 11px 28px; background: #F9FAFB; }
.st-foot-label { color: var(--color-text-secondary); font-size: 13px; text-align: right; }
.st-foot-val   { text-align: right; color: var(--color-text-secondary); font-size: 13px; }

.st-total-row td {
  padding: 16px 28px;
  background: var(--color-primary-light);
  border-top: 1px solid rgba(47,85,215,0.12);
}

.st-total-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: right;
}

.st-total-val {
  text-align: right;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

.st-currency {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.6;
  letter-spacing: 0.04em;
}

/* Statement empty / issued / note */
.statement-empty {
  padding: 48px 28px;
  text-align: center;
}

.statement-empty-icon {
  width: 56px;
  height: 56px;
  background: #D1FAE5;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  color: var(--color-success);
}

.statement-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.statement-empty-sub {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.statement-issued-notice {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  background: var(--color-primary-light);
}

.statement-issued-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.statement-issued-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 3px;
}

.statement-issued-sub {
  font-size: 13px;
  color: var(--color-primary);
  opacity: 0.8;
}

.statement-footer-note {
  padding: 12px 28px;
  background: #F9FAFB;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}

.statement-footer-note i { color: var(--color-primary); opacity: 0.6; flex-shrink: 0; }

/* ── Invoice list card ──────────────────────────────────── */

.invoice-list-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
}

.inv-table thead th {
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary);
  background: #F9FAFB;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

.inv-table thead th.inv-amount-cell,
.inv-table thead th.inv-dl-cell {
  text-align: right;
}

.inv-table tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 14px;
  vertical-align: middle;
}

.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table tbody tr.inv-row:hover td { background: #F8FAFF; cursor: default; }
.inv-table tbody tr.inv-row-void td { opacity: 0.45; }

.inv-period {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.inv-number {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: #F3F4F6;
  color: var(--color-text-secondary);
  padding: 3px 9px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.inv-amount-cell {
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.inv-curr {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
}

.inv-dl-cell { text-align: right; white-space: nowrap; }

/* Status badges */
.inv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  white-space: nowrap;
}

.inv-badge i { font-size: 11px; }

.inv-badge-paid    { background: #D1FAE5; color: #059669; }
.inv-badge-sent    { background: #DBEAFE; color: #2563EB; }
.inv-badge-overdue { background: #FEE2E2; color: #DC2626; }
.inv-badge-void    { background: #F3F4F6; color: #9CA3AF; }
.inv-badge-draft   { background: #FEF3C7; color: #D97706; }

/* Download button */
.btn-inv-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-inv-pdf:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(47,85,215,0.28);
}

.btn-inv-pdf i { font-size: 11px; }

.inv-pdf-pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #FEF3C7;
  color: #D97706;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 500;
}

/* Empty state */
.inv-empty {
  padding: 56px 28px;
  text-align: center;
}

.inv-empty-icon {
  width: 64px;
  height: 64px;
  background: var(--color-primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 28px;
  color: var(--color-primary);
  opacity: 0.7;
}

.inv-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.inv-empty-sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Pagination */
.inv-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: #FAFAFA;
}

.inv-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.inv-page-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.inv-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.inv-page-info { font-size: 13px; color: var(--color-text-secondary); }

/* Error state */
.billing-error-state {
  padding: 32px;
  text-align: center;
  color: var(--color-danger);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Skeleton shimmer */
.skeleton-shimmer {
  background: linear-gradient(90deg, #F3F4F6 25%, #E9EAEC 50%, #F3F4F6 75%);
  background-size: 200% 100%;
  animation: billing-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes billing-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
