/* ============================================================
   DENTIUM PROTOTYPE — Component Styles
   ============================================================ */

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-secondary);
  font-size: var(--text-btn-size);
  font-weight: var(--text-btn-weight);
  cursor: pointer;
  transition: background var(--transition-fast) ease,
              box-shadow var(--transition-fast) ease,
              transform var(--transition-fast) ease,
              opacity var(--transition-fast) ease;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  height: 36px;
  padding: 0 16px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:disabled,
.btn.btn-loading {
  opacity: 0.65;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }

/* Secondary */
.btn-secondary {
  background: transparent;
  color: var(--fg-primary);
  border: 1px solid var(--color-input-border);
}
.btn-secondary:hover { background: var(--color-surface-subtle); }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-light); }

/* Ghost neutral */
.btn-ghost-neutral {
  background: transparent;
  color: var(--fg-secondary);
}
.btn-ghost-neutral:hover {
  background: var(--color-surface-subtle);
  color: var(--fg-primary);
}

/* Danger */
.btn-danger {
  background: #FFE4E4;
  color: #CC1414;
}
.btn-danger:hover { background: #FFCCCC; }

/* Danger solid */
.btn-danger-solid {
  background: #CC1414;
  color: #fff;
}
.btn-danger-solid:hover { background: #A80F0F; }

/* Sizes */
.btn-sm {
  height: 28px;
  font-size: 12px;
  padding: 0 10px;
  gap: 4px;
}

.btn-lg {
  height: 44px;
  font-size: 15px;
  padding: 0 24px;
}

.btn-xl {
  height: 50px;
  font-size: 15px;
  padding: 0 28px;
  border-radius: var(--radius-md);
}

/* Icon-only button */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Full width */
.btn-block { width: 100%; }

/* ── BADGES / STATUS PILLS ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-pill { border-radius: var(--radius-full); }

.badge-scheduled   { background: var(--status-scheduled-bg);   color: var(--status-scheduled-text); }
.badge-confirmed   { background: var(--status-confirmed-bg);   color: var(--status-confirmed-text); }
.badge-in-progress { background: var(--status-in-progress-bg); color: var(--status-in-progress-text); }
.badge-completed   { background: var(--status-completed-bg);   color: var(--status-completed-text); }
.badge-cancelled   { background: var(--status-cancelled-bg);   color: var(--status-cancelled-text); }
.badge-no-show     { background: var(--status-no-show-bg);     color: var(--status-no-show-text); }
.badge-waiting     { background: var(--status-waiting-bg);     color: var(--status-waiting-text); }
.badge-draft       { background: var(--status-draft-bg);       color: var(--status-draft-text); }
.badge-issued      { background: var(--status-issued-bg);      color: var(--status-issued-text); }
.badge-paid        { background: var(--status-paid-bg);        color: var(--status-paid-text); }
.badge-partial     { background: var(--status-partial-bg);     color: var(--status-partial-text); }
.badge-void        { background: var(--status-void-bg);        color: var(--status-void-text); }
.badge-active      { background: var(--status-completed-bg);   color: var(--status-completed-text); }
.badge-inactive    { background: var(--status-cancelled-bg);   color: var(--status-cancelled-text); }

/* Dot status indicator */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── AVATAR ──────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-avatar);
  font-family: var(--font-primary);
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  user-select: none;
}

.avatar-xs  { width: 24px; height: 24px; font-size: 9px; }
.avatar-sm  { width: 30px; height: 30px; font-size: 11px; }
.avatar-md  { width: 38px; height: 38px; font-size: 14px; }
.avatar-lg  { width: 52px; height: 52px; font-size: 18px; }
.avatar-xl  { width: 64px; height: 64px; font-size: 22px; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-padded { padding: 20px; }

.card-hover {
  transition: transform var(--transition-medium) ease,
              box-shadow var(--transition-medium) ease;
  cursor: pointer;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-family: var(--font-secondary);
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  color: var(--fg-primary);
  display: flex;
  align-items: center;
  gap: 2px;
}

.field-label .required { color: var(--color-required-star); }

.field-hint {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: -2px;
}

.field-error {
  font-size: 11px;
  color: #CC1414;
  min-height: 15px;
  display: block;
}

.input {
  background: var(--bg-surface);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  height: 40px;
  padding: 0 12px;
  font-family: var(--font-secondary);
  font-size: var(--text-input-size);
  color: var(--fg-primary);
  width: 100%;
  transition: border-color var(--transition-fast) ease,
              box-shadow var(--transition-fast) ease;
}

.input::placeholder { color: var(--color-cg-60); }

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(72, 69, 240, 0.12);
}

.input.input-error {
  border-color: #CC1414;
  box-shadow: 0 0 0 3px rgba(204, 20, 20, 0.10);
}

.input:disabled {
  background: var(--color-surface-subtle);
  color: var(--fg-muted);
  cursor: not-allowed;
}

textarea.input {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239B9DA3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Search input wrapper */
.search-wrapper {
  position: relative;
  flex: 1;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}

.search-wrapper .input {
  padding-left: 36px;
  padding-right: 32px;
}

.search-wrapper .search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  cursor: pointer;
  display: none;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--color-cg-30);
  font-size: 10px;
  color: var(--fg-secondary);
}

.search-wrapper .search-clear.visible { display: flex; }
.search-wrapper .search-clear:hover { background: var(--color-cg-60); color: #fff; }

/* Toggle button group (radio-style) */
.toggle-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  background: var(--bg-surface);
  user-select: none;
}

.toggle-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

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

/* Severity toggles */
.toggle-btn.severity-mild.active   { background: #10973E; border-color: #10973E; }
.toggle-btn.severity-moderate.active { background: #DB7600; border-color: #DB7600; }
.toggle-btn.severity-severe.active { background: #CC1414; border-color: #CC1414; }

/* ── TABS ────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--color-divider);
  position: relative;
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 11px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast) ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover { color: var(--fg-primary); }
.tab-btn.active { color: var(--color-primary); font-weight: 500; }
.tab-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.tab-count {
  background: var(--color-surface-subtle);
  color: var(--fg-muted);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-family: var(--font-secondary);
  font-weight: 600;
}

.tab-content {
  transition: opacity 80ms ease;
}

/* ── DATA TABLE ──────────────────────────────────────────── */
.data-table-wrapper {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

.data-table thead tr {
  background: var(--bg-table-head);
}

.data-table th {
  font-family: var(--font-secondary);
  font-size: var(--text-table-header-size);
  font-weight: var(--text-table-header-weight);
  color: var(--fg-secondary);
  padding: 0 16px;
  height: var(--table-row-height);
  text-align: left;
  user-select: none;
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast) ease;
}
.data-table th.sortable:hover { color: var(--fg-primary); }
.data-table th.sort-active { color: var(--color-primary); }

.sort-icon {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.6;
}

.data-table td {
  padding: 0 16px;
  height: 52px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--fg-primary);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

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

.data-table tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast) ease,
              border-left-color var(--transition-fast) ease;
  border-left: 2px solid transparent;
}

.data-table tbody tr:hover {
  background: var(--color-surface-subtle);
  border-left-color: var(--color-primary);
}

.table-action-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast) ease;
}

.data-table tbody tr:hover .table-action-cell { opacity: 1; }

.table-patient-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-patient-info { display: flex; flex-direction: column; gap: 1px; }
.table-patient-name { font-size: 13px; font-weight: 500; color: var(--fg-dark); }
.table-patient-pid  { font-size: 11px; color: var(--fg-muted); }

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--color-divider);
  background: var(--bg-surface);
}

.pagination-info {
  font-size: 12px;
  color: var(--fg-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-chip {
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  border: none;
  background: transparent;
  color: var(--fg-secondary);
}

.page-chip:hover { background: var(--color-surface-subtle); color: var(--fg-primary); }
.page-chip.active { background: var(--color-primary); color: #fff; }
.page-chip.dots { cursor: default; color: var(--fg-muted); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 50, 0.42);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn var(--transition-fast) ease;
}

.modal-container {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 220ms ease-out both;
}

.modal-container-lg { max-width: 720px; }
.modal-container-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-h2-size);
  font-weight: 500;
  color: var(--fg-dark);
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-page);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast) ease;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--color-cg-10); color: var(--fg-primary); }

.modal-body { padding: 20px 24px; flex: 1; }

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--color-divider);
  padding-top: 16px;
  margin-top: 4px;
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  background: var(--color-cg-120);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 13px;
  font-family: var(--font-primary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
  pointer-events: all;
  cursor: pointer;
  animation: slideInRight 200ms ease-out both;
}

.toast.dismissing {
  animation: slideOutRight 200ms ease-in both;
}

.toast-success { background: #0D7A33; }
.toast-error   { background: #B91C1C; }
.toast-info    { background: var(--color-primary); }
.toast-warning { background: #B45309; }

.toast-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.toast-message { flex: 1; line-height: 1.4; }

/* ── SKELETON ────────────────────────────────────────────── */
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-divider);
}

.skeleton-circle {
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-text {
  height: 10px;
  border-radius: 5px;
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  color: var(--color-cg-30);
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: 6px;
}

.empty-state-message {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 20px;
  max-width: 320px;
  line-height: 1.5;
}

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--color-primary);
  cursor: pointer;
  transition: opacity var(--transition-fast) ease;
}
.breadcrumb-link:hover { opacity: 0.7; text-decoration: underline; }

.breadcrumb-sep { color: var(--color-cg-30); font-size: 14px; }
.breadcrumb-current { color: var(--fg-secondary); }

/* ── PAGE LAYOUT HELPERS ─────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title-group { display: flex; flex-direction: column; gap: 3px; }
.page-title { font-size: var(--text-h1-size); font-weight: var(--text-h1-weight); color: var(--fg-dark); }
.page-subtitle { font-size: 13px; color: var(--fg-muted); }

.page-actions { display: flex; align-items: center; gap: 8px; }

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

.section-title {
  font-size: var(--text-h2-size);
  font-weight: 500;
  color: var(--fg-dark);
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

/* ── ALERT BANNER ────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 13px;
  animation: fadeInDown 200ms ease-out;
}

.alert-banner-warning { background: #FFF8E7; border-left: 3px solid #E65100; color: #7A3400; }
.alert-banner-error   { background: #FFE4E4; border-left: 3px solid #CC1414; color: #7A0000; }
.alert-banner-info    { background: #EEF0FE; border-left: 3px solid var(--color-primary); color: #1A1880; }

.alert-banner-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: currentColor;
  opacity: 0.6;
  flex-shrink: 0;
  padding: 0 2px;
  transition: opacity var(--transition-fast) ease;
}
.alert-banner-dismiss:hover { opacity: 1; }

/* ── DROPDOWN MENU ───────────────────────────────────────── */
.dropdown-menu {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  z-index: 300;
  min-width: 170px;
  padding: 4px 0;
  overflow: hidden;
  animation: scaleIn 150ms var(--ease-spring) both;
  transform-origin: top right;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: var(--font-primary);
  color: var(--fg-primary);
  cursor: pointer;
  transition: background var(--transition-fast) ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--color-surface-subtle); }
.dropdown-item.danger { color: #CC1414; }
.dropdown-item.danger:hover { background: #FFE4E4; }
.dropdown-item.disabled { color: var(--fg-muted); cursor: default; pointer-events: none; }

.dropdown-divider {
  height: 1px;
  background: var(--color-divider);
  margin: 4px 0;
}

.dropdown-label {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-family: var(--font-secondary);
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── DRAWER (side panel) ─────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 500;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn var(--transition-fast) ease;
}

.drawer-panel {
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-drawer);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-medium) var(--ease-spring);
  display: flex;
  flex-direction: column;
  position: relative;
}

.drawer-overlay.drawer-visible .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-dark);
}

.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-page);
  cursor: pointer;
  font-size: 16px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast) ease;
}
.drawer-close:hover { background: var(--color-cg-10); color: var(--fg-primary); }

.drawer-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-divider);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── ACCORDION ───────────────────────────────────────────── */
.accordion-item {
  border-bottom: 1px solid var(--color-divider);
}
.accordion-item:last-child { border-bottom: none; }

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  cursor: pointer;
  user-select: none;
}
.accordion-header:hover .accordion-chevron { color: var(--fg-primary); }

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-medium) ease-out;
}
.accordion-body.expanded { max-height: 800px; }

.accordion-chevron {
  transition: transform var(--transition-fast) ease;
  font-size: 14px;
  color: var(--fg-muted);
  flex-shrink: 0;
}
.accordion-chevron.rotated { transform: rotate(90deg); }

/* ── KPI CARD ────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-medium) ease,
              box-shadow var(--transition-medium) ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.kpi-label {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-secondary);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.kpi-value {
  font-size: 28px;
  font-weight: 500;
  color: var(--fg-dark);
  font-family: var(--font-primary);
  line-height: 1.1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-trend.up   { color: #10973E; }
.kpi-trend.down { color: #CC1414; }

.kpi-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--color-primary);
  opacity: 0.15;
}

/* ── FILTER CHIPS ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-family: var(--font-primary);
  color: var(--fg-secondary);
  cursor: pointer;
  background: var(--bg-surface);
  transition: all var(--transition-fast) ease;
  user-select: none;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-chip.active {
  border-color: var(--color-primary);
  background: rgba(72, 69, 240, 0.06);
  color: var(--color-primary);
  font-weight: 500;
}

.filter-chip-clear {
  font-size: 12px;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.7;
}

.filter-result-count {
  font-size: 12px;
  color: var(--fg-muted);
  margin-left: auto;
}

/* ── SEGMENTED CONTROL ───────────────────────────────────── */
.segmented-control {
  display: flex;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 0;
}

.segmented-btn {
  flex: 1;
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--fg-muted);
  border: none;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  white-space: nowrap;
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--color-primary);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── INFO ROWS (label-value pairs) ───────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-divider);
  gap: 12px;
}

.info-row:last-child { border-bottom: none; }

.info-label {
  font-family: var(--font-secondary);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  flex-shrink: 0;
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-value {
  font-size: 12px;
  color: var(--fg-primary);
  text-align: right;
  flex: 1;
  word-break: break-word;
}

/* ── STAT BOX ────────────────────────────────────────────── */
.stat-box {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}

.stat-box-value {
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 500;
  color: var(--fg-dark);
  line-height: 1.2;
}

.stat-box-label {
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 2px;
  font-family: var(--font-primary);
}

/* ── ALLERGY ALERT BOX ───────────────────────────────────── */
.allergy-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FFF8E7;
  border-left: 3px solid #E65100;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.allergy-alert-icon { color: #E65100; flex-shrink: 0; margin-top: 1px; }

.allergy-alert-title {
  font-family: var(--font-secondary);
  font-size: 10px;
  font-weight: 700;
  color: #E65100;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.allergy-alert-items {
  font-size: 12px;
  color: #7A3400;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── STEPPER ─────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--color-divider);
}

.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}
.step-item:last-child { flex: none; }

.step-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: var(--font-secondary);
  font-weight: 600;
  flex-shrink: 0;
  transition: all var(--transition-medium) ease;
  border: 2px solid var(--color-divider);
  background: var(--bg-surface);
  color: var(--fg-muted);
}

.step-circle.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(72, 69, 240, 0.12);
}

.step-circle.completed {
  background: #10973E;
  border-color: #10973E;
  color: #fff;
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--color-divider);
  margin: 0 6px;
  transition: background var(--transition-medium) ease;
}

.step-connector.completed { background: #10973E; }

.step-label-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: -14px; /* center below circle */
  margin-top: 36px;
  position: absolute;
  white-space: nowrap;
}

/* ── TIMELINE COMPONENT ──────────────────────────────────── */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-primary) 0%, var(--color-divider) 100%);
}

.timeline-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 4px;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  z-index: 1;
}

.timeline-dot-completed { background: #10973E; }
.timeline-dot-active    { background: var(--color-primary); }
.timeline-dot-cancelled { background: var(--color-cg-30); }

/* ── PILL / TAG ──────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: var(--font-primary);
  background: var(--color-surface-subtle);
  color: var(--fg-secondary);
  white-space: nowrap;
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-divider);
  margin: 16px 0;
}

.divider-sm { margin: 10px 0; }

/* ── ROLE SWITCHER DROPDOWN ─────────────────────────────── */
.role-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  transform-origin: top right;
}

.role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast) ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--fg-primary);
}
.role-item:hover { background: var(--color-surface-subtle); }

.role-item.active { color: var(--color-primary); font-weight: 500; }
.role-item.disabled { color: var(--fg-muted); cursor: default; pointer-events: none; }

.role-coming-soon {
  margin-left: auto;
  font-size: 9px;
  font-family: var(--font-secondary);
  font-weight: 700;
  background: var(--color-surface-subtle);
  color: var(--fg-muted);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
