/**
 * KlientHub Frontend Application Stylesheet
 *
 * Polished, professional dental business application aesthetic with
 * consistent typography, clean cards, multi-page navigation, internal
 * settings tabs, and responsive grids.
 *
 * @author    Unimke Abana <https://brandloci.com>
 * @copyright 2026 KlientHub / BrandLoci
 * @link      https://brandloci.com
 */

/* ==========================================================================
   1. Base Reset & Container
   ========================================================================== */
.kh-container {
  font-family: var(--kh-font-sans);
  color: var(--kh-text-main);
  background-color: var(--kh-bg-main);
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
  border-radius: var(--kh-radius-lg);
  line-height: 1.5;
}

.kh-container *,
.kh-container *::before,
.kh-container *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   2. Top Practice Bar & Multi-Page Navigation
   ========================================================================== */
.kh-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--kh-surface);
  padding: 18px 24px;
  border-radius: var(--kh-radius-md);
  border: 1px solid var(--kh-border);
  box-shadow: var(--kh-shadow-sm);
  margin-bottom: 14px;
}

.kh-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kh-brand-logo {
  width: 46px;
  height: 46px;
  border-radius: var(--kh-radius-sm);
  background: linear-gradient(135deg, var(--kh-primary), var(--kh-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  box-shadow: var(--kh-shadow-sm);
}

.kh-brand-title {
  font-family: var(--kh-font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--kh-text-main);
  margin: 0;
  line-height: 1.2;
}

.kh-brand-subtitle {
  font-size: 0.82rem;
  color: var(--kh-text-muted);
  display: block;
  margin-top: 2px;
}

.kh-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kh-wallet-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--kh-surface-alt);
  padding: 8px 16px;
  border-radius: var(--kh-radius-md);
  border: 1px solid var(--kh-border);
  cursor: pointer;
  transition: border-color var(--kh-transition);
}

.kh-wallet-pill:hover {
  border-color: var(--kh-primary);
}

.kh-wallet-pill-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-text-muted);
  font-weight: 700;
  display: block;
}

.kh-wallet-pill-amount {
  font-family: var(--kh-font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--kh-primary);
}

/* Dedicated Multi-Page Horizontal Navigation Bar */
.kh-page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--kh-surface);
  padding: 8px 12px;
  border-radius: var(--kh-radius-md);
  border: 1px solid var(--kh-border);
  box-shadow: var(--kh-shadow-sm);
  margin-bottom: 24px;
  overflow-x: auto;
}

.kh-page-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--kh-radius-sm);
  color: var(--kh-text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: all var(--kh-transition);
}

.kh-page-nav-link:hover {
  background: var(--kh-surface-alt);
  color: var(--kh-text-main);
}

.kh-page-nav-link.active {
  background: var(--kh-primary);
  color: #ffffff;
  box-shadow: var(--kh-shadow-sm);
}

.kh-nav-badge {
  background: var(--kh-surface-alt);
  color: var(--kh-text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--kh-radius-full);
}

.kh-page-nav-link.active .kh-nav-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.kh-nav-badge-alert {
  background: var(--kh-danger) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   3. Page Sections & KPI Stat Cards
   ========================================================================== */
.kh-main-content {
  min-width: 0;
}

.kh-page-section {
  animation: khFadeIn 0.2s ease-out;
}

@keyframes khFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.kh-section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.kh-section-title {
  font-family: var(--kh-font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  color: var(--kh-text-main);
}

.kh-section-subtitle {
  font-size: 0.9rem;
  color: var(--kh-text-muted);
  margin: 4px 0 0 0;
}

/* 5-Card Dashboard KPI Grid */
.kh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kh-kpi-grid-five {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1200px) {
  .kh-kpi-grid-five {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .kh-kpi-grid-five {
    grid-template-columns: 1fr;
  }
}

.kh-kpi-card {
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  padding: 20px;
  box-shadow: var(--kh-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--kh-transition), box-shadow var(--kh-transition), border-color var(--kh-transition);
}

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

.kh-kpi-card-highlight {
  background: linear-gradient(180deg, var(--kh-card-bg) 0%, var(--kh-primary-light) 100%);
  border-color: var(--kh-primary-border);
}

.kh-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kh-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--kh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kh-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--kh-radius-sm);
  background: var(--kh-primary-light);
  color: var(--kh-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.kh-kpi-value {
  font-family: var(--kh-font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--kh-text-main);
  line-height: 1.15;
}

.kh-kpi-trend {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--kh-text-muted);
  font-weight: 500;
}

/* Panel Cards & Category Summary Cards */
.kh-panel-card {
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  padding: 24px;
  box-shadow: var(--kh-shadow-sm);
}

.kh-panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--kh-border);
}

.kh-panel-card-header h3 {
  margin: 0;
  font-family: var(--kh-font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--kh-text-main);
}

.kh-category-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.kh-cat-summary-card {
  background: var(--kh-surface-alt);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all var(--kh-transition);
}

.kh-cat-summary-card:hover {
  border-color: var(--kh-primary);
  background: var(--kh-card-bg);
  box-shadow: var(--kh-shadow-sm);
}

.kh-cat-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kh-cat-summary-top strong {
  font-size: 1rem;
  color: var(--kh-text-main);
}

.kh-cat-price-tag {
  background: var(--kh-primary-light);
  color: var(--kh-primary);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: var(--kh-radius-full);
}

.kh-cat-summary-card p {
  font-size: 0.84rem;
  color: var(--kh-text-muted);
  margin: 0 0 12px 0;
}

.kh-cat-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--kh-primary);
}

/* ==========================================================================
   4. Marketplace Filters & Patient Cards
   ========================================================================== */
.kh-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.kh-cat-pill {
  padding: 10px 18px;
  border-radius: var(--kh-radius-full);
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  color: var(--kh-text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--kh-transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kh-cat-pill:hover {
  border-color: var(--kh-primary);
  color: var(--kh-primary);
}

.kh-cat-pill.active {
  background: var(--kh-primary);
  color: #ffffff;
  border-color: var(--kh-primary);
  box-shadow: var(--kh-shadow-sm);
}

.kh-cat-pill .kh-price {
  font-size: 0.75rem;
  opacity: 0.85;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
}

.kh-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--kh-surface);
  padding: 16px 20px;
  border-radius: var(--kh-radius-md);
  border: 1px solid var(--kh-border);
  margin-bottom: 20px;
}

.kh-search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.kh-search-input,
.kh-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--kh-border);
  background: var(--kh-input-bg);
  color: var(--kh-text-main);
  font-size: 0.9rem;
  font-family: var(--kh-font-sans);
  transition: border-color var(--kh-transition);
}

.kh-search-box .kh-search-input {
  padding-left: 38px;
}

.kh-search-input:focus,
.kh-input:focus,
.kh-select:focus {
  outline: none;
  border-color: var(--kh-primary);
  box-shadow: 0 0 0 3px var(--kh-primary-light);
}

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

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

.kh-select {
  padding: 10px 14px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--kh-border);
  background: var(--kh-input-bg);
  color: var(--kh-text-main);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.kh-results-meta {
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--kh-text-muted);
}

/* Patient Cards Grid */
.kh-patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.kh-patient-card {
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  box-shadow: var(--kh-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--kh-transition);
  position: relative;
  overflow: hidden;
}

.kh-patient-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--kh-shadow-md);
  border-color: var(--kh-primary);
}

.kh-patient-card.selected {
  border: 2px solid var(--kh-primary);
  background: var(--kh-primary-light);
}

.kh-card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--kh-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.kh-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--kh-radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kh-badge-category {
  background: var(--kh-primary-light);
  color: var(--kh-primary);
}

.kh-badge-urgent {
  background: var(--kh-danger-bg);
  color: var(--kh-danger-text);
}

.kh-badge-verified {
  background: var(--kh-success-bg);
  color: var(--kh-success-text);
}

.kh-badge-claimed {
  background: var(--kh-warning-bg);
  color: var(--kh-warning-text);
}

.kh-card-select-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--kh-primary);
  cursor: pointer;
}

.kh-card-body {
  padding: 18px 20px;
  flex: 1;
}

.kh-patient-id {
  font-family: var(--kh-font-heading);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--kh-text-main);
  margin: 0 0 4px 0;
}

.kh-patient-location {
  font-size: 0.85rem;
  color: var(--kh-text-secondary);
  font-weight: 600;
  margin-bottom: 14px;
}

.kh-treatment-box {
  background: var(--kh-surface-alt);
  border-radius: var(--kh-radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 3px solid var(--kh-primary);
}

.kh-treatment-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-text-muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.kh-treatment-value {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--kh-text-main);
  margin: 0;
}

.kh-card-custom-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.kh-cf-pill,
.kh-inline-cf {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--kh-surface-alt);
  border: 1px solid var(--kh-border);
  color: var(--kh-text-secondary);
}

.kh-masked-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.8rem;
}

.kh-masked-item {
  display: flex;
  flex-direction: column;
}

.kh-masked-label {
  color: var(--kh-text-muted);
  font-size: 0.72rem;
}

.kh-masked-value {
  font-family: var(--kh-font-mono);
  color: var(--kh-text-secondary);
  font-weight: 600;
  background: var(--kh-surface-alt);
  padding: 3px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.kh-card-footer {
  padding: 14px 20px;
  background: var(--kh-surface-alt);
  border-top: 1px solid var(--kh-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.kh-price-block {
  display: flex;
  flex-direction: column;
}

.kh-price-label {
  font-size: 0.7rem;
  color: var(--kh-text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.kh-price-amount {
  font-family: var(--kh-font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--kh-text-main);
}

/* ==========================================================================
   5. Profile, Linked Locations & Internal Settings Tabs
   ========================================================================== */
.kh-profile-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 992px) {
  .kh-profile-grid {
    grid-template-columns: 1fr;
  }
}

.kh-form-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .kh-form-two-col {
    grid-template-columns: 1fr;
  }
}

.kh-field-group {
  margin-bottom: 14px;
}

.kh-field-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--kh-text-secondary);
  margin-bottom: 5px;
}

.kh-divider {
  border: none;
  border-top: 1px solid var(--kh-border);
  margin: 20px 0;
}

.kh-pref-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.kh-pref-checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--kh-border);
  background: var(--kh-surface-alt);
  cursor: pointer;
  transition: border-color var(--kh-transition);
}

.kh-pref-checkbox-card:hover {
  border-color: var(--kh-primary);
}

.kh-pref-checkbox-card strong {
  display: block;
  font-size: 0.85rem;
  color: var(--kh-text-main);
}

.kh-pref-checkbox-card span {
  font-size: 0.75rem;
  color: var(--kh-text-muted);
}

.kh-locations-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kh-location-item-card {
  padding: 16px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--kh-border);
  background: var(--kh-surface-alt);
}

.kh-location-item-card.primary {
  border-color: var(--kh-primary);
  background: var(--kh-primary-light);
}

.kh-location-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kh-location-item-meta {
  font-size: 0.84rem;
  color: var(--kh-text-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Internal Settings Tabs */
.kh-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--kh-border);
  padding-bottom: 10px;
}

.kh-settings-tab-btn {
  padding: 10px 18px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--kh-text-secondary);
  font-family: var(--kh-font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--kh-transition);
}

.kh-settings-tab-btn:hover {
  background: var(--kh-surface-alt);
  color: var(--kh-text-main);
}

.kh-settings-tab-btn.active {
  background: var(--kh-primary);
  color: #ffffff;
  box-shadow: var(--kh-shadow-sm);
}

.kh-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kh-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--kh-border);
  background: var(--kh-surface-alt);
  cursor: pointer;
}

.kh-toggle-item strong {
  display: block;
  font-size: 0.92rem;
  color: var(--kh-text-main);
  margin-bottom: 3px;
}

.kh-toggle-item span {
  display: block;
  font-size: 0.8rem;
  color: var(--kh-text-muted);
}

.kh-toggle-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--kh-primary);
  flex-shrink: 0;
}

/* Theme Visual Cards in Settings -> Display */
.kh-theme-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .kh-theme-selector-grid {
    grid-template-columns: 1fr;
  }
}

.kh-theme-option-card {
  border: 2px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--kh-transition);
  background: var(--kh-surface-alt);
}

.kh-theme-option-card.active {
  border-color: var(--kh-primary);
  box-shadow: 0 0 0 3px var(--kh-primary-light);
}

.kh-theme-preview {
  height: 90px;
  border-radius: var(--kh-radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--kh-border);
}

.kh-theme-preview-light {
  background: #f8fafc;
}

.kh-theme-preview-light .kh-tp-bar {
  height: 14px;
  background: #0052cc;
  border-radius: 4px;
  margin-bottom: 10px;
}

.kh-theme-preview-light .kh-tp-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kh-theme-preview-light .kh-tp-cards span {
  height: 36px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.kh-theme-preview-dark {
  background: #0f172a;
}

.kh-theme-preview-dark .kh-tp-bar {
  height: 14px;
  background: #3b82f6;
  border-radius: 4px;
  margin-bottom: 10px;
}

.kh-theme-preview-dark .kh-tp-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kh-theme-preview-dark .kh-tp-cards span {
  height: 36px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
}

.kh-theme-option-meta strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.kh-theme-option-meta span {
  font-size: 0.8rem;
  color: var(--kh-text-muted);
}

/* ==========================================================================
   6. Wallet Summary, Notifications Feed & Auth Cards
   ========================================================================== */
.kh-wallet-summary-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .kh-wallet-summary-grid {
    grid-template-columns: 1fr;
  }
}

.kh-mini-pkg-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kh-mini-pkg-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--kh-surface-alt);
  border-radius: var(--kh-radius-sm);
  font-size: 0.85rem;
}

.kh-notifications-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kh-notification-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  box-shadow: var(--kh-shadow-sm);
}

.kh-notification-card.unread {
  border-left: 4px solid var(--kh-primary);
  background: var(--kh-primary-light);
}

.kh-notification-icon {
  font-size: 1.35rem;
}

.kh-notification-content {
  flex: 1;
}

.kh-notification-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.kh-notification-date {
  font-size: 0.78rem;
  color: var(--kh-text-muted);
}

.kh-notification-content p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--kh-text-secondary);
}

/* Auth Cards */
.kh-auth-card {
  max-width: 480px;
  margin: 40px auto;
  padding: 34px;
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-lg);
  box-shadow: var(--kh-shadow-md);
  font-family: var(--kh-font-sans);
}

.kh-auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.kh-auth-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.kh-auth-header h2 {
  margin: 0;
  font-family: var(--kh-font-heading);
  color: var(--kh-text-main);
}

.kh-auth-header p {
  color: var(--kh-text-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.kh-auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--kh-text-muted);
}

.kh-auth-footer a {
  color: var(--kh-primary);
  text-decoration: none;
  font-weight: 600;
}

.kh-alert {
  padding: 12px 16px;
  border-radius: var(--kh-radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.kh-alert-danger {
  background: var(--kh-danger-bg);
  color: var(--kh-danger-text);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   7. Buttons, Tables, Modals & Floating Bulk Bar
   ========================================================================== */
.kh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--kh-radius-sm);
  font-family: var(--kh-font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--kh-transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.kh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.kh-btn-primary:hover:not(:disabled) {
  background: var(--kh-primary-hover);
}

.kh-btn-accent {
  background: var(--kh-accent);
  color: #ffffff;
}

.kh-btn-accent:hover:not(:disabled) {
  background: var(--kh-accent-hover);
}

.kh-btn-outline {
  background: transparent;
  border-color: var(--kh-border);
  color: var(--kh-text-secondary);
}

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

.kh-btn-sm {
  padding: 7px 13px;
  font-size: 0.8rem;
}

/* Floating Bulk Action Bar */
.kh-bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 14px 24px;
  border-radius: var(--kh-radius-full);
  box-shadow: var(--kh-shadow-lg);
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 9999;
  border: 1px solid #334155;
}

.kh-bulk-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kh-bulk-count {
  background: var(--kh-primary);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

/* Tables */
.kh-table-wrapper {
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  overflow-x: auto;
  box-shadow: var(--kh-shadow-sm);
}

.kh-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.kh-table th {
  background: var(--kh-surface-alt);
  padding: 14px 18px;
  font-weight: 700;
  color: var(--kh-text-secondary);
  border-bottom: 1px solid var(--kh-border);
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.kh-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--kh-border);
  color: var(--kh-text-main);
  vertical-align: middle;
}

.kh-table tr:last-child td {
  border-bottom: none;
}

.kh-table tr:hover td {
  background: var(--kh-surface-alt);
}

/* Modals */
.kh-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--kh-modal-backdrop);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.kh-modal {
  background: var(--kh-card-bg);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-lg);
  width: 100%;
  max-width: 540px;
  padding: 28px;
  box-shadow: var(--kh-shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.kh-modal-title {
  font-family: var(--kh-font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 8px 0;
  color: var(--kh-text-main);
}

.kh-summary-box {
  background: var(--kh-surface-alt);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  padding: 16px;
  margin: 16px 0;
}

.kh-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
}

.kh-summary-row.total {
  border-top: 1px solid var(--kh-border);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--kh-text-main);
}

/* Support Chat Thread */
.kh-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding: 16px;
  background: var(--kh-surface-alt);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-md);
  margin: 14px 0;
}

.kh-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.kh-chat-msg.dentist {
  align-self: flex-end;
  align-items: flex-end;
}

.kh-chat-msg.admin {
  align-self: flex-start;
  align-items: flex-start;
}

.kh-chat-msg .kh-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.kh-chat-msg.dentist .kh-bubble {
  background: var(--kh-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.kh-chat-msg.admin .kh-bubble {
  background: var(--kh-card-bg);
  color: var(--kh-text-main);
  border: 1px solid var(--kh-border);
  border-bottom-left-radius: 4px;
}

.kh-chat-author {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--kh-text-muted);
  margin-bottom: 3px;
}

.kh-chat-time {
  font-size: 0.68rem;
  opacity: 0.75;
  margin-top: 4px;
  display: block;
}

/* Loading & Empty States */
.kh-loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--kh-text-muted);
}

.kh-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--kh-border);
  border-top-color: var(--kh-primary);
  border-radius: 50%;
  animation: khSpin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

.kh-empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--kh-card-bg);
  border: 1px dashed var(--kh-border);
  border-radius: var(--kh-radius-md);
}

.kh-empty-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}
