/* ─────────────────────────────────────────────────────────────────
   Docioo — Main Stylesheet
   Design: Clean Medical SaaS, Orange-Teal gradient, Plus Jakarta Sans
   ───────────────────────────────────────────────────────────────── */

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-body {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: linear-gradient(180deg, #fff8f0 0%, #fff3e0 50%, #fde68a20 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 0;
}

.sidebar-nav { flex: 1; padding: 0 12px; }

.sidebar-section {
  margin-top: 18px;
}

.sidebar-section-label {
  padding: 0 14px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #374151;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  text-decoration: none;
}

.sidebar-item:hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary-dark);
}

.sidebar-item.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 40%, transparent);
}

.sidebar-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: white;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  box-shadow: var(--shadow-sm);
}

.sidebar-user-info { overflow: hidden; }
.user-name-small { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 89;
  backdrop-filter: blur(2px);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  min-height: calc(100vh - var(--header-h));
  transition: margin-left .3s;
}

/* ── Header elements ───────────────────────────────────────────── */
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }

.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-text { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-img { height: 36px; width: auto; border-radius: 6px; object-fit: contain; }
.docioo-logo { display: block; max-width: 100%; object-fit: contain; }

.header-nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.nav-link { padding: 6px 14px; border-radius: 99px; font-size: 0.88rem; font-weight: 500; color: var(--text-muted); transition: var(--transition); }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary-dark); font-weight: 600; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

.badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 18px; height: 18px;
  background: #ef4444; color: white;
  border-radius: 99px; font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.notification-dropdown { position: relative; }
.notification-btn--urgent svg { animation: bell-ring 1.2s ease-in-out infinite; transform-origin: top center; }
@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
}

.notification-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(380px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 220;
  overflow: hidden;
}
.notification-panel-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notification-panel-body { max-height: 360px; overflow-y: auto; }
.notification-empty { padding: 28px 16px; text-align: center; }
.notification-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 16px; border: none; background: transparent;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: var(--transition);
}
.notification-item:hover { background: var(--bg); }
.notification-item:last-child { border-bottom: none; }
.notification-item-title { font-size: .86rem; font-weight: 700; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.notification-item-msg { font-size: .8rem; color: var(--text-muted); margin: 0; line-height: 1.45; }
.notification-priority {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px;
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
}
.notification-priority--urgent { background: #fee2e2; color: #991b1b; }
.notification-priority--high { background: #ffedd5; color: #9a3412; }
.notification-priority--normal { background: #dbeafe; color: #1d4ed8; }

.profile-dropdown { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); cursor: pointer;
  font-size: 0.85rem; font-weight: 500; color: var(--text);
  transition: var(--transition);
}
.profile-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }

.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 200;
}

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: 0.88rem; color: var(--text);
  cursor: pointer; transition: var(--transition);
  background: none; border: none; width: 100%; text-align: left;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.text-danger { color: #ef4444; }
.dropdown-item.text-danger:hover { background: #fef2f2; }

/* ── Avatar ────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box;
  min-height: 36px; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.8125rem; font-weight: 600; font-family: inherit;
  border: 1.5px solid transparent; cursor: pointer;
  transition: var(--transition);
  white-space: nowrap; text-decoration: none;
  line-height: 1.2; vertical-align: middle;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 45%, transparent);
}

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.rs-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}
.rs-slot-btn {
  padding: 9px 14px;
  border: 1.5px solid color-mix(in srgb, var(--primary) 55%, #e2e8f0);
  border-radius: 999px;
  background: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  color: var(--primary);
}
.rs-slot-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark, #c2410c);
  background: color-mix(in srgb, var(--primary) 14%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.rs-slot-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 40%, transparent);
}
.rs-slot-btn.selected:hover {
  background: var(--primary-dark, #ea580c);
  border-color: var(--primary-dark, #ea580c);
  color: #fff;
}

.btn-ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: #cbd5e1; }

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

.btn-success { background: #22c55e; color: white; border-color: #22c55e; }
.btn-success:hover { background: #16a34a; border-color: #16a34a; }

.btn-sm {
  min-height: 36px; padding: 8px 14px; font-size: 0.78rem;
}
.btn-lg { min-height: 44px; padding: 12px 28px; font-size: 1rem; }
.btn-icon {
  width: 36px; height: 36px; min-height: 36px; padding: 0;
  border-radius: var(--radius-sm);
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.page-actions .btn,
.card-header .btn,
.data-table .btn,
.filter-form .btn,
.card-body > .form-row .btn,
.modal-footer .btn {
  min-height: 36px;
}
.btn.w-full { width: 100%; }

.filter-form,
.card-body > .form-row.filter-form {
  align-items: flex-end;
}
.filter-form .form-group,
.card-body > .form-row.filter-form .form-group {
  margin-bottom: 0;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-value { font-size: 2rem; font-weight: 800; font-family: 'Space Grotesk', sans-serif; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; margin-top: 4px; }
.stat-change {
  font-size: 0.75rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
}
.stat-change.up { background: #dcfce7; color: #166534; }
.stat-change.down { background: #fee2e2; color: #991b1b; }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.form-label .required { color: #ef4444; margin-left: 2px; }

.form-control {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
  line-height: 1.25;
}

input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
  min-height: 36px;
  line-height: 1.25;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-control.error { border-color: #ef4444; }
.form-error { font-size: 0.78rem; color: #ef4444; margin-top: 4px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  appearance: none;
  border-radius: 12px;
  min-height: 36px;
}

textarea.form-control { border-radius: 14px; resize: vertical; min-height: 90px; }

.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.input-group { display: flex; }
.input-group .form-control { border-radius: 99px 0 0 99px; flex: 1; }
.input-group .btn { border-radius: 0 99px 99px 0; }

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

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: left;
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ─────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.73rem; font-weight: 600;
  white-space: nowrap;
}
.status-badge::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.6; }

.badge-pending   { background:#fef9c3; color:#854d0e; }
.badge-confirmed { background:#dbeafe; color:#1d4ed8; }
.badge-checked_in { background:#e0e7ff; color:#3730a3; }
.badge-sample_collected { background:#ccfbf1; color:#0f766e; }
.badge-in_progress { background:#fce7f3; color:#9d174d; }
.badge-no_show { background:#f3f4f6; color:#374151; }
.badge-completed { background:#dcfce7; color:#166534; }
.badge-cancelled { background:#fee2e2; color:#991b1b; }
.badge-paid      { background:#dcfce7; color:#166534; }
.badge-partial   { background:#ffedd5; color:#9a3412; }
.badge-refunded  { background:#e0e7ff; color:#3730a3; }
.badge-unpaid    { background:#fef9c3; color:#854d0e; }

.apt-mode-badge.mode-video     { background:#ede9fe; color:#5b21b6; font-weight:700; }
.apt-mode-badge.mode-in-person { background:#dcfce7; color:#166534; }
.apt-mode-badge.mode-home      { background:#ffedd5; color:#9a3412; }

.data-table tbody tr.apt-row-video td { background: color-mix(in srgb, #ede9fe 28%, transparent); }
.data-table tbody tr.apt-row-video:hover td { background: color-mix(in srgb, #ede9fe 42%, transparent); }

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px;
}
.page-title { font-size: 1.6rem; font-weight: 800; }
.page-subtitle { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; align-items: center; }

/* ── Grid ──────────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border: 1px solid var(--border);
  max-width: 360px; min-width: 260px;
  animation: toast-in .3s ease;
}
@keyframes toast-in { from { transform: translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }
.toast-icon { width:20px; height:20px; flex-shrink:0; margin-top:1px; }
.toast-content .toast-title { font-weight:600; font-size:.875rem; }
.toast-content .toast-msg { font-size:.8rem; color:var(--text-muted); margin-top:2px; }
.toast.success .toast-icon { color:#22c55e; }
.toast.error   .toast-icon { color:#ef4444; }
.toast.warning .toast-icon { color:#f59e0b; }
.toast.info    .toast-icon { color:#0ea5e9; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in .2s ease;
}
.modal-backdrop.is-open { display: flex !important; }
.discount-modal-backdrop { z-index: 600; }
body.modal-open { overflow: hidden; }
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--surface);
  border-radius: 20px;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: slide-up .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slide-up { from { transform:translateY(40px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: 24px 28px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: var(--bg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px 28px; }
.modal-footer { padding: 0 28px 24px; display: flex; justify-content: flex-end; gap: 10px; }

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-large { width: 44px; height: 44px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Chart containers ──────────────────────────────────────────── */
.chart-container { position: relative; }

.revenue-breakdown-layout {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 240px;
}
.revenue-breakdown-chart {
  flex: 0 0 42%;
  max-width: 220px;
  height: 220px;
}
.revenue-breakdown-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.revenue-breakdown-legend__total {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.revenue-breakdown-legend__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
}
.revenue-breakdown-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  flex-shrink: 0;
}
.revenue-breakdown-legend__label {
  flex: 1;
  font-weight: 600;
  min-width: 0;
}
.revenue-breakdown-legend__amount {
  font-weight: 800;
  white-space: nowrap;
}
.revenue-breakdown-legend__pct {
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 2.75rem;
  text-align: right;
}

/* Daily credit usage bar chart (/credits) */
.credit-usage-chart {
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-height: 132px;
}
.credit-usage-chart--loading {
  align-items: center;
  justify-content: center;
}
.credit-usage-chart__placeholder {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  padding: 36px 0;
}
.credit-usage-chart__y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  min-width: 1.75rem;
  padding-bottom: 24px;
  font-size: .65rem;
  line-height: 1;
  color: var(--text-muted);
  text-align: right;
}
.credit-usage-chart__plot {
  flex: 1;
  min-width: 0;
}
.credit-usage-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 96px;
  padding: 6px 4px 0 8px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.credit-usage-chart__col {
  flex: 1;
  min-width: 4px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}
.credit-usage-chart__fill {
  width: 100%;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  transition: opacity .15s ease;
}
.credit-usage-chart__col:hover .credit-usage-chart__fill { opacity: .85; }
.credit-usage-chart__dates {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-left: 8px;
  font-size: .7rem;
  line-height: 1.2;
  color: var(--text-muted);
}

/* ── Payment Modal styles ──────────────────────────────────────── */
.payment-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.payment-method-btn {
  padding: 16px 12px; border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface); cursor: pointer;
  text-align: center; transition: var(--transition);
}
.payment-method-btn:hover, .payment-method-btn.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, white);
}
.payment-method-btn svg { width:28px; height:28px; margin-bottom:6px; color: var(--primary); }
.payment-method-btn span { display:block; font-size:.8rem; font-weight:600; }

.qr-container { text-align: center; padding: 20px; }
#qr-code-display canvas, #qr-code-display img { max-width: 200px; margin: 0 auto; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }

/* ── Search ────────────────────────────────────────────────────── */
.search-box { position: relative; }
.search-box input { padding-left: 40px; }
.search-box .search-icon,
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px !important;
  height: 16px !important;
  max-width: 16px;
  max-height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

/* ── Input icons & affix buttons ───────────────────────────────── */
.input-icon { position: relative; }
.input-icon svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px !important;
  height: 16px !important;
  max-width: 16px;
  max-height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.input-icon .form-control { padding-left: 40px; }

.input-affix { position: relative; }
.input-affix .form-control { padding-right: 44px; }
.input-affix .affix-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-affix .affix-btn svg {
  width: 18px !important;
  height: 18px !important;
  display: block;
  flex-shrink: 0;
}

.btn svg,
.sidebar-item svg,
.page-actions .btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px; font-size:.875rem; font-weight:600;
  color: var(--text-muted); border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: .9rem; margin-bottom: 24px; }

/* ── Loading skeleton ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; }
.skeleton-card { height: 120px; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 95; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .desktop-only { display: none !important; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .payment-methods { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .payment-methods { grid-template-columns: 1fr; }
  .modal { border-radius: 16px 16px 0 0; margin-top: auto; margin-bottom: 0; max-height: 85vh; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

/* ── Utility ───────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .82rem; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Page transition ───────────────────────────────────────────── */
.page-view { animation: page-enter .25s ease; }
@keyframes page-enter { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── Scrollable table page (header/filters fixed, table body scrolls) ─ */
body:has(.page-view--scroll-table) { overflow: hidden; }

body:has(.page-view--scroll-table) .app-body {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

body:has(.page-view--scroll-table) .main-content {
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.page-view--scroll-table {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.page-view--scroll-table .page-header,
.page-view--scroll-table .page-filters,
.page-view--scroll-table .page-tabs {
  flex-shrink: 0;
}

/* Nested tab panels (e.g. Inventory Stock/Discount) must continue the flex chain
   or the table is clipped with body overflow:hidden and no scrollbar. */
.page-view--scroll-table .scroll-table-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-view--scroll-table .table-card-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}

.page-view--scroll-table .table-card-scroll .table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.page-view--scroll-table .table-card-scroll .card-footer {
  flex-shrink: 0;
}

.page-view--scroll-table .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── OTP Input ─────────────────────────────────────────────────── */
.otp-inputs { display: flex; gap: 10px; justify-content: center; }
.otp-input {
  width: 52px; height: 58px;
  text-align: center; font-size: 1.5rem; font-weight: 700;
  border: 2px solid var(--border); border-radius: 12px;
  outline: none; transition: var(--transition);
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }

/* ── Auth page ─────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-left {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px; color: white;
}
.auth-right { display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-logo {
  height: 48px; width: auto; max-width: 220px;
  margin-bottom: 12px; object-fit: contain;
}
.auth-tagline { font-size: 1.1rem; opacity: .85; margin-bottom: 40px; }
.auth-features { list-style: none; }
.auth-features li { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: .95rem; }
.auth-features li::before { content: '✓'; background: rgba(255,255,255,.2); border-radius:50%; width:24px; height:24px; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; }

@media (max-width:768px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; }
}

/* ── Coupon cards (booking + discount modal) ───────────────────── */
.coupon-list { display:flex; flex-direction:column; gap:10px; }
.coupon-card {
  display:flex; align-items:stretch; padding:14px 16px;
  border:1.5px solid var(--border); border-radius:12px; background:#fff;
  transition:border-color .15s, box-shadow .15s, background .15s;
}
.coupon-card--applied {
  border-color:var(--primary);
  background:color-mix(in srgb, var(--primary) 5%, #fff);
  box-shadow:0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}
.coupon-card--ineligible { opacity:.55; }
.coupon-card input[type=checkbox] { position:absolute; opacity:0; pointer-events:none; width:0; height:0; }
.coupon-card__main { display:flex; align-items:center; gap:14px; flex:1; min-width:0; }
.coupon-card__body { flex:1; min-width:0; }
.coupon-card__code { font-weight:800; font-size:.95rem; letter-spacing:.3px; line-height:1.3; }
.coupon-card__save { font-weight:700; font-size:.85rem; color:#16a34a; margin-top:4px; }
.coupon-card__desc { font-size:.78rem; color:var(--text-muted); margin-top:4px; line-height:1.4; }
.coupon-card__terms-link {
  display:inline-block; margin-top:6px; padding:0; border:none; background:none;
  font-size:.72rem; font-weight:600; color:var(--primary); cursor:pointer; text-decoration:underline;
}
.coupon-card__terms-link:hover { color:var(--primary-dark, var(--primary)); }
.coupon-card__terms {
  display:none; margin-top:6px; padding:8px 10px; border-radius:8px;
  background:color-mix(in srgb, var(--text-muted) 6%, #fff);
  font-size:.72rem; color:var(--text-muted); line-height:1.45;
}
.coupon-card__terms.is-open { display:block; }
.coupon-card__hint { font-size:.72rem; color:#b45309; margin-top:4px; line-height:1.35; }
.coupon-card__apply {
  flex-shrink:0; align-self:center; padding:8px 16px; border:none; border-radius:8px;
  background:var(--primary); color:#fff; font-size:.8rem; font-weight:700;
  cursor:pointer; white-space:nowrap; transition:background .15s, opacity .15s;
}
.coupon-card__apply:hover:not(:disabled) { background:var(--primary-dark, #1d4ed8); }
.coupon-card__apply:disabled { opacity:.45; cursor:not-allowed; }
.coupon-card__apply--applied { background:#fff; color:var(--primary); border:1.5px solid var(--primary); }
.coupon-card__apply--applied:hover:not(:disabled) { background:color-mix(in srgb, var(--primary) 8%, #fff); }

/* Applied discount chips on appointments list */
.discount-chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.discount-chip {
  display:inline-flex; align-items:center; padding:2px 8px; border-radius:999px;
  font-size:.68rem; font-weight:700; line-height:1.4;
  background:#dcfce7; color:#166534; border:1px solid #bbf7d0;
}
.discount-modal-dialog { max-width:520px; }

/* GST breakup — respect [hidden] over flex layout (book form) */
.gst-breakup-card[hidden] { display: none !important; }

/* Doctor profile section tabs (Profile / Address / Website / Social) */
.profile-doctor-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.profile-doctor-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  color: var(--text, #334155);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
}

.profile-doctor-nav__link.is-active,
.profile-doctor-nav__link:hover {
  border-color: var(--accent, #6366f1);
  color: var(--accent, #6366f1);
  background: #f5f3ff;
  text-decoration: none;
}
