/* ============================================================
   SISTEMA ODONTOLÓGICO — ESTILOS PRINCIPALES v2.0
   Tema: Azul médico / Blanco clínico
   ============================================================ */

/* ---- VARIABLES ---- */
:root {
  --primary:        #1a6fa8;
  --primary-dark:   #0d4f7c;
  --primary-light:  #e8f4fd;
  --secondary:      #27ae60;
  --secondary-dark: #1e8449;
  --accent:         #e67e22;
  --danger:         #e74c3c;
  --warning:        #f39c12;
  --info:           #2980b9;
  --purple:         #8e44ad;
  --white:          #ffffff;
  --light:          #f0f4f8;
  --light2:         #f8fafc;
  --gray:           #6c757d;
  --gray-light:     #adb5bd;
  --dark:           #2c3e50;
  --border:         #dce3ea;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.08);
  --shadow:         0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.14);
  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      16px;
  --sidebar-w:      240px;
  --topbar-h:       62px;
  --font:           'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition:     0.2s ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--light);
  color: var(--dark);
  font-size: 14.5px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul { list-style: none; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--light); }
::-webkit-scrollbar-thumb { background: #b0c4d8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(13,79,124,0.35);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}
.topbar .brand img {
  height: 38px;
  width: 38px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255,255,255,0.18);
  padding: 3px;
  border: 2px solid rgba(255,255,255,0.35);
}
.topbar .brand-name { display: inline; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.92);
  font-size: 0.88rem;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-logout:hover { background: rgba(255,255,255,0.26); color: #fff; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  transition: width var(--transition), transform var(--transition);
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.sidebar-menu { padding: 10px 0 20px; }
.sidebar-menu .menu-label {
  padding: 14px 18px 5px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-light);
}
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: #4a5568;
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  margin: 1px 6px;
  border-radius: var(--radius-sm);
}
.sidebar-menu li a .icon {
  width: 22px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--gray);
  flex-shrink: 0;
}
.sidebar-menu li a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
}
.sidebar-menu li a:hover .icon { color: var(--primary); }
.sidebar-menu li a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-menu li a.active .icon { color: var(--primary); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 850;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--light2);
}
.card-header h3 {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 i { color: var(--primary); }
.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  background: var(--primary-light);
  color: var(--primary);
}
.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--dark);
}
.stat-label {
  font-size: 0.77rem;
  color: var(--gray);
  margin-top: 3px;
  font-weight: 500;
}
/* Stat card color variants */
.stat-card.blue::before   { background: var(--primary); }
.stat-card.blue .stat-icon { background: #dbeafe; color: var(--primary); }
.stat-card.green::before  { background: var(--secondary); }
.stat-card.green .stat-icon { background: #dcfce7; color: var(--secondary); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.red .stat-icon { background: #fee2e2; color: var(--danger); }
.stat-card.orange::before { background: var(--accent); }
.stat-card.orange .stat-icon { background: #ffedd5; color: var(--accent); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.purple .stat-icon { background: #f3e8ff; color: var(--purple); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.yellow .stat-icon { background: #fef9c3; color: #92400e; }
.stat-card.teal::before   { background: #0d9488; }
.stat-card.teal .stat-icon { background: #ccfbf1; color: #0d9488; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  font-family: var(--font);
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-dark); color: #fff; box-shadow: 0 4px 12px rgba(26,111,168,0.3); }
.btn-success   { background: var(--secondary); color: #fff; }
.btn-success:hover   { background: var(--secondary-dark); color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover   { background: #d68910; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #c0392b; color: #fff; }
.btn-info      { background: var(--info); color: #fff; }
.btn-info:hover      { background: #1f6fa0; color: #fff; }
.btn-secondary { background: var(--gray); color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover   { background: var(--primary); color: #fff; }
.btn-whatsapp  { background: #25d366; color: #fff; }
.btn-whatsapp:hover  { background: #1da851; color: #fff; }
.btn-sm  { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg  { padding: 11px 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,111,168,0.12);
}
.form-control::placeholder { color: #9ca3af; }
.form-control:disabled { background: #f3f4f6; cursor: not-allowed; color: var(--gray); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--secondary); }
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: 0.78rem; color: var(--gray); margin-top: 4px; }
.invalid-feedback { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th {
  background: var(--light2);
  padding: 11px 14px;
  text-align: left;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f4f8;
  color: var(--dark);
  vertical-align: middle;
}
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success   { background: #dcfce7; color: #166534; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef9c3; color: #854d0e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-primary   { background: var(--primary-light); color: var(--primary-dark); }
.badge-purple    { background: #f3e8ff; color: #6b21a8; }
.badge-orange    { background: #ffedd5; color: #9a3412; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.alert-success  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning  { background: #fffbeb; color: #854d0e; border: 1px solid #fde68a; }
.alert-info     { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 860px; }
@keyframes modalIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--light2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}
.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--light2);
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-light);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-input-wrap .form-control { padding-left: 36px; }

/* ============================================================
   BIRTHDAY ALERT
   ============================================================ */
.birthday-alert {
  background: linear-gradient(135deg, #fff9c4, #fff3cd);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #854d0e;
}
.birthday-alert .icon { font-size: 1.6rem; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   LOGIN / PATIENT PORTAL
   ============================================================ */
.patient-portal {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, #1a8fd1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
}
.patient-hero {
  text-align: center;
  color: #fff;
  margin-bottom: 28px;
}
.patient-hero h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.patient-hero p { font-size: 1rem; opacity: 0.88; }
.patient-login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img {
  height: 72px; width: 72px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--primary-light);
  padding: 8px;
  border: 3px solid var(--primary-light);
  margin-bottom: 12px;
}
.login-logo h2 { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.login-logo p  { font-size: 0.85rem; color: var(--gray); }

/* Login tabs */
.login-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.login-tab:hover { color: var(--primary); }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 22px;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container { position: relative; height: 280px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--gray);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 14px; opacity: 0.4; }
.empty-state h4 { font-size: 1rem; margin-bottom: 6px; color: var(--dark); font-weight: 600; }
.empty-state p  { font-size: 0.88rem; }

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.76rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ============================================================
   CALENDAR (FullCalendar overrides)
   ============================================================ */
.fc .fc-toolbar-title { font-size: 1.1rem !important; font-weight: 700 !important; color: var(--primary-dark) !important; }
.fc .fc-button { background: var(--primary) !important; border-color: var(--primary) !important; font-size: 0.82rem !important; }
.fc .fc-button:hover { background: var(--primary-dark) !important; }
.fc .fc-daygrid-event { border-radius: 4px !important; font-size: 0.78rem !important; }
.fc .fc-col-header-cell { background: var(--light2) !important; font-size: 0.8rem !important; font-weight: 700 !important; color: var(--gray) !important; }

/* ============================================================
   ODONTOGRAM
   ============================================================ */
.odontogram-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin: 10px 0;
}
.tooth-cell {
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  color: var(--dark);
}
.tooth-cell:hover { border-color: var(--primary); background: var(--primary-light); }
.tooth-cell.tratado   { background: #dcfce7; border-color: var(--secondary); color: var(--secondary-dark); }
.tooth-cell.pendiente { background: #fef9c3; border-color: var(--warning); color: #854d0e; }
.tooth-cell.extraccion { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.tooth-cell.corona    { background: #dbeafe; border-color: var(--info); color: var(--info); }

/* ============================================================
   PRESCRIPTION PRINT
   ============================================================ */
.receta-print { max-width: 700px; margin: 0 auto; padding: 30px; font-family: var(--font); }
.receta-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.receta-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
}
.firma-line {
  width: 200px;
  border-top: 1px solid var(--dark);
  text-align: center;
  padding-top: 6px;
  font-size: 0.82rem;
  color: var(--gray);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--gray); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--secondary); }
.text-primary { color: var(--primary); }
.fw-bold      { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.d-none { display: none; }
.d-sm-inline { display: none; }
@media (min-width: 576px) { .d-sm-inline { display: inline; } }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .topbar, .sidebar, .page-header .btn, .no-print,
  .btn, .modal-overlay, .loading-overlay { display: none !important; }
  .main-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: #fff !important; font-size: 12px !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  :root { --sidebar-w: 220px; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 56px; }
  .hamburger { display: flex; }
  .topbar .brand-name { display: none; }
  .user-info span:not(.user-avatar) { display: none; }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    z-index: 900;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 100%; border-radius: var(--radius); }
  .patient-login-card { padding: 24px 20px; }
  .login-card { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .main-content { padding: 12px; }
}
