/* ==========================================================================
   HỆ THỐNG QUẢN LÝ BẢO HÀNH NHA KHOA - ADMIN & STAFF DASHBOARD
   Design System: Figma Clinical Modern Luxury (Ocean Sky Blue & Crisp White)
   ========================================================================== */

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-50: #f0f9ff;
  --primary-glow: rgba(14, 165, 233, 0.25);

  --sky-bright: #0ea5e9;
  --sky-light: #38bdf8;
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0c4a6e;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.12);
  --border-color: #e2e8f0;
  --border-light: #bae6fd;
  --border-dark: #334155;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --text-white: #ffffff;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(2, 132, 199, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(2, 132, 199, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 35px -5px rgba(2, 132, 199, 0.16), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ================= LOGIN SCREEN - FIGMA MEDICAL CLEAN ================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(at 10% 15%, rgba(14, 165, 233, 0.15) 0px, transparent 60%),
    radial-gradient(at 90% 85%, rgba(6, 182, 212, 0.12) 0px, transparent 60%),
    radial-gradient(circle at center, #f0f9ff 0%, #f8fafc 60%, #e2e8f0 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 450px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px;
  border: 1.5px solid var(--border-light);
  box-shadow: 0 25px 50px -12px rgba(2, 132, 199, 0.15), 0 0 0 1px rgba(224, 242, 254, 0.8);
  backdrop-filter: blur(12px);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--accent-emerald);
  color: #ffffff;
}
.btn-success:hover {
  background: #059669;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 12px;
  border-radius: 9999px;
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar - Deep Ocean Navy */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 60%, #0369a1 100%);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  box-shadow: 4px 0 20px rgba(7, 89, 133, 0.15);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: #7dd3fc;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  list-style: none;
}

.sidebar-item {
  margin-bottom: 4px;
}

.menu-admin-only[hidden] { display: none !important; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #e0f2fe;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  cursor: pointer;
}

.sidebar-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7dd3fc;
  font-weight: 800;
  padding: 16px 14px 6px;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(0, 0, 0, 0.12);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #0c4a6e;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  margin-top: 2px;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

/* Top Navbar */
.topbar {
  height: 68px;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px -2px rgba(2, 132, 199, 0.05);
}

.page-header-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

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

/* ================= USER TOPBAR DROPDOWN ================= */
.user-dropdown-wrapper {
  position: relative;
}

.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.user-dropdown-trigger:hover,
.user-dropdown-wrapper.open .user-dropdown-trigger {
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  flex-shrink: 0;
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.25;
}

.topbar-user-name {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-role {
  font-size: 10px;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.3px;
}

.user-dropdown-chevron {
  font-size: 11px;
  color: #64748b;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.user-dropdown-wrapper.open .user-dropdown-chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu Container */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  padding: 8px;
  display: none;
  z-index: 1000;
  animation: dropdownPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-wrapper.open .user-dropdown-menu {
  display: block;
}

@keyframes dropdownPop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-header {
  padding: 8px 12px 6px;
}

.dropdown-user-name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 4px;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: #1e293b;
  font-family: inherit;
}

.dropdown-item:hover {
  background: #f0f9ff;
  color: #0284c7;
}

.dropdown-item-icon {
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-item-content {
  flex: 1;
}

.dropdown-item-title {
  font-size: 13px;
  font-weight: 700;
}

.dropdown-item-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.dropdown-item:hover .dropdown-item-sub {
  color: #0369a1;
}

.dropdown-item.danger {
  color: #dc2626;
}

.dropdown-item.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.dropdown-item.danger .dropdown-item-sub {
  color: #ef4444;
}

.lab-scope-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #f0f9ff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
}

.lab-scope-indicator .badge-prefix {
  background: #0284c7;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
}

/* Page Content */
.content-body {
  padding: 28px;
  flex: 1;
}

/* ================= STATS CARDS ================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1.5px solid #e0f2fe;
  box-shadow: 0 4px 16px -2px rgba(2, 132, 199, 0.05);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  user-select: none;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 10px 25px -4px rgba(2, 132, 199, 0.15);
}

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

.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #f0fdfa; color: #06b6d4; }

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

/* ================= DATA TABLES & CARDS ================= */
.panel {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid #e0f2fe;
  box-shadow: 0 4px 18px -2px rgba(2, 132, 199, 0.05);
  margin-bottom: 28px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.custom-table th {
  background-color: #f0f9ff;
  color: #0369a1;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1.5px solid #bae6fd;
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: #f8fafc;
}

.card-code-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9999px;
  color: #0284c7;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.badge-status.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
}

.badge-status.expired {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.badge-status.revoked {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-status.admin {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
}

.badge-status.staff {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-status.gold {
  background: #fffdf0;
  color: #855d0a;
  border: 1px solid #fde047;
}

/* ================= MODAL & ODONTOGRAM ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(2, 132, 199, 0.2);
  border: 1.5px solid #bae6fd;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 28px;
  background: #f0f9ff;
  border-bottom: 1.5px solid #bae6fd;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.modal-close:hover {
  color: #0f172a;
  background: #e0f2fe;
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Sơ đồ răng tương tác (Interactive FDI Odontogram) */
.tooth-chart-container {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 12px 0;
  box-shadow: inset 0 2px 6px rgba(2, 132, 199, 0.04);
}

.tooth-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #0369a1;
}

.tooth-chart-arch {
  margin-bottom: 12px;
}

.arch-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: center;
}

.teeth-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.teeth-quadrant {
  display: flex;
  gap: 4px;
}

.quadrant-divider {
  width: 2px;
  background-color: #bae6fd;
  margin: 0 8px;
  border-radius: 2px;
}

.tooth-box {
  width: 34px;
  height: 76px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.tooth-box:hover {
  border-color: var(--primary);
  background: #e0f2fe;
  transform: translateY(-2px);
}

.tooth-box.selected {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
  transform: translateY(-2px);
}

.tooth-num {
  font-size: 11px;
  font-weight: 800;
}

.tooth-icon {
  width: 27px;
  height: 45px;
  flex-shrink: 0;
}
.tooth-box[role="img"] { cursor:default; }

.tooth-chart-quick-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-tooth-tag {
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s;
}

.btn-tooth-tag:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.15);
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  min-width: 280px;
  animation: toastSlideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--accent-gold); }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print only the certificate; hidden tables must not occupy paper space. */
@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; }
  body > :not(#main-modal) { display: none !important; }
  #main-modal { display: block !important; position: static !important; inset: auto !important; padding: 0 !important; background: none !important; backdrop-filter: none !important; }
  #main-modal, #main-modal * { visibility: visible !important; animation: none !important; opacity: 1 !important; }
  #main-modal, #main-modal :not(svg):not(svg *) { transform: none !important; }
  .modal-dialog, .modal-body { position: static !important; max-width: none !important; width: 100% !important; max-height: none !important; height: auto !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; border: 0 !important; }
  .modal-header, .modal-footer { display: none !important; }
  #printable-certificate { position: static !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
  #printable-certificate { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printable-certificate img, .tooth-chart-container { break-inside: avoid; }
}

/* ================= LAB BRANDING WIZARD STYLES ================= */
.wizard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 20px;
}

.wizard-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wizard-nav-btn:hover {
  color: var(--primary);
  background: rgba(2, 132, 199, 0.08);
}

.wizard-nav-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15);
}

.wizard-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wizard-nav-btn.active .wizard-step-num {
  background: var(--primary);
}

.wizard-pane {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.wizard-pane.active {
  display: block;
}

/* Preset Palettes */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.palette-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: #ffffff;
  text-align: center;
}

.palette-card:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
}

.palette-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.palette-preview {
  height: 38px;
  border-radius: 8px;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.palette-name {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

/* Font Cards */
.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.font-card {
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 10px;
  cursor: pointer;
  background: #ffffff;
  text-align: center;
  transition: all 0.2s;
}

.font-card:hover {
  border-color: #94a3b8;
}

.font-card.active {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

.font-card-sample {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}

.font-card-label {
  font-size: 11px;
  color: #64748b;
  font-family: var(--font-sans);
}

/* Logo Dropzone */
.logo-upload-box {
  border: 2px dashed #93c5fd;
  background: #f8fafc;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.logo-upload-box:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.logo-preview-img {
  max-width: 140px;
  max-height: 80px;
  object-fit: contain;
  margin: 0 auto 12px auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Live Card Preview in Wizard */
.wizard-live-preview-box {
  background: #090e17;
  border-radius: 16px;
  padding: 24px;
  color: #ffffff;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
  margin-top: 10px;
}

.preview-digital-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.08) 0%, rgba(15,23,42,0.85) 100%);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 35px -5px rgba(0,0,0,0.4);
  transition: all 0.3s;
}

.preview-digital-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 80% 20%, var(--wizard-accent, #38bdf8) 0%, transparent 60%);
  opacity: 0.2;
  pointer-events: none;
}


/* Configurable and accessible controls. */
.pagination-row { display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;padding:16px; }
.settings-form { max-width:720px;padding:24px; }
.form-help,.setup-intro { color:#64748b;font-size:13px;line-height:1.6;margin:12px 0; }
.badge-status.pending { color:#92400e;background:#fffbeb;border:1px solid #fcd34d; }
[role="button"]:focus-visible,button:focus-visible,a:focus-visible { outline:3px solid #0ea5e9;outline-offset:3px; }
.sidebar-header img { width:36px;height:36px;object-fit:contain; }
.tooth-chart-container { overflow-x:auto; }
.tooth-chart-container .teeth-row { min-width:620px;justify-content:flex-start; }
@media(max-width:900px) {
  .app-container { flex-direction:column; }
  .sidebar { width:100%; }
  .sidebar-header { padding:12px 16px; }
  .sidebar-menu { display:flex;overflow-x:auto;gap:4px;padding:8px; }
  .sidebar-item { flex-shrink:0;margin:0; }
  .sidebar-section-title,.sidebar-footer { display:none; }
  .sidebar-link { padding:10px;white-space:nowrap; }
}
@media(max-width:640px) {
  .topbar { height:auto;padding:12px;gap:12px;align-items:flex-start;flex-direction:column; }
  .topbar-actions { flex-wrap:wrap;max-width:100%; }
  .panel-header { align-items:flex-start;flex-direction:column;gap:12px; }
  .panel-actions { width:100%; }
  .wizard-header { flex-wrap:wrap; }
  .wizard-nav-btn { flex-basis:40%; }
  .modal-dialog { width:calc(100% - 16px); }
  .form-grid-2,.form-grid-3 { grid-template-columns:minmax(0,1fr); }
}

.certificate-qr { display:flex;align-items:center;gap:16px;font-size:12px;margin-top:12px;break-inside:avoid; }
@media print {
  .certificate-card { padding:12px !important;margin-bottom:10px !important;box-shadow:none !important;break-inside:avoid; }
  .certificate-card h2 { font-size:18px !important; }
  .certificate-identifiers { margin:8px 0 !important;padding:8px 0 !important;gap:8px; }
  .certificate-identifiers > div > div { font-size:14px !important;letter-spacing:0 !important;overflow-wrap:anywhere; }
  .certificate-details { gap:6px !important;font-size:10px !important; }
  .certificate-physical,.certificate-teeth { margin-bottom:10px !important;break-inside:avoid; }
  .certificate-physical h4,.certificate-teeth h4 { font-size:11px !important;margin-bottom:6px !important; }
  .certificate-physical img { max-height:80px;object-fit:contain; }
  .tooth-chart-container { padding:8px;margin:0; }
  .tooth-chart-header { display:none; }
  .tooth-chart-container { overflow:visible; }
  .tooth-chart-arch { margin-bottom:6px; }
  .tooth-chart-container .teeth-row { min-width:0;justify-content:center;gap:2px; }
  .tooth-chart-container .teeth-quadrant { gap:2px; }
  .tooth-chart-container .quadrant-divider { margin:0 3px; }
  .tooth-chart-container .tooth-box { width:21px;height:40px;padding:2px;box-shadow:none; }
  .tooth-chart-container .tooth-num { font-size:9px;line-height:12px; }
  .tooth-chart-container .tooth-icon { width:14px;height:24px; }
  .certificate-qr { gap:10px;margin-top:6px;font-size:10px; }
  .certificate-qr img { width:70px;height:70px; }
}
