/* =============================================================================
   Receptionniste AI — Design System
   Version: 1.0.0 | POC
   ============================================================================= */

/* =============================================================================
   1. DESIGN TOKENS
   ============================================================================= */

:root {
  /* Primary */
  --primary: #0F766E;
  --primary-light: #14B8A6;
  --primary-dark: #0D5A52;
  --primary-50: #F0FDFA;

  /* Accent */
  --accent: #3B82F6;
  --accent-light: #DBEAFE;

  /* Backgrounds & Surfaces */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;

  /* Borders */
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* Text */
  --text: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  /* Semantic */
  --success: #22C55E;
  --success-light: #DCFCE7;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-display: 700 36px/1.2 var(--font-sans);
  --text-h1: 600 24px/1.3 var(--font-sans);
  --text-h2: 600 20px/1.4 var(--font-sans);
  --text-h3: 600 16px/1.4 var(--font-sans);
  --text-body: 400 14px/1.6 var(--font-sans);
  --text-body-medium: 500 14px/1.6 var(--font-sans);
  --text-small: 400 13px/1.5 var(--font-sans);
  --text-tiny: 500 11px/1.4 var(--font-sans);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --header-height: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}


/* =============================================================================
   2. CSS RESET & BASE
   ============================================================================= */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font: var(--text-body);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

ul, ol {
  list-style: none;
}

h1 { font: var(--text-h1); color: var(--text); }
h2 { font: var(--text-h2); color: var(--text); }
h3 { font: var(--text-h3); color: var(--text); }

p { font: var(--text-body); color: var(--text-secondary); }


/* =============================================================================
   3. LAYOUT: SIDEBAR + MAIN
   ============================================================================= */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: var(--space-8);
  transition: margin-left var(--transition-slow);
}


/* =============================================================================
   4. SIDEBAR INTERNALS
   ============================================================================= */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font: var(--text-h3);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
}

.sidebar-section {
  margin-bottom: var(--space-4);
}

.sidebar-section-title {
  font: var(--text-tiny);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-6);
  margin-bottom: var(--space-1);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font: var(--text-body-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--primary-50);
  color: var(--primary);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: calc(var(--space-2) * -1);
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.sidebar-item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-item-badge {
  margin-left: auto;
  font: var(--text-tiny);
  background: var(--error);
  color: var(--surface);
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-footer-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--text-body-medium);
  flex-shrink: 0;
}

.sidebar-footer-info {
  overflow: hidden;
}

.sidebar-footer-name {
  font: var(--text-body-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-role {
  font: var(--text-small);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =============================================================================
   5. PAGE HEADER
   ============================================================================= */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.page-header-content {
  flex: 1;
}

.page-title {
  font: var(--text-h1);
  color: var(--text);
  margin-bottom: var(--space-1);
}

.page-subtitle {
  font: var(--text-body);
  color: var(--text-muted);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}


/* =============================================================================
   6. STAT CARDS
   ============================================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: box-shadow var(--transition-fast);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.stat-icon.primary   { background: var(--primary-50); color: var(--primary); }
.stat-icon.success   { background: var(--success-light); color: var(--success); }
.stat-icon.warning   { background: var(--warning-light); color: var(--warning); }
.stat-icon.error     { background: var(--error-light); color: var(--error); }
.stat-icon.info      { background: var(--info-light); color: var(--info); }

.stat-content {
  flex: 1;
}

.stat-label {
  font: var(--text-small);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.stat-value {
  font: var(--text-h1);
  color: var(--text);
  margin-bottom: var(--space-1);
}

.stat-trend {
  font: var(--text-tiny);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.stat-trend.up {
  color: var(--success);
  background: var(--success-light);
}

.stat-trend.down {
  color: var(--error);
  background: var(--error-light);
}


/* =============================================================================
   7. DATA TABLE
   ============================================================================= */

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.table-title {
  font: var(--text-h3);
  color: var(--text);
}

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

thead th {
  font: var(--text-tiny);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-6);
  text-align: left;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover {
  color: var(--text-secondary);
}

thead th .sort-indicator {
  display: inline-block;
  margin-left: var(--space-1);
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

thead th.sorted .sort-indicator {
  opacity: 1;
  color: var(--primary);
}

tbody tr {
  height: 52px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody td {
  padding: var(--space-3) var(--space-6);
  font: var(--text-body);
  color: var(--text);
  vertical-align: middle;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border);
}

.table-pagination-info {
  font: var(--text-small);
  color: var(--text-muted);
}

.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.table-pagination-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: var(--text-small);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.table-pagination-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.table-pagination-btn.active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

.table-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* =============================================================================
   8. FORMS
   ============================================================================= */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font: var(--text-body-medium);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: var(--text-body);
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  height: auto;
  min-height: 100px;
  padding: var(--space-3);
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

.form-hint {
  font: var(--text-small);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Validation states */
.form-group.error .form-input,
.form-group.error .form-select,
.form-group.error .form-textarea {
  border-color: var(--error);
}

.form-group.error .form-input:focus,
.form-group.error .form-select:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error {
  font: var(--text-small);
  color: var(--error);
  margin-top: var(--space-1);
}

.form-group.success .form-input {
  border-color: var(--success);
}


/* =============================================================================
   9. BUTTONS
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: var(--text-body-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

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

/* Sizes */
.btn-sm {
  height: 36px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

.btn-md {
  height: 40px;
  padding: 0 var(--space-4);
}

.btn-lg {
  height: 44px;
  padding: 0 var(--space-6);
  font-size: 15px;
}

/* Variants */
.btn-primary {
  background: var(--primary);
  color: var(--surface);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--error);
  color: var(--surface);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm { width: 36px; }
.btn-icon.btn-lg { width: 44px; }


/* =============================================================================
   10. CARDS
   ============================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-title {
  font: var(--text-h3);
  color: var(--text);
}

.card-subtitle {
  font: var(--text-small);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.card-body {
  font: var(--text-body);
  color: var(--text-secondary);
}

.card-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}


/* =============================================================================
   11. BADGES / PILLS
   ============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font: var(--text-tiny);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.badge-success {
  background: var(--success-light);
  color: #15803D;
}

.badge-success .badge-dot { background: var(--success); }

.badge-warning {
  background: var(--warning-light);
  color: #A16207;
}

.badge-warning .badge-dot { background: var(--warning); }

.badge-error {
  background: var(--error-light);
  color: #B91C1C;
}

.badge-error .badge-dot { background: var(--error); }

.badge-info {
  background: var(--info-light);
  color: #1D4ED8;
}

.badge-info .badge-dot { background: var(--info); }

.badge-neutral {
  background: var(--surface-hover);
  color: var(--text-secondary);
}


/* =============================================================================
   12. MODALS
   ============================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font: var(--text-h2);
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}


/* =============================================================================
   13. TOASTS
   ============================================================================= */

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideInRight var(--transition-slow) ease forwards;
}

.toast.exiting {
  animation: fadeOut var(--transition-base) ease forwards;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-error   { border-left: 4px solid var(--error); }
.toast-info    { border-left: 4px solid var(--info); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content { flex: 1; }

.toast-title {
  font: var(--text-body-medium);
  color: var(--text);
  margin-bottom: 2px;
}

.toast-message {
  font: var(--text-small);
  color: var(--text-secondary);
}

.toast-dismiss {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.toast-dismiss:hover {
  background: var(--surface-hover);
  color: var(--text);
}


/* =============================================================================
   14. CHART AREA
   ============================================================================= */

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.chart-placeholder {
  width: 100%;
  height: 240px;
  background: var(--surface-hover);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font: var(--text-body);
}

.chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 200px;
  padding-top: var(--space-4);
}

.chart-bar {
  flex: 1;
  background: var(--primary-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  transition: background var(--transition-fast);
  position: relative;
}

.chart-bar:hover {
  background: var(--primary);
}

.chart-bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font: var(--text-tiny);
  color: var(--text-muted);
  white-space: nowrap;
}


/* =============================================================================
   15. SEARCH BAR
   ============================================================================= */

.search-bar {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.search-bar-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3) 0 var(--space-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: var(--text-body);
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.search-bar-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.search-bar-input::placeholder {
  color: var(--text-muted);
}


/* =============================================================================
   16. FILTER PILLS
   ============================================================================= */

.filter-pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-pill {
  height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  font: var(--text-small);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.filter-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.filter-pill.active {
  background: var(--primary-50);
  border-color: var(--primary-light);
  color: var(--primary);
}


/* =============================================================================
   17. PHONE NUMBER MONO
   ============================================================================= */

.phone-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text);
}


/* =============================================================================
   18. TRANSCRIPT VIEWER
   ============================================================================= */

.transcript-viewer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 480px;
  overflow-y: auto;
  padding: var(--space-4);
}

.transcript-bubble {
  max-width: 75%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font: var(--text-body);
  line-height: 1.5;
}

.transcript-bubble.caller {
  align-self: flex-start;
  background: var(--surface-hover);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
}

.transcript-bubble.ai {
  align-self: flex-end;
  background: var(--primary-50);
  color: var(--primary-dark);
  border-bottom-right-radius: var(--radius-sm);
}

.transcript-bubble-sender {
  font: var(--text-tiny);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.transcript-bubble-time {
  font: var(--text-tiny);
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-align: right;
}


/* =============================================================================
   19. AUDIO PLAYER
   ============================================================================= */

.audio-player {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-hover);
  border-radius: var(--radius-md);
}

.audio-player-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.audio-player-btn:hover {
  background: var(--primary-dark);
}

.audio-player-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.audio-player-progress {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.1s linear;
}

.audio-player-time {
  font: var(--text-tiny);
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-width: 40px;
  text-align: right;
}


/* =============================================================================
   20. STATUS INDICATORS
   ============================================================================= */

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font: var(--text-small);
}

.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot.online::before  { background: var(--success); }
.status-dot.offline::before { background: var(--text-muted); }
.status-dot.busy::before    { background: var(--error); }
.status-dot.away::before    { background: var(--warning); }

.status-dot.pulse::before {
  animation: pulse-dot 2s ease-in-out infinite;
}


/* =============================================================================
   21. EMPTY STATES
   ============================================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  color: var(--text-muted);
  font-size: 24px;
}

.empty-state-title {
  font: var(--text-h3);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font: var(--text-body);
  color: var(--text-muted);
  max-width: 360px;
  margin-bottom: var(--space-6);
}


/* =============================================================================
   22. LOADING SKELETON / SHIMMER
   ============================================================================= */

.skeleton {
  background: var(--surface-hover);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-heading {
  height: 24px;
  width: 40%;
  margin-bottom: var(--space-4);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 120px;
}

.skeleton-row {
  height: 52px;
  border-bottom: 1px solid var(--border);
}


/* =============================================================================
   23. LANDING PAGE — HERO
   ============================================================================= */

.landing-body {
  background: var(--surface);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
}

.landing-nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font: var(--text-h3);
  color: var(--text);
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.landing-nav-link {
  font: var(--text-body-medium);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.landing-nav-link:hover {
  color: var(--text);
}

.hero {
  position: relative;
  padding: var(--space-16) var(--space-8);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  text-align: center;
  overflow: hidden;
  color: var(--surface);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  font: var(--text-small);
  color: var(--surface);
  margin-bottom: var(--space-8);
  backdrop-filter: blur(8px);
}

.hero-title {
  font-family: var(--font-sans);
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--surface);
  margin-bottom: var(--space-6);
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  max-width: 600px;
  margin: 0 auto var(--space-10);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.btn-hero {
  height: 52px;
  padding: 0 var(--space-8);
  border-radius: var(--radius-md);
  font: var(--text-body-medium);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.btn-hero-primary {
  background: var(--surface);
  color: var(--primary);
}

.btn-hero-primary:hover {
  background: var(--primary-50);
  box-shadow: var(--shadow-lg);
}

.btn-hero-secondary {
  background: transparent;
  color: var(--surface);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-hero-secondary:hover {
  border-color: var(--surface);
  background: rgba(255, 255, 255, 0.1);
}


/* =============================================================================
   24. LANDING — FEATURE GRID
   ============================================================================= */

.landing-section {
  padding: var(--space-16) var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
}

.landing-section.alt-bg {
  background: var(--bg);
  max-width: none;
}

.landing-section.alt-bg > .landing-section-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.landing-section-eyebrow {
  font: var(--text-tiny);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
  text-align: center;
}

.landing-section-title {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  text-align: center;
  margin-bottom: var(--space-4);
}

.landing-section-desc {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-12);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-card-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-5);
  background: var(--primary-50);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary);
}

.feature-card-title {
  font: var(--text-h3);
  color: var(--text);
  margin-bottom: var(--space-3);
}

.feature-card-desc {
  font: var(--text-body);
  color: var(--text-secondary);
}


/* =============================================================================
   25. LANDING — HOW IT WORKS
   ============================================================================= */

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  counter-reset: step-counter;
}

.step-item {
  text-align: center;
  counter-increment: step-counter;
  position: relative;
}

.step-number {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-5);
  background: var(--primary);
  color: var(--surface);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--text-h2);
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 24px;
  left: calc(50% + 36px);
  width: calc(100% - 72px);
  height: 2px;
  background: var(--border);
}

.step-title {
  font: var(--text-h3);
  color: var(--text);
  margin-bottom: var(--space-3);
}

.step-desc {
  font: var(--text-body);
  color: var(--text-secondary);
}


/* =============================================================================
   26. LANDING — PROBLEM / SOLUTION
   ============================================================================= */

.problem-solution {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}

.problem-card,
.solution-card {
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.problem-card {
  background: var(--error-light);
  border: 1px solid var(--error);
}

.solution-card {
  background: var(--success-light);
  border: 1px solid var(--success);
}

.problem-card-title,
.solution-card-title {
  font: var(--text-h2);
  margin-bottom: var(--space-4);
}

.problem-card-title { color: #B91C1C; }
.solution-card-title { color: #15803D; }

.problem-card li,
.solution-card li {
  font: var(--text-body);
  padding: var(--space-2) 0;
  padding-left: var(--space-6);
  position: relative;
}

.problem-card li { color: #991B1B; }
.solution-card li { color: #166534; }

.problem-card li::before {
  content: '\2715';
  position: absolute;
  left: 0;
  color: var(--error);
  font-weight: 700;
}

.solution-card li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}


/* =============================================================================
   27. LANDING — CTA
   ============================================================================= */

.cta-section {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--surface);
}

.cta-title {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  color: var(--surface);
  margin-bottom: var(--space-4);
}

.cta-desc {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}


/* =============================================================================
   28. LANDING — FOOTER
   ============================================================================= */

.landing-footer {
  padding: var(--space-10) var(--space-8);
  border-top: 1px solid var(--border);
  text-align: center;
}

.landing-footer-text {
  font: var(--text-small);
  color: var(--text-muted);
}


/* =============================================================================
   29. RESPONSIVE — TABLET
   ============================================================================= */

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps-list {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .step-item:not(:last-child)::after {
    display: none;
  }

  /* Collapsed sidebar */
  .sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-section-title,
  .sidebar.collapsed .sidebar-item span,
  .sidebar.collapsed .sidebar-item-badge,
  .sidebar.collapsed .sidebar-footer-info {
    display: none;
  }

  .sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: var(--space-3);
    margin: 0 var(--space-2);
  }

  .sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: var(--space-5) var(--space-3);
  }

  .sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }
}


/* =============================================================================
   30. RESPONSIVE — MOBILE
   ============================================================================= */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-5);
  }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .hamburger {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text);
  }

  .hamburger:hover {
    background: var(--surface-hover);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    visibility: visible;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .problem-solution {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .page-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn-hero {
    width: 100%;
    max-width: 300px;
  }

  .landing-section-title {
    font-size: 24px;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }

  .modal {
    max-width: 100%;
    margin: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .landing-nav {
    padding: var(--space-4) var(--space-5);
  }

  .landing-nav-links {
    display: none;
  }
}

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
  .mobile-header,
  .hamburger,
  .sidebar-backdrop {
    display: none;
  }
}


/* =============================================================================
   31. UTILITY CLASSES
   ============================================================================= */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.w-full { width: 100%; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


/* =============================================================================
   LOGIN MODE — Full-width centered login without sidebar
   ============================================================================= */

#app.login-mode .sidebar { display: none; }
#app.login-mode .sidebar-overlay { display: none; }
#app.login-mode .main-content {
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

/* Login Page */
.login-container {
  width: 100%;
  max-width: 520px;
  padding: var(--space-8);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  font-size: 48px;
  margin-bottom: var(--space-4);
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

/* Role Selection Cards */
.role-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.role-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 150ms ease-out;
  text-align: left;
  background: var(--surface);
}
.role-card:hover {
  border-color: var(--primary-light);
  background: var(--primary-50);
  box-shadow: var(--shadow-sm);
}
.role-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.role-card-avatar.admin { background: var(--primary-50); color: var(--primary); }
.role-card-avatar.receptionist { background: var(--info-light); color: var(--info); }
.role-card-avatar.system { background: var(--warning-light); color: #92400E; }
.role-card-info { flex: 1; }
.role-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.role-card-role {
  font-size: 12px;
  color: var(--text-muted);
}
.role-card-email {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  margin-top: 2px;
}
.role-card-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-form {
  text-align: left;
}
.login-form .form-group {
  margin-bottom: var(--space-4);
}
.login-form .form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.login-form .form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.login-form .form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms;
  margin-top: var(--space-2);
}
.login-btn:hover { background: var(--primary-dark); }

.login-demo-hint {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--primary-50);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}
.login-demo-hint code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text);
}


/* =============================================================================
   PAGES.JS COMPONENT STYLES — App Dashboard & Data Pages
   ============================================================================= */

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
}
.page-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.page-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Connection Badge */
.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}
.connection-badge.connected {
  background: var(--success-light);
  color: #166534;
}
.connection-badge.disconnected {
  background: var(--error-light);
  color: #991B1B;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}
.disconnected .pulse-dot {
  background: var(--error);
  animation: none;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-content {
  flex: 1;
  min-width: 0;
}
.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-trend {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--error); }

/* Charts Row */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.card-body {
  /* content area */
}
.card-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}
.card-link:hover { text-decoration: underline; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.chart-wide { grid-column: span 2; }
.chart-narrow { }
.chart-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: 14px;
}

/* Bar Chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding-top: var(--space-4);
  position: relative;
}
.bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bar {
  width: 100%;
  max-width: 32px;
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
  transition: background 150ms ease-out;
  min-height: 2px;
}
.bar:hover { background: var(--primary); }
.bar-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Donut Chart */
.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-hole {
  width: 100px;
  height: 100px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-total {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.donut-label {
  font-size: 11px;
  color: var(--text-muted);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label { color: var(--text-secondary); }
.legend-value { color: var(--text-muted); font-size: 11px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-success { background: var(--success-light); color: #166534; }
.badge-error { background: var(--error-light); color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info { background: var(--info-light); color: #1E40AF; }
.badge-neutral { background: var(--surface-hover); color: var(--text-secondary); }

/* Data display */
.phone-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}
.duration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Clickable table rows */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--surface-hover); }

/* Tables (app) */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }

/* Search + Filters */
.search-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  min-width: 200px;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-50);
}
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

/* Filter pills */
.filter-pills {
  display: flex;
  gap: var(--space-2);
}
.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease-out;
}
.filter-pill:hover { background: var(--surface-hover); }
.filter-pill.active {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-light);
}

/* Buttons (app) */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 150ms ease-out;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* Form groups */
.form-group {
  margin-bottom: var(--space-4);
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-50);
}
.form-group textarea {
  resize: vertical;
  min-height: 100px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Doctor cards grid */
.doctor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.doctor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: box-shadow 150ms, transform 150ms;
}
.doctor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.doctor-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}
.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Transcript */
.transcript {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-4);
  background: var(--bg);
  border-radius: var(--radius-md);
}
.transcript-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
}
.transcript-bubble.ai {
  background: var(--primary-50);
  color: var(--primary-dark);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.transcript-bubble.patient {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.transcript-speaker {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Audio player */
.audio-player {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.audio-waveform {
  flex: 1;
  height: 32px;
  background: repeating-linear-gradient(90deg, var(--primary-light) 0px, var(--primary-light) 2px, transparent 2px, transparent 4px);
  border-radius: 4px;
  opacity: 0.5;
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.info-item label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.info-item span, .info-item p {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Detail page back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  cursor: pointer;
  text-decoration: none;
}
.back-link:hover { color: var(--primary); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
}
.empty-state p { margin-bottom: var(--space-4); }

/* Heatmap */
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
}
.heatmap-table td {
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--border);
}
.heatmap-cell {
  border-radius: 4px;
}

/* Horizontal bar chart */
.h-bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.h-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.h-bar-label {
  width: 120px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}
.h-bar {
  height: 24px;
  border-radius: 4px;
  background: var(--primary-light);
  transition: width 300ms ease-out;
}
.h-bar-value {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: var(--space-2);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}
.pagination button:hover { background: var(--surface-hover); }
.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.pagination span {
  font-size: 13px;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 150ms;
}
.toggle.active { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 150ms;
}
.toggle.active::after { transform: translateX(20px); }

/* Responsive overrides for app pages */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .stat-cards { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: var(--space-3); }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .info-grid { grid-template-columns: 1fr; }
  .doctor-grid { grid-template-columns: 1fr; }
}

/* ========================================
   CALL SIMULATOR — LIVE DEMO
   ======================================== */

/* Split layout */
.simulator-container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  height: calc(100vh - 140px);
  min-height: 500px;
}

/* Phone interface */
.simulator-phone {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.phone-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phone-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.phone-status .pulse-dot {
  width: 10px;
  height: 10px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

.phone-header .phone-number {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

.call-timer {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 20px;
}

/* Conversation area */
.conversation {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.sim-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
  position: relative;
}

.sim-message.ai {
  align-self: flex-start;
  background: var(--primary);
  color: white;
  border-bottom-left-radius: 4px;
}

.sim-message.patient {
  align-self: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.sim-message.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: 6px 12px;
  max-width: 90%;
  text-align: center;
}

.sim-message .speaker-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.sim-message.ai .speaker-label { color: rgba(255,255,255,0.7); }
.sim-message.patient .speaker-label { color: var(--text-muted); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  max-width: 80px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  background: var(--primary);
}

.typing-indicator.patient-typing {
  align-self: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: typingBounce 1.2s infinite;
}

.typing-indicator.patient-typing .typing-dot {
  background: var(--text-muted);
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Phone controls */
.phone-controls {
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: center;
}

.phone-controls .btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
}

/* Ringing animation */
.phone-ringing {
  animation: phoneRing 0.5s ease infinite alternate;
}

@keyframes phoneRing {
  0% { transform: rotate(-2deg); }
  100% { transform: rotate(2deg); }
}

/* ========================================
   CALL SIMULATOR — DOCTOLIB CALENDAR
   ======================================== */

.simulator-calendar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.calendar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.calendar-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.calendar-week {
  display: grid;
  grid-template-columns: 60px repeat(5, 1fr);
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
}

.calendar-day-header {
  padding: 10px 4px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.calendar-day-header .day-name { color: var(--text-muted); }
.calendar-day-header .day-number {
  font-size: 16px;
  color: var(--text);
  margin-top: 2px;
}

.calendar-time-label {
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: right;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 36px;
}

.calendar-slot {
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(0,0,0,0.03);
  padding: 2px 3px;
  cursor: default;
  transition: all 0.3s ease;
  position: relative;
}

.calendar-slot.available {
  background: rgba(16, 185, 129, 0.06);
}

.calendar-slot.available::after {
  content: 'Disponible';
  font-size: 10px;
  color: var(--success);
  opacity: 0.6;
}

.calendar-slot.booked {
  background: var(--bg);
}

.calendar-slot.booked .slot-content {
  background: rgba(107, 114, 128, 0.1);
  border-left: 3px solid #9ca3af;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--text-muted);
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Calendar animation states */
.calendar-slot.checking {
  background: rgba(251, 191, 36, 0.15);
  animation: slotCheck 0.6s ease infinite alternate;
}

@keyframes slotCheck {
  0% { background: rgba(251, 191, 36, 0.1); }
  100% { background: rgba(251, 191, 36, 0.25); }
}

.calendar-slot.unavailable-flash {
  background: rgba(239, 68, 68, 0.12);
  transition: background 0.5s ease;
}

.calendar-slot.highlight-available {
  background: rgba(16, 185, 129, 0.15);
  box-shadow: inset 0 0 0 2px var(--success);
  animation: slotPulse 1s ease infinite;
}

@keyframes slotPulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--success); }
  50% { box-shadow: inset 0 0 0 3px var(--success), 0 0 8px rgba(16, 185, 129, 0.3); }
}

.calendar-slot.booking {
  background: rgba(14, 165, 233, 0.15);
  animation: slotBooking 0.8s ease infinite;
}

@keyframes slotBooking {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.calendar-slot.just-booked {
  background: rgba(16, 185, 129, 0.2);
  box-shadow: inset 0 0 0 2px var(--success);
}

.calendar-slot.just-booked .slot-content {
  background: var(--success);
  color: white;
  border-left: none;
  font-weight: 600;
  animation: fadeIn 0.5s ease;
}

/* Scenario selector */
.scenario-selector {
  margin-top: 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
}

.scenario-selector h4 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.scenario-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scenario-btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-btn:hover {
  border-color: var(--primary);
  background: rgba(15, 118, 110, 0.05);
  color: var(--primary);
}

.scenario-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Call result summary */
.call-result {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  animation: fadeIn 0.5s ease;
}

.call-result h4 {
  margin: 0 0 8px;
  color: var(--success);
  font-size: 14px;
}

.call-result .result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.call-result .result-item {
  display: flex;
  gap: 6px;
}

.call-result .result-label {
  color: var(--text-muted);
}

.call-result .result-value {
  color: var(--text);
  font-weight: 600;
}

/* ========================================
   CALL SIMULATOR — RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .simulator-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .simulator-phone { min-height: 400px; }
  .simulator-calendar { min-height: 350px; }
}

@media (max-width: 768px) {
  .scenario-buttons {
    flex-direction: column;
  }
  .phone-header {
    flex-wrap: wrap;
    gap: 8px;
  }
}
