/* ===== CSS VARIABLES & THEME SYSTEM ===== */
:root {
  --primary: #0ea5ff;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --secondary: #0f172a;
  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --text: #1f2937;
  --text-muted: #64748b;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.2);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.3);
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-size: 16px;
  --btn-height: 48px;
  --input-height: 48px;
  --touch-target: 48px;
  --sidebar-width: 260px;
  --toolbar-height: 56px;
  --transition: all 0.2s ease;
}

body[data-theme="dark"] {
  --primary: #38bdf8;
  --primary-dark: #0ea5ff;
  --primary-light: #1e3a5f;
  --secondary: #f1f5f9;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
}

body.high-contrast {
  --primary: #0066cc;
  --text: #000000;
  --bg: #ffffff;
  --bg-alt: #ffffff;
  --border: #000000;
  --text-muted: #333333;
}

body[data-theme="dark"].high-contrast {
  --primary: #66b3ff;
  --text: #ffffff;
  --bg: #000000;
  --bg-alt: #000000;
  --border: #ffffff;
  --text-muted: #cccccc;
}

body.font-large {
  --font-size: 20px;
  --btn-height: 56px;
  --input-height: 56px;
  --touch-target: 56px;
  --sidebar-width: 300px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video { max-width: 100%; height: auto; display: block; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  font-size: var(--font-size);
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== ACCESSIBILITY MODAL ===== */

.access-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}
.access-modal-overlay.active { display: flex; }

.access-toolbar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: accessModalIn 0.28s ease;
}
@keyframes accessModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.access-toolbar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
}
.access-toolbar-heading { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.access-toolbar-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.access-toolbar-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.3;
}
.access-toolbar-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.access-toolbar-close {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.access-toolbar-close:hover { background: var(--border); color: var(--text); }

.access-toolbar-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.access-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  transition: var(--transition);
}
.access-section:hover { border-color: rgba(14, 165, 255, 0.25); }
.access-section-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.access-section-info { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.access-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.access-icon-package { background: var(--warning-light); color: #d97706; }
.access-icon-text { background: var(--primary-light); color: var(--primary); }
.access-icon-contrast { background: var(--success-light); color: var(--success); }
.access-section-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
  line-height: 1.3;
}
.access-section-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.toggle-group {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.access-toggle-group { width: 100%; }
.toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  min-height: 40px;
  font-family: 'Poppins', sans-serif;
  text-align: center;
}
.toggle-btn:hover { background: var(--bg-alt); color: var(--text); }
.toggle-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(14, 165, 255, 0.25);
}
.toggle-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.option-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.option-a { background: var(--warning-light); color: #b45309; }
.option-b { background: var(--primary-light); color: var(--primary-dark); }

.access-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 2px;
}
.access-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Poppins', sans-serif;
  text-align: left;
  min-height: 108px;
}
.access-action-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.access-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.access-action-card:hover .access-action-icon {
  background: var(--primary);
  color: white;
}
.access-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
}
.access-action-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}
.voice-btn.recording {
  border-color: var(--danger);
  background: var(--danger-light);
}
.voice-btn.recording .access-action-icon {
  background: var(--danger);
  color: white;
  animation: pulse 1.5s infinite;
}
.voice-btn.recording .access-action-label { color: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ===== MOBILE HEADER ===== */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--bg); border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; padding: 0 16px; z-index: 999; }
.mobile-header-actions { display: flex; align-items: center; gap: 4px; }
.mobile-access-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.mobile-access-btn:hover { background: var(--bg-alt); color: var(--primary); }
.mobile-access-btn.active { color: var(--primary); background: var(--primary-light); }
.mobile-menu-btn, .mobile-search-btn { background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; border-radius: 8px; min-width: var(--touch-target); min-height: var(--touch-target); display: flex; align-items: center; justify-content: center; }
.mobile-menu-btn:hover, .mobile-search-btn:hover { background: var(--bg-alt); }
.mobile-logo { display: flex; align-items: center; gap: 10px; }
.mobile-logo .logo-icon { width: 36px; height: 36px; font-size: 16px; }
.mobile-logo .logo-text { font-weight: 700; font-size: 16px; color: var(--secondary); }
.mobile-search-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 2001; display: none; flex-direction: column; }
.mobile-search-overlay.active { display: flex; }
.mobile-search-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mobile-search-close { background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; }
.mobile-search-input { flex: 1; border: none; background: none; font-family: 'Poppins', sans-serif; font-size: 16px; color: var(--text); outline: none; }
.mobile-search-results { flex: 1; overflow-y: auto; padding: 8px 16px; }

/* ===== APP CONTAINER ===== */
.app-container { display: flex; min-height: 100vh; width: 100%; overflow-x: clip; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 899; }

/* ===== SIDEBAR ===== */
.sidebar { width: var(--sidebar-width); background: var(--bg); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 8px; position: fixed; inset: 0 auto 0 0; height: auto; overflow-y: auto; z-index: 900; transition: transform 0.3s ease, width 0.3s ease; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 20px; border-bottom: 2px solid var(--border); margin-bottom: 8px; }
.sidebar-header-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-access-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; border-radius: 8px; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.sidebar-access-btn:hover { background: var(--bg-alt); color: var(--primary); }
.sidebar-access-btn.active { color: var(--primary); background: var(--primary-light); }
.sidebar-close { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; border-radius: 8px; }
.sidebar-close:hover { background: var(--bg-alt); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 48px; height: 48px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; font-weight: 700; flex-shrink: 0; }
.logo-text h1 { font-size: 16px; font-weight: 700; color: var(--secondary); line-height: 1.2; }
.logo-text p { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); color: var(--text-muted); font-weight: 500; min-height: var(--touch-target); position: relative; }
.nav-item:hover { background: var(--bg-alt); color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; }
.nav-item svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--danger); color: white; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.3); }
.sidebar-footer { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--border); position: relative; }
.user-card { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 8px; border-radius: var(--radius); transition: var(--transition); }
.user-card:hover { background: var(--bg-alt); }
.user-avatar { width: 40px; height: 40px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.user-info h4 { font-size: 14px; font-weight: 600; }
.user-info p { font-size: 12px; color: var(--text-muted); }
.user-chevron { margin-left: auto; transition: transform 0.2s ease; color: var(--text-muted); }
.user-card:hover .user-chevron { transform: rotate(180deg); }
.user-menu { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px 0; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.2s ease; z-index: 10; }
.user-card:hover + .user-menu, .user-menu:hover { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; width: 100%; border: none; background: none; color: var(--text); font-family: 'Poppins', sans-serif; font-size: 14px; cursor: pointer; transition: var(--transition); text-align: left; }
.user-menu-item:hover { background: var(--bg-alt); color: var(--primary); }
.user-menu-item.text-danger { color: var(--danger); }
.user-menu-item.text-danger:hover { background: var(--danger-light); }
.user-menu-divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ===== MAIN CONTENT ===== */
.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 32px; max-width: calc(100% - var(--sidebar-width)); min-height: 100vh; min-width: 0; width: 100%; }
.page { display: none; animation: fadeIn 0.3s ease; min-width: 0; width: 100%; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; width: 100%; }
.page-title { min-width: 0; flex: 1 1 240px; }
.page-title h2 { font-size: 28px; font-weight: 700; color: var(--secondary); line-height: 1.2; }
.page-title p { color: var(--text-muted); font-size: 15px; margin-top: 4px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 24px; height: var(--btn-height); border-radius: var(--radius); border: none; font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition); min-width: 120px; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-lg { padding: 0 32px; height: calc(var(--btn-height) + 8px); font-size: 17px; }
.btn-sm { padding: 0 16px; height: calc(var(--btn-height) - 8px); font-size: 13px; min-width: auto; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== CARDS ===== */
.card { background: var(--bg); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow); transition: var(--transition); min-width: 0; width: 100%; }
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 18px; font-weight: 600; color: var(--secondary); }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--bg); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow); transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: #d97706; }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-value { font-size: 32px; font-weight: 700; color: var(--secondary); line-height: 1; }
.stat-label { font-size: 14px; color: var(--text-muted); margin-top: 8px; }
.stat-change { font-size: 13px; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== SEARCH ===== */
.search-box { position: relative; width: 100%; max-width: 480px; }
.search-box input { width: 100%; height: var(--input-height); padding: 0 16px 0 48px; border: 2px solid var(--border); border-radius: var(--radius); font-family: 'Poppins', sans-serif; font-size: 15px; transition: var(--transition); background: var(--bg); color: var(--text); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,255,0.1); }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; z-index: 100; display: none; }
.search-results.active { display: block; }
.search-result-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; transition: var(--transition); }
.search-result-item:hover { background: var(--bg-alt); }
.search-result-item:last-child { border-bottom: none; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--secondary); }
.form-label .required { color: var(--danger); }
.form-hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
input, select, textarea { width: 100%; height: var(--input-height); padding: 0 16px; border: 2px solid var(--border); border-radius: var(--radius); font-family: 'Poppins', sans-serif; font-size: 15px; background: var(--bg); color: var(--text); transition: var(--transition); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,255,0.1); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg-alt); cursor: not-allowed; opacity: 0.7; }
input.error, select.error, textarea.error { border-color: var(--danger); animation: shake 0.3s ease; }
textarea { height: auto; padding: 16px; min-height: 120px; resize: vertical; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 32px; flex-wrap: wrap; }
.voice-input-wrapper { position: relative; display: flex; align-items: center; }
.voice-input-wrapper input, .voice-input-wrapper textarea { padding-right: 48px; }
.voice-input-btn { position: absolute; right: 8px; background: none; border: none; cursor: pointer; color: var(--primary); padding: 8px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.voice-input-btn:hover { background: rgba(14,165,255,0.1); }
.voice-input-btn.recording { color: var(--danger); background: rgba(239,68,68,0.1); }
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 48px; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 8px; border-radius: 8px; }
.password-toggle:hover { color: var(--text); }

/* ===== SECTION DIVIDER ===== */
.section-divider { display: flex; align-items: center; gap: 16px; margin: 32px 0; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-divider span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); white-space: nowrap; }

/* ===== DEMO BANNER ===== */
.demo-banner { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; padding: 16px 24px; border-radius: var(--radius-lg); margin-bottom: 24px; display: flex; align-items: center; gap: 16px; }
.demo-banner svg { width: 32px; height: 32px; flex-shrink: 0; }
.demo-banner h3 { font-size: 16px; font-weight: 600; }
.demo-banner p { font-size: 13px; opacity: 0.9; }

/* ===== DASHBOARD ===== */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.dashboard-sidebar { display: flex; flex-direction: column; gap: 24px; }

/* ===== RECENT LIST ===== */
.recent-list { display: flex; flex-direction: column; gap: 12px; }
.recent-item { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.recent-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.recent-avatar { width: 48px; height: 48px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 16px; flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; }
.recent-info h4 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-info p { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ===== ALERTS ===== */
.alert-list { display: flex; flex-direction: column; gap: 12px; }
.alert-item { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); transition: var(--transition); }
.alert-item:hover { border-color: var(--primary); }
.alert-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon.warning { background: var(--warning-light); color: #d97706; }
.alert-icon.danger { background: var(--danger-light); color: var(--danger); }
.alert-icon.info { background: var(--primary-light); color: var(--primary); }
.alert-content h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.alert-content p { font-size: 13px; color: var(--text-muted); }

/* ===== TABLE ===== */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; padding: 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 2px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { color: var(--primary); }
.sort-indicator { margin-left: 4px; opacity: 0.5; font-size: 10px; }
th:hover .sort-indicator { opacity: 1; }
td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
tr:hover td { background: var(--bg-alt); }

/* ===== STATUS BADGES ===== */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status-scheduled { background: var(--primary-light); color: var(--primary); }
.status-confirmed { background: var(--success-light); color: #166534; }
.status-completed { background: var(--success-light); color: #166534; }
.status-cancelled { background: var(--danger-light); color: #991b1b; }
.status-pending { background: var(--warning-light); color: #92400e; }
.status-overdue { background: var(--danger-light); color: #991b1b; }
.status-paid { background: var(--success-light); color: #166534; }
.status-active { background: var(--primary-light); color: var(--primary); }

/* ===== FEATURE TAGS ===== */
.feature-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.tag-option-b { background: #dbeafe; color: #1e40af; }
.tag-option-a { background: var(--warning-light); color: #92400e; }

/* ===== OPTION TOGGLE ===== */
.option-b-only { display: none; }
body.show-option-b .option-b-only { display: block; }
body.show-option-b .option-a-only { display: none; }
.option-b-inline { display: none !important; }
body.show-option-b .option-b-inline { display: flex !important; }
body.show-option-b .option-a-inline { display: none !important; }

/* ===== OPTION NOTE ===== */
.option-note { background: var(--primary-light); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 16px 0; font-size: 13px; color: var(--text-muted); }
.option-note strong { color: var(--primary); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab { padding: 12px 20px; border: none; background: none; font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: var(--transition); min-height: var(--touch-target); white-space: nowrap; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ===== TOOTH CHART ===== */
.tooth-chart-container { display: flex; flex-direction: column; align-items: center; gap: 40px; padding: 40px; }
.jaw-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.jaw-label { text-align: center; font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 16px; }
.tooth { width: 48px; height: 64px; border: 2px solid var(--border); border-radius: 8px 8px 4px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); background: var(--bg); position: relative; }
.tooth:hover { transform: scale(1.1); border-color: var(--primary); }
.tooth-number { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.tooth-status { width: 20px; height: 20px; border-radius: 50%; margin-top: 4px; }
.tooth.healthy .tooth-status { background: var(--success); }
.tooth.decayed .tooth-status { background: var(--danger); }
.tooth.filled .tooth-status { background: var(--warning); }
.tooth.extracted .tooth-status { background: var(--text-muted); opacity: 0.3; }
.tooth.crown .tooth-status { background: #c0c0c0; }
.tooth.root-canal .tooth-status { background: #8b5cf6; }
.tooth-legend { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend-dot { width: 16px; height: 16px; border-radius: 50%; }

/* ===== FILE UPLOAD ===== */
.upload-zone { border: 3px dashed var(--border); border-radius: var(--radius-lg); padding: 48px; text-align: center; cursor: pointer; transition: var(--transition); background: var(--bg); }
.upload-zone:hover { border-color: var(--primary); background: rgba(14,165,255,0.03); }
.upload-zone.drag-over { border-color: var(--primary); background: rgba(14,165,255,0.05); }
.upload-zone svg { width: 64px; height: 64px; color: var(--primary); margin-bottom: 16px; }
.upload-zone h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.file-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 24px; }
.file-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: var(--transition); }
.file-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.file-thumb { height: 120px; background: var(--bg-alt); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-info { padding: 12px; }
.file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== CALENDAR ===== */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.calendar-title-group { display: flex; align-items: center; gap: 16px; }
.calendar-nav { display: flex; gap: 8px; }
.calendar-views { display: flex; gap: 4px; }
.calendar-views .btn-sm.active { background: var(--primary); color: white; border-color: var(--primary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 100%; min-width: 0; }
.calendar-day-header { text-align: center; padding: 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; min-width: 0; }
.calendar-day { aspect-ratio: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; cursor: pointer; transition: var(--transition); position: relative; background: var(--bg); min-height: 80px; min-width: 0; overflow: hidden; }
.calendar-day:hover { border-color: var(--primary); }
.calendar-day.today { border-color: var(--primary); background: rgba(14,165,255,0.05); }
.calendar-day.other-month { opacity: 0.4; }
.day-number { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.day-appointments { display: flex; flex-direction: column; gap: 2px; }
.day-appt { font-size: 10px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-appt.cleaning { background: var(--primary-light); color: var(--primary); }
.day-appt.treatment { background: var(--warning-light); color: #d97706; }
.day-appt.checkup { background: var(--success-light); color: var(--success); }
.day-appt.followup { background: var(--bg-alt); color: var(--text-muted); }
.day-appt.emergency { background: var(--danger-light); color: var(--danger); }

/* ===== INVOICE ===== */
.invoice-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.invoice-preview-card { position: sticky; top: 80px; }
.invoice-preview { background: var(--bg); border-radius: var(--radius-lg); padding: 40px; max-width: 700px; margin: 0 auto; }
.invoice-header { display: flex; justify-content: space-between; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 2px solid var(--border); }
.invoice-logo { font-size: 24px; font-weight: 700; color: var(--primary); }
.invoice-meta { text-align: right; }
.invoice-meta h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 4px; }
.invoice-meta p { font-size: 16px; font-weight: 600; }
.invoice-body { margin-bottom: 32px; }
.invoice-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.invoice-row.total { border-top: 2px solid var(--secondary); border-bottom: none; font-size: 20px; font-weight: 700; color: var(--secondary); margin-top: 8px; padding-top: 16px; }

/* ===== PAYMENT METHODS ===== */
.payment-methods { display: flex; gap: 12px; flex-wrap: wrap; }
.payment-method { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: var(--transition); background: var(--bg); }
.payment-method:hover { border-color: var(--primary); }
.payment-method.selected { border-color: var(--primary); background: rgba(14,165,255,0.05); }
.payment-method svg { width: 24px; height: 24px; }
.payment-method span { font-size: 14px; font-weight: 500; }

/* ===== COMPARISON SLIDER ===== */
.comparison-container { position: relative; width: 100%; max-width: 500px; height: 300px; overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); touch-action: none; }
.comparison-before, .comparison-after { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; }
.comparison-before { background: var(--danger-light); color: var(--danger); clip-path: inset(0 50% 0 0); }
.comparison-after { background: var(--success-light); color: var(--success); }
.comparison-slider { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; background: white; cursor: ew-resize; box-shadow: 0 0 10px rgba(0,0,0,0.3); }
.comparison-slider::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; background: white; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* ===== TIMELINE ===== */
.timeline { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding: 16px 0 16px 24px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 20px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg); }
.timeline-item.completed::before { background: var(--success); }
.timeline-item.pending::before { background: var(--warning); }
.timeline-date { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.timeline-title { font-size: 15px; font-weight: 600; margin-top: 4px; }
.timeline-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== BADGES ===== */
.badge-sm { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--success-light); color: #166534; }
.badge-blue { background: var(--primary-light); color: #075985; }
.badge-amber { background: var(--warning-light); color: #92400e; }
.badge-red { background: var(--danger-light); color: #991b1b; }

/* ===== FILTER CHIPS ===== */
.filter-chips-wrapper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); font-family: 'Poppins', sans-serif; font-size: 13px; cursor: pointer; transition: var(--transition); color: var(--text); }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== PAGINATION ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.page-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-family: 'Poppins', sans-serif; font-size: 14px; cursor: pointer; transition: var(--transition); color: var(--text); }
.page-btn:hover { border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg); border-radius: var(--radius-lg); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); animation: modalSlideIn 0.3s ease; }
.modal-large { max-width: 900px; }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 8px; border-radius: 8px; transition: var(--transition); }
.modal-close:hover { background: var(--bg-alt); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.file-viewer-content { display: flex; align-items: center; justify-content: center; min-height: 300px; background: var(--bg-alt); }
.file-viewer-pdf { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-muted); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 12px; max-width: 400px; pointer-events: none; }
.toast { background: var(--secondary); color: white; padding: 16px 24px; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; animation: slideIn 0.3s ease; pointer-events: auto; cursor: pointer; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-state svg { width: 80px; height: 80px; color: var(--border); margin-bottom: 24px; }
.empty-state h3 { font-size: 20px; font-weight: 600; color: var(--secondary); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* ===== QR PLACEHOLDER ===== */
.qr-placeholder { width: 120px; height: 120px; background: var(--bg-alt); border: 2px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ===== LOGIN PAGE ===== */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--secondary) 0%, #1e293b 100%); padding: 20px; }
.login-card-wrapper { width: 100%; max-width: 420px; }
.login-branding { text-align: center; margin-bottom: 40px; }
.login-logo { width: 80px; height: 80px; background: var(--primary); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; color: white; font-size: 32px; font-weight: 700; }
.login-branding h1 { color: white; font-size: 28px; font-weight: 700; }
.login-branding p { color: rgba(255,255,255,0.6); margin-top: 8px; }
.login-form-card { background: var(--bg); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-xl); }
.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 8px; }
.remember-me { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text); }
.login-options a { color: var(--primary); font-size: 14px; text-decoration: none; font-weight: 500; }
.login-options a:hover { text-decoration: underline; }
.login-footer { text-align: center; color: rgba(255,255,255,0.4); margin-top: 24px; font-size: 13px; }

/* ===== CHARTS ===== */
.chart-bar { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 20px 0; }
.chart-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.chart-bar-fill { width: 100%; border-radius: 8px 8px 0 0; transition: height 0.5s ease; min-height: 4px; }
.chart-bar-label { font-size: 12px; color: var(--text-muted); text-align: center; white-space: nowrap; }
.chart-bar-value { font-size: 13px; font-weight: 600; }
.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s ease; }

/* ===== REPORTS ===== */
.reports-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-top: 24px; }
.treatment-breakdown { display: flex; flex-direction: column; gap: 16px; }
.treatment-breakdown-item { display: flex; flex-direction: column; gap: 8px; }
.treatment-breakdown-header { display: flex; justify-content: space-between; font-size: 14px; }

/* ===== SETTINGS ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ===== MOBILE CARDS ===== */
.mobile-cards { display: none; flex-direction: column; gap: 12px; }
.mobile-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.mobile-card-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.mobile-card-row:last-child { border-bottom: none; }
.mobile-card-label { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.mobile-card-value { font-size: 14px; font-weight: 500; text-align: right; word-break: break-word; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .main-content { padding: 24px; }
}

@media (max-width: 1024px) {
  .sidebar {
    top: var(--toolbar-height);
    bottom: 0;
    height: auto;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { top: var(--toolbar-height); }
  .sidebar-overlay.active { display: block; }
  .sidebar-close { display: block; }
  .main-content { margin-left: 0; max-width: 100%; padding: 24px max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); min-height: calc(100vh - var(--toolbar-height)); }
  .mobile-header { display: flex; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .app-container { padding-top: 56px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .invoice-layout { grid-template-columns: 1fr; }
  .invoice-preview-card { position: static; order: -1; }
  .reports-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

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

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; margin-bottom: 24px; }
  .page-header > .btn { width: 100%; min-width: 0; }
  .quick-actions { width: 100%; }
  .quick-actions .btn { flex: 1; min-width: 0; }
  .card-header { flex-direction: column; align-items: stretch; }
  .card-header .btn { width: 100%; min-width: 0; }
  .card-header .option-b-inline,
  .card-header .filter-chips-wrapper { width: 100%; flex-wrap: wrap; }
  .patients-toolbar { flex-direction: column; align-items: stretch; }
  .patients-toolbar .search-box { flex: 1 1 100%; max-width: none !important; width: 100%; }
  .filter-chips-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .filter-chips { flex-wrap: nowrap; width: max-content; max-width: none; }
  .table-container { display: none; }
  .mobile-cards { display: flex; }
  .recent-item { flex-wrap: wrap; gap: 12px; }
  .recent-time { margin-left: auto; }
  .invoice-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .invoice-meta { text-align: left; }
  .invoice-preview { padding: 24px 16px; }
  .invoice-row { font-size: 14px; gap: 8px; }
  .upload-zone { padding: 32px 16px; }
  .upload-zone svg { width: 48px; height: 48px; }
  .file-gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .comparison-container { height: 220px; max-width: 100%; }
  .chart-bar { height: 160px; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .chart-bar-item { min-width: 36px; }
  .chart-bar-label { font-size: 10px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92dvh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; animation: accessModalIn 0.28s ease; }
  .modal-header { padding: 20px; }
  .modal-body { padding: 20px; }
  .modal-footer { flex-direction: column-reverse; padding: 16px 20px 20px; }
  .modal-footer .btn { width: 100%; min-width: 0; }
  .toast-container { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: none; }
  .day-modal-appt { flex-direction: column; align-items: flex-start; gap: 8px; }
  .day-modal-appt-time { min-width: 0; }
  .tooth-chart-container { overflow-x: auto; align-items: flex-start; width: 100%; -webkit-overflow-scrolling: touch; padding: 16px 8px; }
  .access-modal-overlay { padding: 16px; align-items: flex-end; }
  .access-toolbar { max-height: 85vh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .access-toolbar-header { padding: 20px 20px 16px; }
  .access-toolbar-body { padding: 16px 20px 24px; }
  .access-actions { grid-template-columns: 1fr; }
  .tooth { width: 36px; height: 50px; }
  .tooth-number { font-size: 9px; }
  .tooth-status { width: 14px; height: 14px; }
  .card { padding: 16px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .payment-methods { justify-content: center; }
  .payment-method { flex: 1; justify-content: center; }
  .login-form-card { padding: 24px; }
  .demo-banner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .main-content { padding: 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .page-title h2 { font-size: 22px; }
  .page-title p { font-size: 14px; }
  .stat-value { font-size: 28px; }
  .stat-card { padding: 18px; }
  .btn { min-width: 0; padding: 0 16px; }
  .btn-lg { padding: 0 20px; font-size: 15px; width: 100%; }
  .page-header > .btn-lg { width: 100%; }
  .tabs { gap: 0; margin-bottom: 16px; mask-image: linear-gradient(to right, black calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent); }
  .tab { padding: 10px 14px; font-size: 13px; }
  .toggle-group { gap: 2px; }
  .toggle-btn { padding: 4px 8px; font-size: 11px; }
  .card { padding: 14px; border-radius: var(--radius); }
  .card-title { font-size: 16px; }
  .demo-banner { padding: 14px 16px; gap: 12px; }
  .demo-banner svg { width: 28px; height: 28px; }
  .mobile-card { padding: 14px; }
  .mobile-card-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mobile-card-value { text-align: left; }
  .pagination { gap: 6px; }
  .page-btn { width: 36px; height: 36px; font-size: 13px; }
  .login-form-card { padding: 20px; }
  .login-branding h1 { font-size: 24px; }
  .empty-state { padding: 40px 16px; }
  .empty-state svg { width: 64px; height: 64px; }
  .card:has(.calendar-grid) { padding: 10px; }
  .calendar-day { min-height: 40px; }
  .calendar-day-header { font-size: 8px; }
  .calendar-views .btn-sm { font-size: 11px; height: 36px; }
  .appt-detail-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .appt-detail-value { text-align: left; }
}

/* ===== PRINT ===== */
@media print {
  .access-modal-overlay, .access-toolbar, .mobile-header, .sidebar, .btn, .sidebar-overlay, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; max-width: 100% !important; padding: 0 !important; }
  .invoice-preview { border: none !important; box-shadow: none !important; }
  body { background: white !important; color: black !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-alt); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== SELECTION ===== */
::selection { background: var(--primary-light); color: var(--primary-dark); }

/* ===== FOCUS VISIBLE ===== */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ===== PATIENTS TOOLBAR ===== */
.patients-toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; width: 100%; }
.patients-toolbar .search-box { flex: 1 1 280px; min-width: 0; max-width: 100%; }

/* ===== DETAIL FIELDS ===== */
.detail-field { background: var(--bg-alt); cursor: default; }
.detail-field.editable { background: var(--bg); cursor: text; }
.detail-field.editable:disabled { background: var(--bg-alt); }


/* ===== DARK MODE ACCESS BUTTONS ===== */
body[data-theme="dark"] .access-toolbar-header h2 { color: var(--text); }
body[data-theme="dark"] .access-section-label { color: var(--text); }
body[data-theme="dark"] .access-action-label { color: var(--text); }
body[data-theme="dark"] .option-a { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
body[data-theme="dark"] .option-b { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
body[data-theme="dark"] .mobile-access-btn { color: #f1f5f9; }
body[data-theme="dark"] .mobile-access-btn:hover { background: #1e293b; color: var(--primary); }
body[data-theme="dark"] .mobile-access-btn.active { color: var(--primary); background: rgba(14,165,255,0.15); }
body[data-theme="dark"] .sidebar-access-btn { color: #94a3b8; }
body[data-theme="dark"] .sidebar-access-btn:hover { background: #1e293b; color: var(--primary); }
body[data-theme="dark"] .sidebar-access-btn.active { color: var(--primary); background: rgba(14,165,255,0.15); }

/* Dark mode scrollbar */
body[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }
body[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }
body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }
body[data-theme="dark"] { scrollbar-color: #475569 #1e293b; }

/* High contrast scrollbar */
body.high-contrast ::-webkit-scrollbar-track { background: var(--bg); }
body.high-contrast ::-webkit-scrollbar-thumb { background: var(--border); }
body.high-contrast ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.voice-input-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }


/* ===== TOOTH ARC ===== */
#upper-jaw .tooth:nth-child(1) { transform: rotate(28deg) translateY(42px); }
#upper-jaw .tooth:nth-child(2) { transform: rotate(24deg) translateY(34px); }
#upper-jaw .tooth:nth-child(3) { transform: rotate(20deg) translateY(26px); }
#upper-jaw .tooth:nth-child(4) { transform: rotate(16deg) translateY(18px); }
#upper-jaw .tooth:nth-child(5) { transform: rotate(12deg) translateY(12px); }
#upper-jaw .tooth:nth-child(6) { transform: rotate(8deg) translateY(6px); }
#upper-jaw .tooth:nth-child(7) { transform: rotate(4deg) translateY(2px); }
#upper-jaw .tooth:nth-child(8) { transform: rotate(0deg) translateY(0px); }
#upper-jaw .tooth:nth-child(9) { transform: rotate(-4deg) translateY(2px); }
#upper-jaw .tooth:nth-child(10) { transform: rotate(-8deg) translateY(6px); }
#upper-jaw .tooth:nth-child(11) { transform: rotate(-12deg) translateY(12px); }
#upper-jaw .tooth:nth-child(12) { transform: rotate(-16deg) translateY(18px); }
#upper-jaw .tooth:nth-child(13) { transform: rotate(-20deg) translateY(26px); }
#upper-jaw .tooth:nth-child(14) { transform: rotate(-24deg) translateY(34px); }
#upper-jaw .tooth:nth-child(15) { transform: rotate(-28deg) translateY(42px); }
#upper-jaw .tooth:nth-child(16) { transform: rotate(-32deg) translateY(50px); }

#lower-jaw .tooth:nth-child(1) { transform: rotate(-28deg) translateY(-42px); }
#lower-jaw .tooth:nth-child(2) { transform: rotate(-24deg) translateY(-34px); }
#lower-jaw .tooth:nth-child(3) { transform: rotate(-20deg) translateY(-26px); }
#lower-jaw .tooth:nth-child(4) { transform: rotate(-16deg) translateY(-18px); }
#lower-jaw .tooth:nth-child(5) { transform: rotate(-12deg) translateY(-12px); }
#lower-jaw .tooth:nth-child(6) { transform: rotate(-8deg) translateY(-6px); }
#lower-jaw .tooth:nth-child(7) { transform: rotate(-4deg) translateY(-2px); }
#lower-jaw .tooth:nth-child(8) { transform: rotate(0deg) translateY(0px); }
#lower-jaw .tooth:nth-child(9) { transform: rotate(4deg) translateY(-2px); }
#lower-jaw .tooth:nth-child(10) { transform: rotate(8deg) translateY(-6px); }
#lower-jaw .tooth:nth-child(11) { transform: rotate(12deg) translateY(-12px); }
#lower-jaw .tooth:nth-child(12) { transform: rotate(16deg) translateY(-18px); }
#lower-jaw .tooth:nth-child(13) { transform: rotate(20deg) translateY(-26px); }
#lower-jaw .tooth:nth-child(14) { transform: rotate(24deg) translateY(-34px); }
#lower-jaw .tooth:nth-child(15) { transform: rotate(28deg) translateY(-42px); }
#lower-jaw .tooth:nth-child(16) { transform: rotate(32deg) translateY(-50px); }

@media (max-width: 768px) {
  .tooth { width: 26px; height: 38px; }
  .tooth-number { font-size: 7px; }
  .tooth-status { width: 10px; height: 10px; }
  .jaw-row { gap: 2px; padding: 10px 0; }
  #upper-jaw .tooth:nth-child(1) { transform: rotate(20deg) translateY(24px); }
  #upper-jaw .tooth:nth-child(2) { transform: rotate(16deg) translateY(18px); }
  #upper-jaw .tooth:nth-child(3) { transform: rotate(12deg) translateY(12px); }
  #upper-jaw .tooth:nth-child(4) { transform: rotate(8deg) translateY(8px); }
  #upper-jaw .tooth:nth-child(5) { transform: rotate(5deg) translateY(4px); }
  #upper-jaw .tooth:nth-child(6) { transform: rotate(2deg) translateY(1px); }
  #upper-jaw .tooth:nth-child(7) { transform: rotate(0deg) translateY(0px); }
  #upper-jaw .tooth:nth-child(8) { transform: rotate(0deg) translateY(0px); }
  #upper-jaw .tooth:nth-child(9) { transform: rotate(-2deg) translateY(1px); }
  #upper-jaw .tooth:nth-child(10) { transform: rotate(-5deg) translateY(4px); }
  #upper-jaw .tooth:nth-child(11) { transform: rotate(-8deg) translateY(8px); }
  #upper-jaw .tooth:nth-child(12) { transform: rotate(-12deg) translateY(12px); }
  #upper-jaw .tooth:nth-child(13) { transform: rotate(-16deg) translateY(18px); }
  #upper-jaw .tooth:nth-child(14) { transform: rotate(-20deg) translateY(24px); }
  #upper-jaw .tooth:nth-child(15) { transform: rotate(-24deg) translateY(30px); }
  #upper-jaw .tooth:nth-child(16) { transform: rotate(-28deg) translateY(36px); }
  #lower-jaw .tooth:nth-child(1) { transform: rotate(-20deg) translateY(-24px); }
  #lower-jaw .tooth:nth-child(2) { transform: rotate(-16deg) translateY(-18px); }
  #lower-jaw .tooth:nth-child(3) { transform: rotate(-12deg) translateY(-12px); }
  #lower-jaw .tooth:nth-child(4) { transform: rotate(-8deg) translateY(-8px); }
  #lower-jaw .tooth:nth-child(5) { transform: rotate(-5deg) translateY(-4px); }
  #lower-jaw .tooth:nth-child(6) { transform: rotate(-2deg) translateY(-1px); }
  #lower-jaw .tooth:nth-child(7) { transform: rotate(0deg) translateY(0px); }
  #lower-jaw .tooth:nth-child(8) { transform: rotate(0deg) translateY(0px); }
  #lower-jaw .tooth:nth-child(9) { transform: rotate(2deg) translateY(-1px); }
  #lower-jaw .tooth:nth-child(10) { transform: rotate(5deg) translateY(-4px); }
  #lower-jaw .tooth:nth-child(11) { transform: rotate(8deg) translateY(-8px); }
  #lower-jaw .tooth:nth-child(12) { transform: rotate(12deg) translateY(-12px); }
  #lower-jaw .tooth:nth-child(13) { transform: rotate(16deg) translateY(-18px); }
  #lower-jaw .tooth:nth-child(14) { transform: rotate(20deg) translateY(-24px); }
  #lower-jaw .tooth:nth-child(15) { transform: rotate(24deg) translateY(-30px); }
  #lower-jaw .tooth:nth-child(16) { transform: rotate(28deg) translateY(-36px); }
}

/* ===== CALENDAR LEGEND ===== */
.calendar-legend { display: flex; align-items: center; gap: 16px; margin-top: 20px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.legend-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.legend-dot.cleaning { background: var(--primary-light); border: 1px solid var(--primary); }
.legend-dot.checkup { background: var(--success-light); border: 1px solid var(--success); }
.legend-dot.treatment { background: var(--warning-light); border: 1px solid var(--warning); }
.legend-dot.followup { background: var(--bg-alt); border: 1px solid var(--text-muted); }
.legend-dot.emergency { background: var(--danger-light); border: 1px solid var(--danger); }

/* ===== WEEK VIEW ===== */
.week-day { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 120px; background: var(--bg); cursor: pointer; transition: var(--transition); min-width: 0; overflow: hidden; }
.week-day:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.week-day.today { border-color: var(--primary); background: rgba(14,165,255,0.05); }
.week-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.week-day-name { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.week-day-date { font-size: 18px; font-weight: 700; color: var(--secondary); }
.week-appts { display: flex; flex-direction: column; gap: 4px; }
.week-appt-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: var(--transition); flex-wrap: wrap; }
.week-appt-item:hover { opacity: 0.8; }
.week-appt-item.cleaning { background: var(--primary-light); color: var(--primary); }
.week-appt-item.checkup { background: var(--success-light); color: var(--success); }
.week-appt-item.treatment { background: var(--warning-light); color: #d97706; }
.week-appt-item.followup { background: var(--bg-alt); color: var(--text-muted); }
.week-appt-item.emergency { background: var(--danger-light); color: var(--danger); }
.week-appt-time { font-weight: 600; font-size: 11px; min-width: 40px; }
.week-appt-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-appt-type { font-size: 10px; text-transform: uppercase; opacity: 0.7; }
.week-no-appts { font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px; font-style: italic; }

/* ===== DAY VIEW ===== */
.day-view-container { padding: 16px; }
.day-view-empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.day-view-empty svg { margin-bottom: 16px; color: var(--border); }
.day-view-empty h3 { color: var(--secondary); margin-bottom: 8px; }
.day-view-timeline { display: flex; flex-direction: column; gap: 0; }
.day-view-slot { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.day-view-slot:last-child { border-bottom: none; }
.day-view-time { width: 60px; font-size: 13px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; padding-top: 4px; }
.day-view-slots { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.day-view-slot-empty { font-size: 13px; color: var(--text-muted); padding: 8px 12px; background: var(--bg-alt); border-radius: var(--radius); font-style: italic; }
.day-view-appt { padding: 12px 16px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); border-left: 4px solid var(--primary); }
.day-view-appt:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.day-view-appt.cleaning { background: var(--primary-light); border-left-color: var(--primary); }
.day-view-appt.checkup { background: var(--success-light); border-left-color: var(--success); }
.day-view-appt.treatment { background: var(--warning-light); border-left-color: var(--warning); }
.day-view-appt.followup { background: var(--bg-alt); border-left-color: var(--text-muted); }
.day-view-appt.emergency { background: var(--danger-light); border-left-color: var(--danger); }
.day-view-appt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.day-view-appt-time { font-size: 13px; font-weight: 600; color: var(--secondary); }
.day-view-appt-name { font-size: 15px; font-weight: 600; color: var(--secondary); }
.day-view-appt-dentist { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== DAY APPOINTMENTS MODAL ===== */
.day-modal-appts { display: flex; flex-direction: column; gap: 12px; }
.day-modal-appt { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--radius); border-left: 4px solid var(--primary); background: var(--bg); transition: var(--transition); }
.day-modal-appt:hover { background: var(--bg-alt); }
.day-modal-appt.cleaning { border-left-color: var(--primary); background: var(--primary-light); }
.day-modal-appt.checkup { border-left-color: var(--success); background: var(--success-light); }
.day-modal-appt.treatment { border-left-color: var(--warning); background: var(--warning-light); }
.day-modal-appt.followup { border-left-color: var(--text-muted); background: var(--bg-alt); }
.day-modal-appt.emergency { border-left-color: var(--danger); background: var(--danger-light); }
.day-modal-appt-time { font-size: 18px; font-weight: 700; color: var(--secondary); min-width: 60px; }
.day-modal-appt-info { flex: 1; }
.day-modal-appt-name { font-size: 15px; font-weight: 600; color: var(--secondary); }
.day-modal-appt-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== APPOINTMENT DETAIL MODAL ===== */
.appt-detail-card { display: flex; flex-direction: column; gap: 0; }
.appt-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.appt-detail-row:last-child { border-bottom: none; }
.appt-detail-label { font-size: 14px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.appt-detail-value { font-size: 15px; font-weight: 600; color: var(--text); text-align: right; word-break: break-word; }

/* ===== DARK MODE OVERRIDES ===== */
body[data-theme="dark"] .calendar-day-header { color: #94a3b8; }
body[data-theme="dark"] .calendar-day.other-month { opacity: 0.25; }
body[data-theme="dark"] .calendar-day { background: #1e293b; border-color: #334155; }
body[data-theme="dark"] .calendar-day.today { background: rgba(14,165,255,0.1); border-color: var(--primary); }

body[data-theme="dark"] .day-appt.cleaning { background: #0369a1; color: #ffffff; }
body[data-theme="dark"] .day-appt.checkup { background: #15803d; color: #ffffff; }
body[data-theme="dark"] .day-appt.treatment { background: #b45309; color: #ffffff; }
body[data-theme="dark"] .day-appt.followup { background: #475569; color: #ffffff; }
body[data-theme="dark"] .day-appt.emergency { background: #b91c1c; color: #ffffff; }

body[data-theme="dark"] .week-appt-item.cleaning { background: #0369a1; color: #ffffff; }
body[data-theme="dark"] .week-appt-item.checkup { background: #15803d; color: #ffffff; }
body[data-theme="dark"] .week-appt-item.treatment { background: #b45309; color: #ffffff; }
body[data-theme="dark"] .week-appt-item.followup { background: #475569; color: #ffffff; }
body[data-theme="dark"] .week-appt-item.emergency { background: #b91c1c; color: #ffffff; }

body[data-theme="dark"] .day-view-appt.cleaning { background: rgba(3,105,161,0.3); border-left-color: #38bdf8; }
body[data-theme="dark"] .day-view-appt.treatment { background: rgba(180,83,9,0.3); border-left-color: #fbbf24; }
body[data-theme="dark"] .day-view-appt.checkup { background: rgba(21,128,61,0.3); border-left-color: #4ade80; }
body[data-theme="dark"] .day-view-appt.followup { background: rgba(71,85,105,0.3); border-left-color: #94a3b8; }
body[data-theme="dark"] .day-view-appt.emergency { background: rgba(185,28,28,0.3); border-left-color: #f87171; }
body[data-theme="dark"] .day-view-appt .day-view-appt-name { color: #f1f5f9; }
body[data-theme="dark"] .day-view-appt .day-view-appt-time { color: #e2e8f0; }
body[data-theme="dark"] .day-view-appt .day-view-appt-dentist { color: #94a3b8; }
body[data-theme="dark"] .day-view-slot-empty { background: #1e293b; color: #64748b; }

body[data-theme="dark"] .day-modal-appt.cleaning { background: #0369a1; border-left-color: #38bdf8; }
body[data-theme="dark"] .day-modal-appt.checkup { background: #15803d; border-left-color: #4ade80; }
body[data-theme="dark"] .day-modal-appt.treatment { background: #b45309; border-left-color: #fbbf24; }
body[data-theme="dark"] .day-modal-appt.followup { background: #475569; border-left-color: #94a3b8; }
body[data-theme="dark"] .day-modal-appt.emergency { background: #b91c1c; border-left-color: #f87171; }
body[data-theme="dark"] .day-modal-appt .day-modal-appt-name { color: #ffffff; }
body[data-theme="dark"] .day-modal-appt .day-modal-appt-meta { color: #e2e8f0; }
body[data-theme="dark"] .day-modal-appt .day-modal-appt-time { color: #f1f5f9; }

body[data-theme="dark"] .legend-dot.cleaning { background: #0369a1; border-color: #38bdf8; }
body[data-theme="dark"] .legend-dot.checkup { background: #15803d; border-color: #4ade80; }
body[data-theme="dark"] .legend-dot.treatment { background: #b45309; border-color: #fbbf24; }
body[data-theme="dark"] .legend-dot.followup { background: #475569; border-color: #94a3b8; }
body[data-theme="dark"] .legend-dot.emergency { background: #b91c1c; border-color: #f87171; }
body[data-theme="dark"] .legend-item { color: #e2e8f0; }
body[data-theme="dark"] .legend-label { color: #94a3b8; }
body[data-theme="dark"] .calendar-legend { background: #1e293b; border-color: #334155; }

body[data-theme="dark"] .appt-detail-label { color: #94a3b8; }
body[data-theme="dark"] .appt-detail-value { color: #f1f5f9; }

body[data-theme="dark"] .toast { background: #1e293b; color: #f1f5f9; border: 1px solid #334155; }
body[data-theme="dark"] .toast.success { background: #166534; color: #dcfce7; }
body[data-theme="dark"] .toast.error { background: #991b1b; color: #fee2e2; }
body[data-theme="dark"] .toast.warning { background: #92400e; color: #fef3c7; }
body[data-theme="dark"] .toast.info { background: #075985; color: #e0f2fe; }

/* ===== FONT SIZE LARGE OVERRIDES ===== */
body.font-large { font-size: var(--font-size); }
body.font-large .page-title h2 { font-size: 35px; }
body.font-large .page-title p { font-size: 19px; }
body.font-large .card-title { font-size: 22px; }
body.font-large .stat-value { font-size: 40px; }
body.font-large .stat-label { font-size: 17px; }
body.font-large .stat-change { font-size: 16px; }
body.font-large .nav-item { font-size: 19px; }
body.font-large .nav-badge { font-size: 13px; }
body.font-large .recent-info h4 { font-size: 19px; }
body.font-large .recent-info p { font-size: 16px; }
body.font-large .recent-time { font-size: 15px; }
body.font-large .form-label { font-size: 17px; }
body.font-large input, body.font-large select, body.font-large textarea { font-size: 19px; }
body.font-large .btn { font-size: 19px; }
body.font-large .btn-sm { font-size: 16px; }
body.font-large .btn-lg { font-size: 21px; }
body.font-large .tab { font-size: 19px; }
body.font-large th { font-size: 15px; }
body.font-large td { font-size: 19px; }
body.font-large .status-badge { font-size: 16px; }
body.font-large .chip { font-size: 16px; }
body.font-large .timeline-title { font-size: 19px; }
body.font-large .timeline-desc { font-size: 16px; }
body.font-large .timeline-date { font-size: 15px; }
body.font-large .alert-content h4 { font-size: 17px; }
body.font-large .alert-content p { font-size: 15px; }
body.font-large .file-name { font-size: 16px; }
body.font-large .file-meta { font-size: 14px; }
body.font-large .day-number { font-size: 17px; }
body.font-large .day-appt { font-size: 12px; }
body.font-large .calendar-day-header { font-size: 16px; }
body.font-large .legend-item { font-size: 16px; }
body.font-large .mobile-card-value { font-size: 17px; }
body.font-large .mobile-card-label { font-size: 15px; }
body.font-large .invoice-row { font-size: 17px; }
body.font-large .invoice-row.total { font-size: 24px; }
body.font-large .payment-method span { font-size: 17px; }
body.font-large .chart-bar-label { font-size: 15px; }
body.font-large .chart-bar-value { font-size: 16px; }
body.font-large .treatment-breakdown-header { font-size: 17px; }
body.font-large .user-menu-item { font-size: 17px; }
body.font-large .demo-banner h3 { font-size: 19px; }
body.font-large .demo-banner p { font-size: 16px; }
body.font-large .login-branding h1 { font-size: 32px; }
body.font-large .login-branding p { font-size: 17px; }
body.font-large .empty-state h3 { font-size: 24px; }
body.font-large .empty-state p { font-size: 17px; }
body.font-large .modal-header h3 { font-size: 24px; }
body.font-large .access-toolbar-header h2 { font-size: 22px; }
body.font-large .access-section-label { font-size: 16px; }
body.font-large .access-action-label { font-size: 16px; }
body.font-large .toggle-btn { font-size: 15px; min-height: 44px; }
body.font-large .appt-detail-label { font-size: 17px; }
body.font-large .appt-detail-value { font-size: 18px; }
body.font-large .week-day-name { font-size: 14px; }
body.font-large .week-day-date { font-size: 22px; }
body.font-large .week-appt-item { font-size: 14px; }
body.font-large .day-view-time { font-size: 15px; }
body.font-large .day-view-appt-name { font-size: 17px; }
body.font-large .day-view-appt-time { font-size: 15px; }
body.font-large .day-view-appt-dentist { font-size: 15px; }
body.font-large .day-view-slot-empty { font-size: 15px; }
body.font-large .day-modal-appt-time { font-size: 20px; }
body.font-large .day-modal-appt-name { font-size: 17px; }
body.font-large .day-modal-appt-meta { font-size: 15px; }
body.font-large .tooth-number { font-size: 12px; }
body.font-large .jaw-label { font-size: 16px; }
body.font-large .legend-item { font-size: 14px; }
body.font-large .option-note { font-size: 16px; }
body.font-large .form-hint { font-size: 16px; }
body.font-large .section-divider span { font-size: 14px; }
body.font-large .page-btn { font-size: 17px; }
body.font-large .comparison-before, body.font-large .comparison-after { font-size: 22px; }

/* ===== RESPONSIVE CALENDAR ===== */
@media (max-width: 768px) {
  .card:has(.calendar-grid) { overflow: hidden; padding: 12px; }

  .calendar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .calendar-title-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
  .calendar-title-group .card-title {
    font-size: 16px;
    word-break: break-word;
  }
  .calendar-nav { flex-wrap: wrap; width: 100%; }
  .calendar-views { width: 100%; }
  .calendar-views .btn-sm { flex: 1; min-width: 0; padding: 0 8px; }

  .calendar-grid { gap: 2px; }
  .calendar-day {
    aspect-ratio: unset;
    min-height: 44px;
    height: auto;
    padding: 2px;
    border-radius: var(--radius-sm);
  }
  .calendar-day-header {
    padding: 6px 1px;
    font-size: 9px;
    letter-spacing: 0;
  }
  .day-number { font-size: 11px; margin-bottom: 0; }
  .calendar-day .day-appointments { display: none; }
  .calendar-day:has(.day-appt)::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
  }

  .calendar-legend { gap: 10px; padding: 10px; font-size: 12px; }
  .legend-label { width: 100%; margin-bottom: 4px; }
  .week-day { min-height: 72px; padding: 6px; }
  .week-day-date { font-size: 15px; }
  .week-appt-item { font-size: 10px; padding: 4px 6px; gap: 4px; }
  .week-appt-type { display: none; }
  .week-appt-time { min-width: 34px; font-size: 9px; }
  .day-view-slot { gap: 12px; padding: 8px 0; }
  .day-view-time { width: 50px; font-size: 12px; }
  .day-view-appt { padding: 10px 12px; }
  .day-modal-appt { padding: 12px; }
  .day-modal-appt-time { font-size: 16px; }
}

/* ===== TOUCH & COARSE POINTER ===== */
@media (hover: none), (pointer: coarse) {
  .btn:hover { transform: none; box-shadow: none; }
  .btn-primary:hover { background: var(--primary); }
  .btn-secondary:hover { background: var(--bg-alt); }
  .stat-card:hover { transform: none; box-shadow: var(--shadow); }
  .card:hover { box-shadow: var(--shadow); }
  .recent-item:hover { box-shadow: none; }
  .file-card:hover { transform: none; }
  .day-view-appt:hover { transform: none; }
}

/* ===== BILLING STATS GRID FIX ===== */
body.show-option-b .stats-grid.option-b-only { display: grid; }
body.show-option-b .reports-grid.option-b-only { display: grid; }
body.show-option-b .dashboard-grid.option-b-only { display: grid; }
body.show-option-b .settings-grid.option-b-only { display: grid; }

/* ===================================================================
   DEMO STANDARD ADDITIONS (navigator, switcher, badge, public view)
   Namespaced with "dcw-" / "dcw" ids to avoid clashing with the
   existing admin app's classes.
=================================================================== */
.dcw-hidden { display: none !important; }

/* Demo Navigator */
#dcwNavigator { position: fixed; inset: 0; background: linear-gradient(160deg, var(--secondary) 0%, #1e293b 100%); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; color: #fff; font-family: 'Poppins', sans-serif; }
.dcw-nav-label { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--primary); margin-bottom: 10px; }
.dcw-nav-title { font-size: 34px; font-weight: 700; margin-bottom: 8px; text-align: center; }
.dcw-nav-sub { color: rgba(255,255,255,0.7); margin-bottom: 36px; text-align: center; max-width: 540px; }
.dcw-nav-cards { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.dcw-nav-card { background: #fff; color: var(--text); border-radius: var(--radius-lg); padding: 24px; width: 260px; cursor: pointer; transition: .2s; border: 2px solid transparent; }
.dcw-nav-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.dcw-nav-card h3 { font-size: 18px; margin-bottom: 8px; color: var(--primary); }
.dcw-nav-card p { font-size: 13.5px; color: var(--text-muted); }
.dcw-nav-note { margin-top: 26px; font-size: 12.5px; color: rgba(255,255,255,0.5); text-align: center; }

/* Persistent View Switcher */
#dcwSwitcher { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--secondary); border-radius: 40px; display: flex; gap: 4px; padding: 5px; z-index: 1000; box-shadow: var(--shadow-xl); font-family: 'Poppins', sans-serif; }
#dcwSwitcher button { color: rgba(255,255,255,0.75); padding: 9px 16px; border-radius: 30px; font-size: 13px; font-weight: 600; white-space: nowrap; border: none; background: none; cursor: pointer; }
#dcwSwitcher button.active { background: var(--primary); color: #fff; }
#dcwSwitcher button.dcw-menu-btn { color: #38bdf8; }
@media (max-width: 880px) { #dcwSwitcher { bottom: 10px; font-size: 12px; } }

/* Powered-by attribution badge */
#dcwPoweredBy { position: fixed; bottom: 18px; right: 18px; z-index: 1000; background: rgba(15,23,42,0.75); color: #f1f5f9; font-size: 11.5px; padding: 7px 12px; border-radius: 20px; letter-spacing: .2px; font-family: 'Poppins', sans-serif; }
#dcwPoweredBy a { color: #f1f5f9; text-decoration: none; }
#dcwPoweredBy a:hover { color: #fff; text-decoration: underline; }
@media (max-width: 880px) { #dcwPoweredBy { bottom: 64px; right: 10px; font-size: 10.5px; padding: 6px 10px; } }

/* Public / Customer-Facing View */
#dcwPublicView { background: var(--bg-alt); min-height: 100vh; font-family: 'Poppins', sans-serif; }
.dcw-pub-nav { position: sticky; top: 0; background: rgba(255,255,255,0.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); z-index: 100; }
.dcw-pub-nav-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; }
.dcw-pub-logo { font-size: 21px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.dcw-pub-logo .logo-icon { width: 36px; height: 36px; font-size: 15px; }
.dcw-pub-links { display: flex; gap: 26px; font-size: 14px; font-weight: 500; }
.dcw-pub-links a { color: var(--text); text-decoration: none; }
.dcw-pub-links a:hover { color: var(--primary); }
.dcw-pub-cta { background: var(--primary); color: #fff; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none; }
.dcw-pub-cta:hover { background: var(--primary-dark); }
.dcw-pub-hero { max-width: 1180px; margin: 0 auto; padding: 70px 24px 50px; display: flex; gap: 46px; align-items: center; flex-wrap: wrap; }
.dcw-pub-hero-text { flex: 1; min-width: 280px; }
.dcw-pub-eyebrow { color: var(--primary); font-weight: 700; letter-spacing: 1.5px; font-size: 12px; text-transform: uppercase; margin-bottom: 12px; }
.dcw-pub-hero-text h1 { font-size: 38px; font-weight: 700; margin-bottom: 16px; color: var(--secondary); line-height: 1.2; }
.dcw-pub-hero-text p { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; max-width: 460px; }
.dcw-pub-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dcw-pub-btn-outline { border: 1.5px solid var(--border); padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.dcw-pub-hero-visual { flex: 1; min-width: 280px; background: #fff; border-radius: 16px; border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow); }
.dcw-pub-hero-visual .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.dcw-pub-card { background: var(--bg-alt); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.dcw-pub-card b { color: var(--primary); font-size: 15px; }
.dcw-pub-section { max-width: 1180px; margin: 0 auto; padding: 60px 24px; }
.dcw-pub-section-head { text-align: center; max-width: 600px; margin: 0 auto 40px; }
.dcw-pub-section-head h2 { font-size: 28px; font-weight: 700; color: var(--secondary); }
.dcw-pub-section-head p { color: var(--text-muted); margin-top: 8px; }
.dcw-pub-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dcw-pub-feat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.dcw-pub-feat-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 19px; margin-bottom: 12px; }
.dcw-pub-feat-icon svg { width: 20px; height: 20px; }
.dcw-nav-card h3 svg { width: 19px; height: 19px; vertical-align: -4px; margin-right: 4px; }
.dcw-pub-feat h3 { font-size: 16.5px; margin-bottom: 6px; color: var(--secondary); }
.dcw-pub-feat p { font-size: 13.5px; color: var(--text-muted); }
.dcw-pub-testi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.dcw-pub-testi p { font-style: italic; color: var(--text); margin-bottom: 14px; font-size: 14px; }
.dcw-pub-t-person { display: flex; align-items: center; gap: 10px; }
.dcw-pub-t-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.dcw-pub-t-name { font-weight: 600; font-size: 13.5px; color: var(--secondary); }
.dcw-pub-t-role { font-size: 12px; color: var(--text-muted); }
.dcw-pub-form-section { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 40px; display: flex; gap: 36px; flex-wrap: wrap; }
.dcw-pub-form-info { flex: 1; min-width: 240px; }
.dcw-pub-form-section form { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 12px; }
.dcw-pub-form-section input, .dcw-pub-form-section select, .dcw-pub-form-section textarea { padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--bg-alt); height: auto; }
.dcw-pub-form-section textarea { resize: vertical; min-height: 80px; }
.dcw-pub-submit-btn { background: var(--primary); color: #fff; padding: 12px; border-radius: 8px; font-weight: 600; font-size: 14.5px; margin-top: 4px; border: none; cursor: pointer; }
.dcw-pub-submit-btn:hover { background: var(--primary-dark); }
.dcw-pub-footer { background: var(--secondary); color: rgba(255,255,255,0.7); padding: 46px 24px 24px; }
.dcw-pub-footer-inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 28px; }
.dcw-pub-footer-inner h4 { color: #fff; margin-bottom: 10px; font-size: 14px; }
.dcw-pub-footer-inner p, .dcw-pub-footer-inner a { font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.9; text-decoration: none; }
.dcw-pub-footer-bottom { text-align: center; font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 30px; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 16px; }
.dcw-pub-stats-strip { background: var(--primary); color: #fff; padding: 28px 24px; }
.dcw-pub-stats-inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-around; flex-wrap: wrap; gap: 18px; text-align: center; }
.dcw-pub-stat-num { font-size: 28px; font-weight: 700; }
.dcw-pub-stat-label { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: 1px; }
@media (max-width: 880px) {
  .dcw-pub-links { display: none; }
  .dcw-pub-hero { padding: 44px 20px; }
  .dcw-pub-grid-3 { grid-template-columns: 1fr; }
  .dcw-pub-form-section { padding: 24px; flex-direction: column; }
}