body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

a {
  color: var(--color-primary);
}

.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-primary:hover, .btn-primary:focus {
  filter: brightness(0.92);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  background-color: var(--color-surface);
}

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-wrapper {
  width: 100%;
  max-width: 26rem;
}
/* Cloud-shaped container: the card itself is a very rounded rectangle
   (the cloud's "body"), and a handful of same-color circles sitting
   outside its top edge read as puffs merging into it. The circles live
   as siblings (not ::before/::after) because a cloud silhouette needs
   more than two lobes. filter: drop-shadow() on the wrapper — not
   box-shadow on the card — casts one shadow around the combined cloud
   outline instead of a rectangular shadow showing through behind it. */
.cloud-card-wrapper {
  position: relative;
  padding-top: 2.75rem;
  filter: drop-shadow(0 14px 26px rgba(20, 20, 20, 0.14));
}
.auth-card {
  position: relative;
  z-index: 1;
  border-radius: 2.5rem;
  background-color: var(--color-surface);
  box-shadow: none;
}
.cloud-bump {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  background-color: var(--color-surface);
}
.cloud-bump-1 { width: 5rem;   height: 5rem;   top: 0.5rem;    left: 1rem; }
.cloud-bump-2 { width: 7rem;   height: 7rem;   top: -1.25rem;  left: 4.75rem; }
.cloud-bump-3 { width: 6.5rem; height: 6.5rem; top: -0.75rem;  right: 4.25rem; }
.cloud-bump-4 { width: 4.5rem; height: 4.5rem; top: 0.75rem;   right: 0.25rem; }
.cloud-bump-5 { width: 5.5rem; height: 3.5rem; top: 1.75rem;   left: 50%; transform: translateX(-50%); }
/* Pill with a semi-opaque light background so the credit stays readable
   regardless of the configurable login background (image, dark gradient,
   solid color, etc.) — plain text color can't be guaranteed here since
   the background itself isn't fixed like the rest of the app. */
.auth-credits {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.65);
  color: #2E2A2B;
}
.auth-credits a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
.auth-logo {
  max-height: 6.5rem;
}
.auth-logo-placeholder {
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--color-primary) 18%, white);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 15.5rem;
  flex-shrink: 0;
  align-self: flex-start;
  background-color: var(--color-sidebar, var(--color-surface));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin: 1rem;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 1rem;
  height: calc(100vh - 2rem);
  overflow-y: auto;
}
#sidebarOffcanvas {
  background-color: var(--color-sidebar, var(--color-surface));
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.5rem 0.5rem 1.25rem;
  color: var(--color-sidebar-text, var(--color-text));
}
.sidebar-brand img {
  height: 2rem;
  width: 2rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.sidebar-brand i {
  color: var(--color-primary);
  font-size: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text, var(--color-text));
  font-weight: 500;
}
.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
  color: var(--color-sidebar-text, var(--color-muted));
  opacity: 0.65;
}
.sidebar-nav .nav-link:hover:not(.disabled) {
  background-color: color-mix(in srgb, var(--color-primary) 10%, white);
}
.sidebar-nav .nav-link.active {
  background-color: color-mix(in srgb, var(--color-primary) 16%, white);
  color: var(--color-primary);
}
.sidebar-nav .nav-link.active i {
  color: var(--color-primary);
}
.sidebar-nav .nav-link.disabled {
  color: var(--color-sidebar-text, var(--color-muted));
  cursor: default;
  opacity: 0.5;
}
.sidebar-credits {
  margin-top: auto;
  padding-top: 1rem;
  text-align: center;
  color: var(--color-sidebar-text, var(--color-muted));
  opacity: 0.55;
}
.sidebar-credits a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
#sidebarOffcanvas .sidebar-credits {
  margin-top: 1.5rem;
}
.badge-soon {
  margin-left: auto;
  font-size: 0.65rem;
  background-color: var(--color-border);
  color: var(--color-muted);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin: 1rem 1rem 0 0;
  padding: 0.75rem 1.25rem;
}
.topbar-title {
  font-weight: 700;
}
.role-badge {
  background-color: color-mix(in srgb, var(--color-secondary) 30%, white);
  color: var(--color-text);
  font-weight: 600;
}

.content-area {
  padding: 1.5rem;
  margin: 1rem 1rem 1rem 0;
  flex: 1;
}

/* ---------- Dashboard ---------- */
.page-header h1 {
  font-weight: 700;
}

.stat-card .card-body {
  padding: 1.25rem;
}
.stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.stat-icon-primary { background-color: color-mix(in srgb, var(--color-primary) 18%, white); color: var(--color-primary); }
.stat-icon-secondary { background-color: color-mix(in srgb, var(--color-secondary) 25%, white); color: #1f8a6e; }
.stat-icon-accent { background-color: color-mix(in srgb, var(--color-accent) 30%, white); color: #a5760a; }
.stat-icon-muted { background-color: var(--color-border); color: var(--color-muted); }

/* Soft, subtle tint on the whole card — matches its icon's color family. */
.stat-card-primary { background-color: color-mix(in srgb, var(--color-primary) 6%, white); }
.stat-card-secondary { background-color: color-mix(in srgb, var(--color-secondary) 9%, white); }
.stat-card-accent { background-color: color-mix(in srgb, var(--color-accent) 10%, white); }
.stat-card-muted { background-color: var(--color-bg); }

/* /services: one colored section per modalidad (billing_type), reusing
   the same 4 tones as the stat cards above so the color language stays
   consistent across the app instead of introducing a second palette. */
.service-group-title { color: var(--color-text); }
.service-group-primary .service-group-title { color: var(--color-primary); }
.service-group-secondary .service-group-title { color: #1f8a6e; }
.service-group-accent .service-group-title { color: #a5760a; }
.service-group-muted .service-group-title { color: var(--color-muted); }
.service-group-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.service-group-count {
  background-color: rgba(255, 255, 255, 0.65);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.75rem;
}

/* Within the "Matrícula" group, Guardería diaria (semanal) vs. mensual
   need their own distintivo — fixed tones independent of the
   configurable brand colors (like .stat-card-muted), since these two
   sit inside a card already tinted with the SUBSCRIPTION group color and
   need to stand out against it and against each other. */
.service-subgroup-divider td {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-top: none;
}
.service-subgroup-weekly td {
  background-color: #FFE9BF;
  color: #8A5A00;
}
.service-subgroup-monthly td {
  background-color: #CFE6FF;
  color: #0F4C81;
}
.service-row-weekly td:first-child {
  box-shadow: inset 3px 0 0 #E0A93D;
}
.service-row-monthly td:first-child {
  box-shadow: inset 3px 0 0 #4A90D9;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.empty-state i {
  color: var(--color-border);
}

/* ---------- Children module ---------- */
.table-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
}
.table-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: color-mix(in srgb, var(--color-primary) 14%, white);
  color: var(--color-primary);
  font-size: 1.1rem;
}

.status-badge {
  font-weight: 600;
  font-size: 0.75rem;
}
.status-badge-active {
  background-color: color-mix(in srgb, var(--color-secondary) 30%, white);
  color: #1f8a6e;
}
.status-badge-inactive {
  background-color: var(--color-border);
  color: var(--color-muted);
}
.status-badge-pending {
  background-color: color-mix(in srgb, var(--color-accent) 35%, white);
  color: #8a5a00;
}

.form-photo-preview {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-lg);
  object-fit: cover;
}
.form-photo-placeholder {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-lg);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background-color: color-mix(in srgb, var(--color-primary) 12%, white);
  color: var(--color-primary);
}

.ficha-photo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--radius-lg);
  object-fit: cover;
}
.ficha-photo-placeholder {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background-color: color-mix(in srgb, var(--color-primary) 12%, white);
  color: var(--color-primary);
}

/* ---------- Autocomplete dropdown (personas autorizadas) ---------- */
.autocomplete-wrapper {
  position: relative;
}
.autocomplete-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft-hover);
  padding: 0.25rem;
}
.autocomplete-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: none;
  background: none;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.autocomplete-item:hover,
.autocomplete-item:focus {
  background-color: color-mix(in srgb, var(--color-primary) 10%, white);
}
.autocomplete-item small {
  color: var(--color-muted);
}
/* Same weekly/monthly accent colors as the "Matrícula" section on
   /services (see .service-row-weekly/.service-row-monthly) — reused here
   so a service reads the same way wherever it appears in the app. */
.autocomplete-item-weekly {
  border-left: 3px solid #E0A93D;
}
.autocomplete-item-monthly {
  border-left: 3px solid #4A90D9;
}
.autocomplete-item-muted {
  border-left: 3px solid var(--color-muted);
}

/* ---------- Attendance module ---------- */
.search-result-card {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}
.search-result-card:hover {
  box-shadow: var(--shadow-soft-hover);
  transform: translateY(-1px);
}

/* ---------- Settings / white-label ---------- */
.settings-brand-preview {
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-lg);
  object-fit: contain;
  background-color: var(--color-bg);
  padding: 0.5rem;
  border: 1px solid var(--color-border);
}
.settings-favicon-preview {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  object-fit: contain;
  background-color: var(--color-bg);
  padding: 0.4rem;
  border: 1px solid var(--color-border);
}
.settings-brand-preview-placeholder {
  width: 5rem;
  height: 5rem;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background-color: color-mix(in srgb, var(--color-primary) 12%, white);
  color: var(--color-primary);
}

/* ---------- Pantalla de control (/attendance/board) ---------- */
/* Colores de estado fijos (semánticos), NO la paleta de marca
   configurable: "vencido" debe verse rojo pase lo que pase. */
.session-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(210px, 22vw, 260px), 1fr));
  gap: 0.75rem;
}
.session-card {
  border-radius: var(--radius-md);
  padding: 0.8rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 2px solid transparent;
  box-shadow: var(--shadow-soft);
  background-color: #eef2f7;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.session-card-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.session-card-photo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background-color: #fff;
}
.session-card-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--color-muted);
}
.session-card-name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.15;
}
.session-card-code {
  font-size: 0.72rem;
  opacity: 0.7;
}
.session-card-plan .badge {
  font-size: 0.72rem;
  white-space: normal;
  text-align: left;
}
.session-card-timer {
  font-family: 'Segoe UI', system-ui, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 1;
  text-align: center;
  margin: 0.1rem 0;
}
.session-card-timer-plain {
  font-size: 1.25rem;
  opacity: 0.75;
}
.session-card-status {
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  min-height: 1rem;
}
.session-card-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.5rem;
  row-gap: 0.1rem;
  margin: 0;
  font-size: 0.76rem;
}
.session-card-meta dt {
  font-weight: 400;
  opacity: 0.75;
}
.session-card-meta dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}
.session-card-fee {
  background-color: rgba(255, 255, 255, 0.85);
  color: #7a1010;
  border-radius: var(--radius-sm, 6px);
  padding: 0.4rem 0.55rem;
  text-align: center;
  font-size: 0.78rem;
}
.session-card-fee .small {
  font-size: 0.68rem;
}
.session-card-btn {
  margin-top: 0.15rem;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.9);
  color: #2E2A2B;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.session-card-btn:hover {
  background-color: #fff;
}

/* Estados */
.session-card-on_time     { background-color: #e7f6ec; border-color: #7ccf9a; }
.session-card-on_time     .session-card-status { color: #1f8a4c; }

.session-card-ending_soon { background-color: #fff3d6; border-color: #e0a93d; animation: session-pulse-amber 1.4s ease-in-out infinite; }
.session-card-ending_soon .session-card-status,
.session-card-ending_soon .session-card-timer { color: #9a6a00; }

.session-card-overdue     { background-color: #ffe3e3; border-color: #e03131; }
.session-card-overdue     .session-card-status,
.session-card-overdue     .session-card-timer { color: #c92a2a; }

.session-card-late_fee    { background-color: #c92a2a; border-color: #7a1010; color: #fff; animation: session-pulse-red 1.1s ease-in-out infinite; }
.session-card-late_fee    .session-card-name,
.session-card-late_fee    .session-card-code,
.session-card-late_fee    .session-card-status,
.session-card-late_fee    .session-card-timer { color: #fff; }
.session-card-late_fee    .session-card-plan .badge { background-color: rgba(255, 255, 255, 0.9); color: #7a1010; }

.session-card-no_schedule { background-color: #eef2f7; border-color: #b9c4d0; }
.session-card-no_schedule .session-card-status { color: #5a6b7d; }

@keyframes session-pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 169, 61, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(224, 169, 61, 0); }
}
@keyframes session-pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 42, 42, 0.6); }
  50%      { box-shadow: 0 0 0 14px rgba(201, 42, 42, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .session-card-ending_soon, .session-card-late_fee { animation: none; }
}
