:root {
  --bg: #eaf4f6;
  --surface: #f8fcfd;
  --card: #ffffff;
  --primary: #2f7d8c;
  --primary-dark: #245f6b;
  --text: #18343b;
  --muted: #56727a;
  --line: #d7e7ea;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--text); background: linear-gradient(180deg, #eaf4f6, #f7fbfc); }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(360px, 520px);
  gap: 2rem;
  align-items: center;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}
.login-hero {
  padding: 2rem 1rem 2rem 0;
}
.login-hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 6vw, 5rem);
  line-height: 0.96;
  margin-bottom: 1rem;
  max-width: 10ch;
}
.hero-copy {
  max-width: 44ch;
  font-size: 1.08rem;
  margin-bottom: 1.5rem;
}
.hero-points {
  display: grid;
  gap: 0.9rem;
  max-width: 46ch;
}
.hero-point {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(215, 231, 234, 0.95);
  border-radius: 20px;
  padding: 1rem 1.1rem;
  box-shadow: 0 12px 26px rgba(36,95,107,0.06);
}
.hero-point strong,
.hero-point span {
  display: block;
}
.hero-point strong {
  margin-bottom: 0.3rem;
}
.hero-point span {
  color: var(--muted);
  line-height: 1.45;
}
.auth-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(24,52,59,0.34); z-index: 50; }
.auth-overlay.hidden { display: none; }
.auth-card, .panel, .metric-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 14px 30px rgba(36,95,107,0.08); }
.auth-card {
  width: min(520px, calc(100% - 2rem));
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(47,95,140,0.12), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,252,253,0.98));
  pointer-events: none;
}
.auth-card > * {
  position: relative;
  z-index: 1;
}
.auth-card-pro {
  width: 100%;
  padding: 2rem;
}
.auth-card-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.5rem 0; }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}
.topbar-logo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(215, 231, 234, 0.92);
  background: white;
  padding: 0.2rem;
  box-shadow: 0 10px 24px rgba(36,95,107,0.08);
}
.topbar-copy {
  min-width: 0;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--primary-dark); margin: 0 0 0.35rem; }
h1, h2, h3, p { margin-top: 0; }
.auth-card h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: 0.75rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.auth-subcopy {
  max-width: 34ch;
  margin-bottom: 1.2rem;
}
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; padding: 1.25rem 1.5rem 1.5rem; }
.sidebar { display: flex; flex-direction: column; gap: 0.6rem; }
.nav-button, .button { border: 1px solid var(--line); border-radius: 999px; padding: 0.85rem 1rem; font-weight: 600; cursor: pointer; }
.nav-button { text-align: left; background: rgba(255,255,255,0.7); color: var(--text); }
.nav-button.active, .button.primary { background: var(--primary); color: white; border-color: var(--primary); }
.button.secondary { background: white; color: var(--text); }
.topbar-actions, .form-actions, .inline-tools, .auth-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.view-toggle {
  display: inline-flex;
  gap: 0.45rem;
  margin-top: 0.4rem;
}
.view-toggle .button {
  padding: 0.55rem 0.9rem;
}
.view-toggle .button.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.content { min-width: 0; }
.tab { display: none; }
.tab.active { display: block; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card { padding: 1rem; }
.metric-card span { display: block; color: var(--muted); font-size: 0.92rem; margin-bottom: 0.4rem; }
.metric-card strong { font-size: 1.6rem; }
.panel { padding: 1rem; }
.panel.nested { margin-top: 1rem; }
.checklist-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248,252,253,0.96), rgba(234,244,246,0.9));
}
.check-item {
  display: flex !important;
  align-items: center;
  gap: 0.7rem;
  margin: 0 !important;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.check-item input[type="checkbox"] {
  width: 1.05rem;
  min-width: 1.05rem;
  height: 1.05rem;
  margin: 0 !important;
  margin-top: 0 !important;
  padding: 0;
  border-radius: 4px;
  flex: 0 0 auto;
  box-shadow: none;
}
.check-item span {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text);
}
.check-item:hover {
  border-color: rgba(47,125,140,0.38);
  box-shadow: 0 10px 24px rgba(36,95,107,0.08);
  transform: translateY(-1px);
}
.check-item:has(input:checked) {
  border-color: rgba(47,125,140,0.78);
  background: linear-gradient(180deg, rgba(228,245,247,0.96), rgba(242,250,251,0.98));
  box-shadow: 0 10px 24px rgba(36,95,107,0.1);
}
.check-item:has(input:checked) span {
  color: var(--primary-dark);
  font-weight: 600;
}
.quick-create-card {
  background: linear-gradient(180deg, rgba(234,244,246,0.9), rgba(248,252,253,0.95));
}
.segmented-control {
  display: inline-flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.segmented-option {
  display: inline-flex !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  cursor: pointer;
}
.segmented-option input {
  width: auto;
  margin: 0;
}
.schedule-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}
.week-view {
  margin-top: 0.4rem;
}
.week-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}
.week-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}
.week-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.week-legend-item.is-active {
  border-color: rgba(47,125,140,0.68);
  background: linear-gradient(180deg, rgba(228,245,247,0.96), rgba(242,250,251,0.98));
  color: var(--primary-dark);
}
.week-legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
}
.week-grid-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248,252,253,0.96), rgba(255,255,255,0.98));
}
.week-grid {
  min-width: 880px;
  display: grid;
  grid-template-columns: 80px repeat(7, minmax(120px, 1fr));
}
.week-cell {
  min-height: 74px;
  border-right: 1px solid rgba(215,231,234,0.9);
  border-bottom: 1px solid rgba(215,231,234,0.9);
  padding: 0.6rem;
}
.week-cell-corner {
  background: rgba(248,252,253,0.95);
}
.week-head {
  min-height: 62px;
  background: rgba(248,252,253,0.95);
}
.week-head strong,
.week-head span {
  display: block;
}
.week-head span {
  color: var(--muted);
  margin-top: 0.2rem;
}
.week-time {
  color: var(--muted);
  font-size: 0.92rem;
  background: rgba(248,252,253,0.95);
}
.week-slot.is-today,
.week-head.is-today {
  background: rgba(217, 238, 242, 0.44);
}
.week-slot {
  position: relative;
  overflow: visible;
}
.week-appointment {
  --week-slot-height: 74px;
  width: calc(100% - 0.6rem);
  display: block;
  border: 1px solid rgba(47,125,140,0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(228,245,247,0.98), rgba(242,250,251,0.98));
  padding: 0.55rem 0.6rem;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(36,95,107,0.06);
  position: absolute;
  left: 0.3rem;
  right: 0.3rem;
  top: calc(0.3rem + var(--appointment-offset, 0px));
  min-height: calc((var(--week-slot-height) * var(--appointment-span, 1)) - 0.5rem);
  z-index: 2;
}
.week-appointment.has-professional-color {
  border-left: 5px solid var(--appointment-accent, var(--primary));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--appointment-accent, var(--primary)) 16%, white) 0, rgba(255,255,255,0.98) 38%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,252,253,0.98));
}
.week-appointment + .week-appointment {
  margin-top: 0.45rem;
}
.week-appointment-time,
.week-appointment span,
.week-appointment strong {
  display: block;
}
.week-appointment-time,
.week-appointment span {
  color: var(--muted);
  font-size: 0.82rem;
}
.week-appointment strong {
  margin: 0.18rem 0;
  color: var(--text);
}
.week-empty {
  display: block;
  width: 100%;
  height: 100%;
}
.week-appointment.status-realizada {
  background: linear-gradient(180deg, rgba(228,245,234,0.98), rgba(244,251,246,0.98));
}
.week-appointment.status-cancelada {
  background: linear-gradient(180deg, rgba(252,235,235,0.98), rgba(253,246,246,0.98));
}
.week-appointment.status-reservada,
.week-appointment.status-pendiente {
  background: linear-gradient(180deg, rgba(228,245,247,0.98), rgba(242,250,251,0.98));
}
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.8rem; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 1rem; }
.agenda-table-wrap {
  overflow-x: auto;
}
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.appointment-history-list {
  display: grid;
  gap: 0.8rem;
}
.appointment-history-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  background: linear-gradient(180deg, rgba(248,252,253,0.96), rgba(255,255,255,0.98));
}
.appointment-history-head,
.appointment-history-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}
.appointment-history-head {
  margin-bottom: 0.45rem;
}
.appointment-history-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}
.history-status {
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  font-size: 0.85rem;
  color: var(--primary-dark);
}
.appointment-history-notes {
  margin-bottom: 0;
  line-height: 1.5;
}
.form-panel label, .auth-form label { display: block; font-size: 0.92rem; margin-bottom: 0.85rem; }
.auth-form {
  display: grid;
  gap: 0.45rem;
}
input, select, textarea { width: 100%; margin-top: 0.35rem; padding: 0.75rem 0.8rem; border-radius: 14px; border: 1px solid var(--line); background: white; font: inherit; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(47,125,140,0.95);
  box-shadow: 0 0 0 4px rgba(47,125,140,0.12);
}
textarea { min-height: 100px; resize: vertical; }
.button.ghost {
  background: rgba(255,255,255,0.72);
  color: var(--primary-dark);
}
.status-message {
  min-height: 1.35rem;
  margin-bottom: 0;
}
.status-message.error {
  color: #b42318;
}
.status-message.success {
  color: #0b7a4b;
}
.login-help {
  margin-top: 1rem;
  line-height: 1.45;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 0.75rem 0.5rem; text-align: left; vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr.selected { background: #d9eef2; }
.table tbody tr:hover { background: rgba(217, 238, 242, 0.42); }
.small-table th, .small-table td { font-size: 0.9rem; }
.logo-preview-wrap { margin: 0.5rem 0 1rem; }
.logo-preview { display: none; width: 120px; height: 120px; object-fit: contain; border-radius: 22px; border: 1px solid var(--line); background: white; padding: 0.65rem; box-shadow: 0 10px 24px rgba(36,95,107,0.08); }
.logo-preview.visible { display: block; }
.auth-actions {
  margin-top: 0.6rem;
}
.auth-card .button.primary {
  min-width: 140px;
}
.booking-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.booking-slot-summary {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.booking-week-grid {
  min-width: 0;
  grid-template-columns: 80px repeat(5, minmax(148px, 1fr));
}
.booking-week-head span {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.booking-week-slot {
  min-height: 74px;
}
.booking-is-selected-day {
  background: rgba(217, 238, 242, 0.38);
}
.booking-week-appointment {
  width: calc(100% - 0.1rem);
}
.booking-week-appointment.is-available {
  border-color: rgba(47,125,140,0.2);
  background: linear-gradient(180deg, rgba(228,245,247,0.98), rgba(242,250,251,0.98));
}
.booking-week-appointment.is-busy {
  border-color: rgba(191,51,79,0.2);
  background: linear-gradient(180deg, rgba(252,235,235,0.98), rgba(253,246,246,0.98));
}
.booking-week-appointment.is-selected {
  box-shadow: 0 0 0 3px rgba(47,125,140,0.16);
  border-color: rgba(47,125,140,0.55);
}
.booking-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.booking-calendar-legend {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.booking-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.booking-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}
.booking-legend-dot.available {
  background: rgba(47, 125, 140, 0.85);
}
.booking-legend-dot.busy {
  background: rgba(191, 51, 79, 0.85);
}
.booking-day-calendar {
  display: grid;
  gap: 0.9rem;
}
.booking-time-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.9rem;
  align-items: start;
}
.booking-time-label {
  font-weight: 700;
  color: var(--primary-dark);
  padding-top: 0.7rem;
}
.booking-time-track {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.5rem;
  display: flex;
  align-items: stretch;
}
.booking-time-empty {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  font-size: 0.92rem;
  padding: 0.45rem 0.6rem;
}
.booking-slot-card {
  width: 100%;
  min-height: calc(56px * var(--booking-span, 1));
  border-radius: 18px;
  border: 1px solid transparent;
  padding: 0.8rem 0.9rem;
  text-align: left;
  display: grid;
  gap: 0.2rem;
  font: inherit;
}
.booking-slot-card strong {
  font-size: 1rem;
}
.booking-slot-card span {
  font-size: 0.92rem;
}
.booking-slot-card.is-available {
  background: rgba(47, 125, 140, 0.12);
  color: var(--primary-dark);
  border-color: rgba(47, 125, 140, 0.24);
  cursor: pointer;
}
.booking-slot-card.is-available:hover {
  background: rgba(47, 125, 140, 0.18);
}
.booking-slot-card.is-busy {
  background: rgba(191, 51, 79, 0.12);
  color: #8c2039;
  border-color: rgba(191, 51, 79, 0.2);
  cursor: not-allowed;
}
.booking-slot-card.is-selected {
  box-shadow: 0 0 0 3px rgba(47, 125, 140, 0.18);
  border-color: rgba(47, 125, 140, 0.55);
}
@media (max-width: 1100px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1.2rem 0 2rem;
  }
  .login-hero {
    padding: 0;
  }
  .login-hero h1 {
    max-width: none;
  }
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .split, .history-grid, .metrics-grid { grid-template-columns: 1fr; }
  .panel-header {
    align-items: flex-start;
  }
  .booking-calendar-header,
  .booking-time-row {
    grid-template-columns: 1fr;
  }
  .booking-week-grid {
    min-width: 860px;
  }
}
