/**
 * Estilos del Nuevo Panel de Administración
 * Cristina Jiménez | Dermoestética Avanzada
 * Mismo look & feel que el panel actual
 */

/* ============================================
   VARIABLES Y COLORES CORPORATIVOS
   ============================================ */
:root {
  --hue: 330;
  --primary: hsl(var(--hue), 45%, 34%);
  --primary-light: hsl(var(--hue), 40%, 94%);
  --primary-dark: hsl(var(--hue), 50%, 20%);
  --primary-glow: hsla(var(--hue), 45%, 34%, 0.15);
  --gold: hsl(38, 45%, 62%);
  --gold-hover: hsl(38, 45%, 52%);
  --rose: hsl(350, 45%, 90%);
  --bg: #ffffff;
  --bg-2: hsl(var(--hue), 25%, 98%);
  --bg-card: #ffffff;
  --text: hsl(var(--hue), 35%, 15%);
  --text-2: hsl(var(--hue), 15%, 42%);
  --muted: hsl(var(--hue), 10%, 60%);
  --border: hsl(var(--hue), 20%, 91%);
  --ok: #2D7A4A;
  --warn: hsl(38, 60%, 45%);
  --error: hsl(350, 45%, 34%);
}

/* ============================================
   RESET Y BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-2);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.5;
}

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

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

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 1.6rem 1.1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand img {
  height: 80px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  box-sizing: content-box;
}

.brand-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.brand-text b {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.sidebar-foot {
  margin-top: auto;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

.btn-exit {
  margin-top: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 0.55rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-exit:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-exit svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  padding: 2rem 2.4rem 3rem;
  max-width: 1180px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.user-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.user-role {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-2);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

/* ============================================
   SECCIONES
   ============================================ */
.section {
  display: none;
  animation: fade 0.25s ease;
}

.section.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   CARDS Y STATS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.3rem;
  background: var(--bg-card);
}

.stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ============================================
   TOOLBAR Y BUSCADOR
   ============================================ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  min-width: 260px;
}

.search svg {
  width: 15px;
  height: 15px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
}

.search input,
.search select {
  border: none;
  outline: none;
  font-family: 'Inter';
  font-size: 0.95rem;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 11px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.btn-gold {
  background: var(--gold);
}

.btn-gold:hover {
  background: var(--gold-hover);
}

.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.76rem;
}

/* ============================================
   TABLAS
   ============================================ */
.table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.2rem;
}

.tbl-head {
  display: grid;
  padding: 0.75rem 1.3rem;
  background: var(--primary);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tbl-row {
  display: grid;
  padding: 0.85rem 1.3rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background 0.14s;
  font-size: 0.9rem;
}

.tbl-row:hover {
  background: var(--bg-2);
}

.tbl-row:last-child {
  border-bottom: none;
}

.c-name {
  font-weight: 600;
  font-family: 'Outfit';
  font-size: 0.98rem;
  color: var(--text);
}

.c-email {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.c-meta {
  color: var(--text-2);
  font-size: 0.84rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.b-vip {
  background: rgba(201, 169, 110, 0.18);
  color: var(--gold-hover);
  border: 1px solid rgba(201, 169, 110, 0.4);
}

.b-activa {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(107, 33, 79, 0.25);
}

.b-inactiva {
  background: hsl(330, 10%, 90%);
  color: var(--muted);
  border: 1px solid var(--border);
}

.b-pendiente {
  background: hsl(30, 45%, 90%);
  color: hsl(30, 45%, 45%);
  border: 1px solid hsl(30, 45%, 60%);
}

.b-confirmada {
  background: hsl(330, 40%, 94%);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.b-completada {
  background: rgba(45, 122, 74, 0.15);
  color: var(--ok);
  border: 1px solid var(--ok);
}

.b-cancelada {
  background: hsl(350, 45%, 90%);
  color: hsl(350, 45%, 34%);
  border: 1px solid hsl(350, 45%, 40%);
}

.actions {
  display: flex;
  gap: 0.4rem;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.14s;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.icon-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.empty {
  padding: 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

/* ============================================
   TRATAMIENTOS GRID
   ============================================ */
.treat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.treat-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.15s;
}

.treat-card:hover {
  box-shadow: 0 4px 12px rgba(107, 33, 79, 0.1);
}

.treat-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  display: block;
}

.treat-cat {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.treat-name {
  font-family: 'Outfit';
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.treat-desc {
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.5;
  flex: 1;
}

.treat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.treat-price {
  font-family: 'Outfit';
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

.treat-dur {
  font-size: 0.76rem;
  color: var(--muted);
}

.treat-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

/* ============================================
   GRÁFICOS Y BARRAS
   ============================================ */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.chart-card h3 {
  font-family: 'Outfit';
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 56px;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  font-size: 0.82rem;
}

.bar-row .bl {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 14px;
  background: var(--bg-2);
  border-radius: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 8px;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-val {
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ============================================
   AGENDA / CALENDARIO
   ============================================ */
.agenda-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.4rem;
  align-items: start;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.cal-view-toggle {
  display: flex;
  gap: 0;
}

.vbtn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.45rem 1rem;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: -1px;
}

.vbtn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.cal-month {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.cal-nav {
  display: flex;
  gap: 0.4rem;
}

.cal-nav button {
  width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 1rem;
  transition: all 0.15s;
}

.cal-nav button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#calendar {
  min-height: 500px;
}

/* FullCalendar overrides */
.fc {
  font-family: 'Inter', sans-serif !important;
}

.fc-toolbar-title {
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: var(--primary-dark) !important;
}

.fc-button-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}

.fc-button-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

.fc-event {
  border: none !important;
  border-radius: 4px !important;
  font-size: 0.7rem !important;
  padding: 0.2rem 0.4rem !important;
}

.cal-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
}

.cal-new-btn {
  width: 100%;
  background: var(--gold);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 11px;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.15s;
}

.cal-new-btn:hover {
  background: var(--gold-hover);
}

.panel-title {
  font-family: 'Outfit';
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.appointment-item {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--bg-2);
  cursor: pointer;
  transition: background 0.14s;
}

.appointment-item:hover {
  background: var(--primary-glow);
  margin: 0 -0.7rem;
  padding: 0.7rem;
  border-radius: 8px;
}

.appt-time-block {
  min-width: 44px;
  text-align: center;
}

.appt-time {
  font-family: 'Outfit';
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.appt-ampm {
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.appt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.appt-client {
  font-family: 'Outfit';
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}

.appt-trat {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.1rem;
}

.appt-dur {
  font-size: 0.6rem;
  color: var(--gold-hover);
  margin-top: 0.15rem;
}

.mini-cal {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.mini-cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.mini-cal-month {
  font-family: 'Outfit';
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-wd {
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 0.2rem 0;
}

.mini-day {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 50%;
  margin: 1px auto;
  position: relative;
  transition: all 0.14s;
}

.mini-day:hover {
  background: var(--bg-2);
  color: var(--gold-hover);
}

.mini-day.today {
  background: var(--primary);
  color: #fff;
}

.mini-day.selected {
  background: var(--gold);
  color: #fff;
}

.mini-day.other {
  color: var(--muted);
  opacity: 0.5;
}

.mini-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
}

.legend {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.legend-title {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.64rem;
  color: var(--text-2);
}

/* ============================================
   MODAL
   ============================================ */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 10, 30, 0.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

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

.modal {
  background: #fff;
  border-radius: 18px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-head {
  padding: 1.3rem 1.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-title {
  font-family: 'Outfit';
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--primary-dark);
}

.modal-body {
  padding: 1.3rem 1.6rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.field label {
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  font-family: 'Inter';
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.8rem;
}

.submit {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  margin-top: 0.3rem;
  transition: background 0.15s;
}

.submit:hover {
  background: var(--primary-dark);
}

.submit.warn {
  background: hsl(20, 65%, 52%);
}

.submit.warn:hover {
  background: hsl(20, 65%, 42%);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  padding: 0.8rem 1.3rem;
  border-radius: 11px;
  z-index: 400;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  border-left: 4px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-error {
  background: hsl(350, 45%, 34%);
  border-left-color: hsl(350, 45%, 50%);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
  }
  
  .brand {
    padding-bottom: 0;
    border-bottom: none;
  }
  
  .brand img {
    height: 60px;
  }
  
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .nav-item {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }
  
  .sidebar-foot,
  .btn-exit {
    display: none;
  }
  
  .main {
    padding: 1.5rem 1.2rem 2rem;
  }
  
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .charts {
    grid-template-columns: 1fr;
  }
  
  .agenda-layout {
    grid-template-columns: 1fr;
  }
  
  .cal-sidebar {
    display: none;
  }
  
  .page-title {
    font-size: 1.4rem;
  }
  
  .treat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  
  .stat {
    padding: 0.8rem 1rem;
  }
  
  .stat-num {
    font-size: 1.4rem;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search {
    min-width: 100%;
  }
  
  .btn {
    justify-content: center;
  }
  
  .tbl-head,
  .tbl-row {
    grid-template-columns: 1fr !important;
    gap: 0.3rem;
  }
  
  .tbl-head {
    display: none;
  }
  
  .tbl-row {
    padding: 1rem;
    border-left: 3px solid transparent;
  }
  
  .tbl-row:hover {
    border-left-color: var(--primary);
  }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-right {
  text-align: right;
}

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

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(107, 33, 79, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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