/* ============================================
   GrokDent FL — Premium Design System
   AI Voice Receptionist for Florida Dental Clinics
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.03);
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Accent Colors */
  --accent-teal: #0d9488;
  --accent-coral: #f97316;
  --accent-gradient: linear-gradient(135deg, #0d9488, #f97316);
  --accent-gradient-reverse: linear-gradient(135deg, #f97316, #0d9488);
  --accent-teal-soft: rgba(13, 148, 136, 0.15);
  --accent-coral-soft: rgba(249, 115, 22, 0.15);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-tertiary: #55556a;
  --text-accent: #0d9488;

  /* Status Colors */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.15);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(13, 148, 136, 0.3);

  /* Spacing (4px increments) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-md: 15px;
  --font-lg: 16px;
  --font-xl: 18px;
  --font-2xl: 20px;
  --font-3xl: 24px;
  --font-4xl: 30px;
  --font-5xl: 36px;
  --font-6xl: 48px;
  --line-height: 1.6;
  --line-height-tight: 1.3;

  /* Font Weights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(13, 148, 136, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-modal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  line-height: var(--line-height);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Typography ---------- */
h1 {
  font-size: var(--font-4xl);
  font-weight: var(--fw-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.5px;
}

h2 {
  font-size: var(--font-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.3px;
}

h3 {
  font-size: var(--font-2xl);
  font-weight: var(--fw-semibold);
  line-height: var(--line-height-tight);
}

h4 {
  font-size: var(--font-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--line-height-tight);
}

h5 {
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
}

h6 {
  font-size: var(--font-base);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

p {
  color: var(--text-secondary);
  line-height: var(--line-height);
}

.text-sm {
  font-size: var(--font-sm);
}

.text-lg {
  font-size: var(--font-lg);
}

.text-xl {
  font-size: var(--font-xl);
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  font-size: var(--font-3xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-10);
  padding: 0 var(--space-4);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-nav {
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-base);
  margin-bottom: var(--space-1);
  font-weight: var(--fw-medium);
  font-size: var(--font-base);
  border: 1px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(249, 115, 22, 0.15));
  color: var(--text-primary);
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.sidebar-nav .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}

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

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--font-sm);
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: var(--fw-semibold);
  font-size: var(--font-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.sidebar-logout {
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  padding: var(--space-1);
}

.sidebar-logout:hover {
  color: var(--danger);
}

/* ---------- Main Content ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  padding: var(--space-8);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-8);
}

.topbar h1 {
  font-size: var(--font-3xl);
}

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

.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 18px;
}

.notification-bell:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.notification-bell .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

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

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

.card-header h3 {
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
}

.card-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* ---------- Metric Cards ---------- */
.metric-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-card .icon {
  font-size: 32px;
  margin-bottom: var(--space-3);
  display: block;
}

.metric-card .value {
  font-size: var(--font-5xl);
  font-weight: var(--fw-bold);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.metric-card .label {
  color: var(--text-secondary);
  font-size: var(--font-base);
  margin-top: var(--space-1);
  font-weight: var(--fw-medium);
}

.metric-card .trend {
  font-size: var(--font-sm);
  margin-top: var(--space-2);
  font-weight: var(--fw-medium);
}

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

.trend.down {
  color: var(--danger);
}

.trend.neutral {
  color: var(--text-secondary);
}

/* ---------- Grids ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

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

/* ---------- Buttons ---------- */
.btn {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: var(--fw-semibold);
  font-size: var(--font-base);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

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

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-lg);
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Form Inputs ---------- */
.input,
.select,
.textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-base);
  width: 100%;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-tertiary);
}

.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='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

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

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

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-error {
  color: var(--danger);
  font-size: var(--font-sm);
  margin-top: var(--space-1);
}

/* ---------- Toggle Switch ---------- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-base);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-teal);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ---------- Checkbox ---------- */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--font-sm);
}

.checkbox-item:hover {
  border-color: var(--border-light);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 16px;
  height: 16px;
}

.checkbox-item.checked,
.checkbox-item:has(input:checked) {
  border-color: var(--accent-teal);
  background: var(--accent-teal-soft);
}

/* ---------- Badges ---------- */
.badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: var(--fw-semibold);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

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

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

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ---------- Tables ---------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

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

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: var(--font-sm);
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

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

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  background: var(--bg-card);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.tab {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-base);
  border: none;
  background: none;
  font-family: inherit;
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ---------- Live Indicator ---------- */
.live-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-sm);
  color: var(--success);
  font-weight: var(--fw-medium);
}

.live-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

/* ---------- Call Items ---------- */
.call-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background var(--transition-base);
}

.call-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.call-item:last-child {
  border-bottom: none;
}

.call-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-teal-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.call-item-info {
  flex: 1;
  min-width: 0;
}

.call-item-name {
  font-weight: var(--fw-medium);
  font-size: var(--font-sm);
}

.call-item-meta {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.call-item-right {
  text-align: right;
  flex-shrink: 0;
}

.call-item-duration {
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
}

.call-item-sentiment {
  font-size: 16px;
  margin-top: 2px;
}

/* ---------- Appointment Items ---------- */
.appointment-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: var(--space-2);
  background: rgba(255, 255, 255, 0.02);
  transition: background var(--transition-base);
}

.appointment-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.appointment-item.confirmed {
  border-left-color: var(--success);
}

.appointment-item.pending {
  border-left-color: var(--warning);
}

.appointment-item.cancelled {
  border-left-color: var(--danger);
}

.appointment-time {
  font-weight: var(--fw-semibold);
  font-size: var(--font-sm);
  color: var(--accent-teal);
  min-width: 70px;
}

.appointment-info {
  flex: 1;
  min-width: 0;
}

.appointment-patient {
  font-weight: var(--fw-medium);
  font-size: var(--font-sm);
}

.appointment-service {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

/* ---------- Transcript Bubbles ---------- */
.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  max-height: 400px;
  overflow-y: auto;
}

.transcript-bubble {
  max-width: 80%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--font-base);
  line-height: var(--line-height);
}

.transcript-bubble.ai {
  background: var(--accent-teal-soft);
  border-bottom-left-radius: var(--space-1);
  align-self: flex-start;
}

.transcript-bubble.patient {
  background: var(--accent-coral-soft);
  border-bottom-right-radius: var(--space-1);
  align-self: flex-end;
}

.transcript-speaker {
  font-size: var(--font-xs);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-modal);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-modal);
  box-shadow: var(--shadow-xl);
}

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

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

.modal-header h3 {
  font-size: var(--font-xl);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-footer {
  margin-top: var(--space-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  z-index: 2000;
  animation: slideIn 0.3s ease;
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 400px;
}

.toast-success {
  background: rgba(16, 185, 129, 0.95);
  color: white;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: white;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.toast-warning {
  background: rgba(245, 158, 11, 0.95);
  color: white;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.toast-info {
  background: rgba(59, 130, 246, 0.95);
  color: white;
  border: 1px solid rgba(59, 130, 246, 0.5);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
}

/* ---------- Plan Cards ---------- */
.plan-card {
  border: 2px solid transparent;
  position: relative;
  text-align: center;
  padding: var(--space-8) var(--space-6) !important;
}

.plan-card.featured {
  border-color: var(--accent-teal);
  box-shadow: var(--shadow-glow);
}

.plan-card .plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gradient);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: var(--fw-semibold);
  color: white;
  white-space: nowrap;
}

.plan-name {
  font-size: var(--font-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-2);
}

.plan-price {
  font-size: var(--font-5xl);
  font-weight: var(--fw-bold);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.plan-price span {
  font-size: var(--font-lg);
  font-weight: var(--fw-regular);
  -webkit-text-fill-color: var(--text-secondary);
}

.plan-features {
  list-style: none;
  margin: var(--space-6) 0;
  text-align: left;
}

.plan-features li {
  padding: var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.plan-features li::before {
  content: '✅';
  font-size: 14px;
}

/* ---------- Quick Actions ---------- */
.quick-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ---------- Filters Bar ---------- */
.filters-bar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.filters-bar .input,
.filters-bar .select {
  width: auto;
  min-width: 160px;
}

.search-input {
  position: relative;
}

.search-input .input {
  padding-left: 40px;
}

.search-input::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  z-index: 1;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
}

.pagination-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* ---------- Week View ---------- */
.week-view {
  overflow-x: auto;
}

.week-header {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 1px;
}

.week-header-cell {
  padding: var(--space-3) var(--space-2);
  text-align: center;
  font-size: var(--font-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

.week-header-cell.today {
  color: var(--accent-teal);
}

.week-body {
  position: relative;
}

.week-row {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 1px;
  border-bottom: 1px solid var(--border-subtle);
}

.week-time {
  padding: var(--space-2);
  font-size: var(--font-xs);
  color: var(--text-secondary);
  text-align: right;
  padding-right: var(--space-3);
}

.week-cell {
  min-height: 60px;
  border-left: 1px solid var(--border-subtle);
  padding: var(--space-1);
  position: relative;
}

.week-appointment {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  margin-bottom: 2px;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.week-appointment:hover {
  opacity: 0.8;
}

.week-appointment.service-general {
  background: var(--accent-teal-soft);
  border-left: 2px solid var(--accent-teal);
}

.week-appointment.service-cosmetic {
  background: var(--accent-coral-soft);
  border-left: 2px solid var(--accent-coral);
}

.week-appointment.service-emergency {
  background: var(--danger-soft);
  border-left: 2px solid var(--danger);
}

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

.stat-mini {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stat-mini-value {
  font-size: var(--font-xl);
  font-weight: var(--fw-bold);
}

.stat-mini-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

/* ---------- KB Cards ---------- */
.kb-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kb-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-base);
}

.kb-item:hover {
  border-color: var(--border-light);
}

.kb-question {
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-2);
}

.kb-answer {
  color: var(--text-secondary);
  font-size: var(--font-sm);
  line-height: var(--line-height);
}

.kb-item-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) 0;
  gap: var(--space-4);
  color: var(--text-secondary);
}

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

.empty-state-icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  color: var(--text-secondary);
  font-size: var(--font-sm);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* ---------- Login / Signup Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-6);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  pointer-events: none;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-teal);
  top: -200px;
  left: -200px;
  animation: float 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-coral);
  bottom: -150px;
  right: -150px;
  animation: float 25s ease-in-out infinite reverse;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: #8b5cf6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float 15s ease-in-out infinite 3s;
}

.login-card {
  background: rgba(18, 18, 26, 0.8);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-10) var(--space-10);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-xl);
  animation: fadeIn 0.8s ease;
}

.signup-card {
  background: rgba(18, 18, 26, 0.8);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 640px;
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-xl);
  animation: fadeIn 0.8s ease;
}

.login-logo {
  text-align: center;
  font-size: var(--font-4xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-2);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  margin-bottom: var(--space-8);
}

.login-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.login-footer a {
  color: var(--accent-teal);
  font-weight: var(--fw-medium);
}

.login-footer a:hover {
  text-decoration: underline;
}

.login-error {
  color: var(--danger);
  font-size: var(--font-sm);
  text-align: center;
  margin-top: var(--space-3);
  min-height: 20px;
}

.page-footer {
  position: fixed;
  bottom: var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  z-index: 10;
}

/* ---------- Signup Steps ---------- */
.signup-steps {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.signup-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  font-weight: var(--fw-bold);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.signup-step.active .step-number {
  background: var(--accent-gradient);
  color: white;
}

.signup-step.completed .step-number {
  background: var(--success);
  color: white;
}

.step-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  display: none;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 var(--space-1);
}

.signup-step.completed + .step-connector,
.step-connector.completed {
  background: var(--accent-teal);
}

.signup-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-8);
}

/* ---------- Invoice Table ---------- */
.invoice-table {
  margin-top: var(--space-8);
}

/* ---------- Date Range Buttons ---------- */
.date-range {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-card);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.date-range-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
  transition: all var(--transition-base);
}

.date-range-btn:hover {
  color: var(--text-primary);
}

.date-range-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ---------- Chart Container ---------- */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 250px;
}

/* ---------- Side Panel ---------- */
.side-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 480px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 500;
  transition: right var(--transition-slow);
  overflow-y: auto;
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
}

.side-panel.open {
  right: 0;
}

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

/* ---------- Mobile Sidebar Toggle ---------- */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-size: 24px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

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

.mb-6 {
  margin-bottom: var(--space-6);
}

.text-center {
  text-align: center;
}

/* ---------- Keyframes ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(13, 148, 136, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(13, 148, 136, 0.25);
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(30px, -30px);
  }
  50% {
    transform: translate(-20px, 20px);
  }
  75% {
    transform: translate(20px, 10px);
  }
}

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

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Animation utility classes */
.animate-fadeIn {
  animation: fadeIn 0.5s ease;
}

.animate-slideUp {
  animation: slideUp 0.5s ease;
}

.animate-slideIn {
  animation: slideIn 0.3s ease;
}

/* Shimmer placeholder */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .three-col {
    grid-template-columns: 1fr;
  }
}

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

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

  .week-header,
  .week-row {
    grid-template-columns: 60px repeat(7, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 300;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

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

  .topbar {
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .metric-card .value {
    font-size: var(--font-3xl);
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-bar .input,
  .filters-bar .select {
    width: 100%;
    min-width: unset;
  }

  .login-card {
    padding: var(--space-6);
  }

  .signup-card {
    padding: var(--space-6);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    width: 95%;
    padding: var(--space-6);
  }

  .pagination {
    flex-wrap: wrap;
  }

  .side-panel {
    width: 100%;
    right: -100%;
  }

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

  .quick-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: var(--font-2xl);
  }

  .topbar h1 {
    font-size: var(--font-2xl);
  }

  .signup-steps {
    gap: var(--space-1);
  }

  .step-connector {
    width: 20px;
  }
}

/* ---------- Print ---------- */
@media print {
  .sidebar,
  .sidebar-toggle,
  .topbar-actions,
  .quick-actions {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid #ddd;
    background: white;
  }
}
