:root {
  --bg: #eef2ea;
  --surface: #ffffff;
  --surface-soft: #f8faf6;
  --text: #142010;
  --muted: #556b4a;
  --brand: #9fe067;
  --brand-deep: #2f4d22;
  --line: #d3e0c8;
  --line-strong: #b8ccaa;
  --danger: #b83226;
  --accent-soft: rgba(159, 224, 103, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(159, 224, 103, 0.18), transparent 55%),
    linear-gradient(180deg, #f9fbf6 0%, var(--bg) 42%, #e8eee3 100%);
  color: var(--text);
  overflow-x: hidden;
}

html,
body {
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar__brand--link {
  text-decoration: none;
  color: inherit;
}

.topbar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.topbar__logo {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  flex: 0 0 38px;
}

.topbar__subtitle {
  font-size: 0.75rem;
  color: var(--muted);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 0;
}

.topbar__identity {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.topbar__identity > span:last-child {
  display: inline-block;
  max-width: min(52vw, 320px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #f3f8ee;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #40602f;
  flex: 0 0 30px;
}

.topbar__avatar svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.topbar__avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.topbar__logout {
  margin: 0;
}

.portal-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100vh - 61px);
  min-height: calc(100vh - 61px);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 1.25rem 0.9rem;
  overflow: hidden;
}

.sidebar__mobile-head {
  display: block;
}

.sidebar__toggle {
  display: none;
}

.sidebar__title {
  display: block;
  text-decoration: none;
  color: var(--brand-deep);
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
  padding: 0 0.6rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar__nav a {
  text-decoration: none;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  font-size: 0.93rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar__nav a:hover {
  background: #eef6e8;
  color: var(--brand-deep);
}

.sidebar__nav a.is-active {
  background: var(--accent-soft);
  color: var(--brand-deep);
  font-weight: 700;
}

.sidebar__group-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a9a80;
  margin: 0.85rem 0.65rem 0.35rem;
}

.portal-main,
.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.2rem 1.35rem 2rem;
}

.portal-main,
.container,
.card,
.table-wrap {
  min-width: 0;
}

.portal-main {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

.page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
}

.page-head p {
  margin: 0 0 1rem;
  color: var(--muted);
}

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

.page-head__lead {
  max-width: 52ch;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.breadcrumb a {
  color: var(--brand-deep);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  color: var(--muted);
}

.breadcrumb span::before {
  content: " / ";
  color: var(--line-strong);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 18px rgba(25, 43, 14, 0.035);
}

.toolbar input,
.toolbar select {
  margin-bottom: 0;
}

.toolbar__field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 140px;
}

.toolbar__field--grow {
  flex: 1 1 200px;
  min-width: 180px;
}

.toolbar__field label {
  margin-bottom: 0.2rem;
}

.toolbar__actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 0.2rem;
  min-width: min-content;
  margin-left: auto;
  align-self: flex-end;
}

.toolbar__actions-spacer {
  display: block;
  min-height: calc(0.8rem * 1.25 + 0.2rem);
  flex-shrink: 0;
}

.toolbar__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.toolbar__buttons .btn {
  margin-bottom: 0;
}

.card--table {
  padding: 0;
  overflow: hidden;
}

.card--narrow {
  max-width: 640px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table th,
.data-table td {
  padding: 0.62rem 0.75rem;
}

.data-table thead th {
  background: linear-gradient(180deg, #f4f8f0 0%, #eef4e9 100%);
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr:hover {
  background: #f6faf3;
}

.data-table__actions {
  white-space: nowrap;
  text-align: right;
}

.data-table__actions .inline-form {
  display: inline-flex;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.data-table input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 1.6rem 1rem !important;
}

.inline-form {
  display: inline;
  margin: 0;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  max-width: 160px;
}

.stacked-form select {
  margin-bottom: 0;
}

.toolbar--payments .toolbar__field:first-child {
  min-width: 120px;
}

.toolbar--payments .toolbar__field:nth-child(2) {
  min-width: 130px;
}

.card--payments .table-wrap {
  overflow-x: auto;
}

.data-table--payments th:nth-child(1),
.data-table--payments td:nth-child(1) {
  width: 72px;
}

.data-table--payments th:nth-child(2),
.data-table--payments td:nth-child(2) {
  width: 120px;
}

.data-table--payments th:nth-child(4),
.data-table--payments td:nth-child(4) {
  width: 140px;
}

.data-table--payments th:nth-child(5),
.data-table--payments td:nth-child(5) {
  width: 120px;
}

.stacked-form--payments {
  width: 150px;
  margin-left: auto;
}

.stacked-form--payments .btn {
  width: 100%;
}

.stacked-form--payments select {
  text-transform: capitalize;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Vista previa de imagen (formulario servicios admin) */
.service-preview {
  margin-bottom: 0.85rem;
}

.service-preview__frame {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, #f4faf0 0%, #eef4ea 100%);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  max-height: 240px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* El atributo [hidden] pierde frente a display:flex del placeholder sin esto */
.service-preview__placeholder[hidden],
.service-preview__img[hidden] {
  display: none !important;
}

.service-preview__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  position: relative;
  z-index: 1;
}

.service-preview__placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  margin: 0.65rem;
  background: rgba(255, 255, 255, 0.55);
}

.service-preview__placeholder-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(171, 232, 109, 0.45), rgba(61, 102, 40, 0.12));
  border: 1px solid var(--line);
  position: relative;
}

.service-preview__placeholder-icon::before,
.service-preview__placeholder-icon::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: var(--brand-deep);
  opacity: 0.35;
}

.service-preview__placeholder-icon::before {
  width: 18px;
  height: 14px;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  border-radius: 3px;
}

.service-preview__placeholder-icon::after {
  width: 8px;
  height: 8px;
  left: 52%;
  top: 58%;
  transform: translate(-50%, -50%) rotate(42deg);
  box-shadow: -10px 6px 0 -1px rgba(61, 102, 40, 0.25);
}

.service-preview__meta {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.service-preview__dot {
  margin: 0 0.2rem;
  opacity: 0.55;
}

.service-preview__hint {
  color: var(--muted);
}

.form-section-title {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--brand-deep);
}

.muted-block {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-soft);
  border-radius: 10px;
  border: 1px solid var(--line);
}


.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.detail-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.42rem 0;
  border-bottom: 1px dashed #e4ecdd;
}

.detail-list dt {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  font-size: 0.9rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.kpi {
  border: 1px solid #dbe7d0;
  border-radius: 10px;
  background: #f8fcf4;
  padding: 0.55rem 0.65rem;
}

.kpi span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.kpi strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--brand-deep);
  font-size: 0.95rem;
}

.kpi-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.toolbar--compact {
  margin-bottom: 0;
  padding: 0.5rem 0.7rem;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(2px);
}

.toolbar--compact .toolbar__field {
  min-width: 140px;
}

.toolbar--compact label {
  color: #e3eef5;
}

.toolbar--compact select {
  background: #f8fbfd;
}

.mini-list {
  display: grid;
  gap: 0.4rem;
}

.mini-list__row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid #e3ebdc;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: #fbfdf9;
}

.bar-chart {
  display: grid;
  gap: 0.4rem;
}

.bar-chart__row {
  display: grid;
  grid-template-columns: minmax(84px, 120px) minmax(120px, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.bar-chart__label {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-chart__bar {
  height: 10px;
  border-radius: 999px;
  background: #edf4e7;
  overflow: hidden;
}

.bar-chart__bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #89ce45 0%, #5faa21 100%);
}

.bar-chart__value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 1.1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid #d6e3d0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf3 100%);
  box-shadow: 0 10px 30px rgba(22, 43, 16, 0.06);
}

.dash-hero h1 {
  margin: 0;
  color: #183117;
  letter-spacing: 0.01em;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
}

.dash-hero p {
  margin: 0.32rem 0 0;
  color: #5a6f53;
}

.dash-hero__content {
  min-width: 0;
  max-width: 58ch;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.dash-kpi {
  border: 1px solid #d8e5d2;
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fcf6 100%);
  box-shadow: 0 8px 24px rgba(20, 43, 14, 0.06);
  padding: 0.85rem 0.9rem 0.9rem;
  position: relative;
  overflow: hidden;
}

.dash-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: #72ba3e;
}

.dash-kpi:nth-child(1)::before { background: #4f8fd9; }
.dash-kpi:nth-child(2)::before { background: #68b778; }
.dash-kpi:nth-child(3)::before { background: #cfa04b; }
.dash-kpi:nth-child(4)::before { background: #7c8dd8; }

.dash-shell {
  max-width: 1300px;
  margin: 0 auto;
}

.dash-kpi span {
  display: block;
  color: #63795b;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.dash-kpi strong {
  font-size: 1.35rem;
  line-height: 1.1;
  color: #1c3217;
}

.dash-kpi small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.73rem;
  color: #6d7d68;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-grid--thirds {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card--dash {
  border-radius: 16px;
  border-color: #d9e5d2;
  box-shadow: 0 10px 26px rgba(20, 43, 14, 0.06);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
}

.donut-stack {
  position: relative;
  width: 120px;
  height: 120px;
}

.donut-chart {
  width: 120px;
  height: 120px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none;
}

.donut-center strong {
  color: #1d3557;
  font-size: 1.08rem;
}

.donut-center small {
  color: #60728a;
  font-size: 0.7rem;
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 12;
}

.donut-track {
  stroke: #edf3e7;
}

.donut-segment {
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  stroke-linecap: butt;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.45rem;
  vertical-align: middle;
}

.line-chart {
  width: 100%;
  height: auto;
  display: block;
}

.line-chart-apex {
  width: 100%;
  min-height: 320px;
}

.line-chart__line {
  fill: none;
  stroke: #2f7ebf;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart__area {
  fill: rgba(47, 126, 191, 0.15);
  stroke: none;
}

.line-chart__dot {
  fill: #24679c;
  stroke: #edf6fc;
  stroke-width: 2;
}

.line-chart__legend {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: #607657;
  font-size: 0.75rem;
}

.col-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 0.65rem;
}

.col-chart__item {
  border: 1px solid #e1ebd8;
  border-radius: 12px;
  background: #fbfdf9;
  padding: 0.45rem 0.4rem;
}

.col-chart__bar {
  height: 96px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.col-chart__bar i {
  display: block;
  width: 24px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(180deg, #72beff 0%, #3d8fd0 100%);
}

.col-chart__x {
  margin-top: 0.32rem;
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: #607552;
}

.col-chart__y {
  display: block;
  text-align: center;
  color: #1b3417;
  font-size: 0.8rem;
  margin-top: 0.14rem;
}

.patient-contact-form input[disabled] {
  background: #f2f6ef;
  color: #5f7356;
}

@media (max-width: 780px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .dash-kpis {
    grid-template-columns: 1fr;
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .dash-grid--thirds {
    grid-template-columns: 1fr;
  }
  .dash-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 0.95rem;
  }
  .toolbar--compact {
    width: 100%;
    margin-top: 0.25rem;
    background: #f4faf0;
    border-color: #d6e3d0;
  }
  .toolbar--compact label {
    color: #5a7051;
  }
  .toolbar--compact .toolbar__field {
    width: 100%;
    min-width: 0;
  }
  .dash-shell {
    max-width: 100%;
  }
  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .detail-list div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.link-quiet {
  color: var(--brand-deep);
  font-weight: 600;
  text-decoration: none;
}

.link-quiet:hover {
  text-decoration: underline;
}

.text-muted {
  color: #9aaa92;
}

.webinar-register-card {
  max-width: 760px;
  margin: 0 auto;
}

.webinar-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.webinar-stepper span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  border: 1px solid #d6e7c8;
  background: #f5faf1;
  color: #5f7454;
  font-size: 0.76rem;
  font-weight: 700;
}

.webinar-stepper .is-active {
  background: #dff4cb;
  border-color: #add58d;
  color: #24471a;
}

.webinar-highlight {
  border: 1px solid #dbe8d1;
  border-radius: 12px;
  background: #fbfdf9;
  padding: 0.75rem 0.8rem;
  margin-bottom: 0.9rem;
}

.webinar-highlight h2 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.stack-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.95rem;
}

.stack-list__item {
  border: 1px solid var(--line);
  background: #fbfdf9;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0;
}

.stack-list__item--link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.stack-list__item--link:hover {
  border-color: #bdd7ad;
  box-shadow: 0 3px 10px rgba(24, 58, 15, 0.07);
}

.stack-list__item--has-info {
  background: #eef9e7;
  border-color: #c8e2b8;
}

.view-switch {
  display: inline-flex;
  gap: 0.45rem;
  margin: -0.25rem 0 0.8rem;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #f5f9f2;
  overflow: hidden;
}

.view-toggle__item {
  text-decoration: none;
  color: #506949;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.38rem 0.72rem;
  border-right: 1px solid #d9e6cf;
  transition: background 0.2s ease, color 0.2s ease;
}

.view-toggle__item:last-child {
  border-right: none;
}

.view-toggle__item:hover {
  background: #edf6e7;
}

.view-toggle__item.is-active {
  background: linear-gradient(135deg, #7cd53d 0%, #62b526 100%);
  color: #16350f;
}

.multi-check {
  position: relative;
  margin-bottom: 0.95rem;
}

.multi-check__trigger {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.58rem 0.62rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.multi-check__trigger::after {
  content: "▾";
  float: right;
  opacity: 0.75;
}

.multi-check.is-open .multi-check__trigger {
  border-color: #87b95f;
  box-shadow: 0 0 0 2px rgba(135, 185, 95, 0.15);
}

.multi-check__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 25;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(25, 43, 14, 0.12);
  max-height: 210px;
  overflow: auto;
  padding: 0.35rem;
}

.multi-check__item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  margin-bottom: 0;
}

.multi-check__item input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.multi-check__item span {
  text-align: left;
}

.multi-check__item:hover {
  background: #f4f8f0;
}

.clone-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.clone-switch button {
  border: 1px solid var(--line-strong);
  background: #f8fbf6;
  color: var(--text);
  border-radius: 999px;
  padding: 0.52rem 0.65rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.clone-switch button.is-active {
  background: linear-gradient(135deg, #7cd53d 0%, #62b526 100%);
  border-color: #63ad2d;
  color: #16350f;
}

.carousel-thumb {
  width: 140px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #d5e2c8;
}

.carousel-row-form {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.carousel-edit-input {
  margin-bottom: 0 !important;
  height: 34px;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: #f9fbf7;
  line-height: 1;
}

.carousel-edit-input--title {
  width: 140px;
}

.carousel-edit-input--subtitle {
  width: 170px;
}

.carousel-edit-input--order {
  width: 62px;
  text-align: center;
}

.carousel-inline-check {
  margin: 0 0.1rem 0 0.05rem;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.carousel-delete-form {
  margin-left: 0.35rem;
}

.carousel-list {
  display: grid;
  gap: 0.85rem;
}

.carousel-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  border: 1px solid #dce8d2;
  border-radius: 12px;
  padding: 0.6rem;
  background: #fbfdf9;
}

.carousel-item__main h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.carousel-item__main p {
  margin: 0 0 0.45rem;
  color: #5f7656;
  font-size: 0.88rem;
}

.carousel-item__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(19, 31, 15, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid #dce8d2;
  border-radius: 14px;
  background: #fff;
  padding: 1rem;
}

.modal-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.modal-card__head h3 {
  margin: 0;
}

.modal-card__close {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}

.is-modal-open {
  overflow: hidden;
}

.data-table__actions .btn {
  height: 34px;
  min-height: 34px;
  border-radius: 10px;
  font-size: 0.8rem;
  padding: 0.42rem 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.data-table__actions .btn.btn--save {
  background: linear-gradient(135deg, #dff4cc 0%, #c4eb9c 100%);
  border: 1px solid #9fcb72;
  color: #214516;
}

.data-table__actions .btn.btn--save:hover {
  background: linear-gradient(135deg, #d5f0bc 0%, #b7e58a 100%);
}

.data-table__actions .btn.btn--delete {
  background: linear-gradient(135deg, #fff4f3 0%, #ffe6e2 100%);
  border: 1px solid #e8b1aa;
  color: #a13327;
}

.data-table__actions .btn.btn--delete:hover {
  background: linear-gradient(135deg, #ffece9 0%, #ffdcd6 100%);
}

.data-table__actions .btn span[aria-hidden="true"] {
  font-size: 0.78rem;
  line-height: 1;
}

.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 960px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 6px 20px rgba(25, 43, 14, 0.04);
}

.patient-hero-card {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.9rem 1rem;
  background: linear-gradient(145deg, #ffffff 0%, #f4f9f0 100%);
  border-color: #d5e4cd;
}

.patient-hero-card__identity {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
}

.patient-hero-card__eyebrow {
  margin: 0 0 0.22rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b845d;
  font-weight: 700;
}

.patient-hero-card h2 {
  margin: 0;
  font-size: 1.22rem;
}

.patient-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid #bdd6b0;
  background: linear-gradient(135deg, #e7f4dc 0%, #cde9b9 100%);
  color: #2c5420;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.patient-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.patient-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #335726;
  background: #f1f8ea;
  border: 1px solid #d6e7c8;
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
}

.card h2 {
  margin: 0 0 0.8rem;
  font-size: 1.2rem;
}

.card h3 {
  margin: 1rem 0 0.55rem;
  font-size: 0.97rem;
  color: var(--muted);
}

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

.calendar-head h2 {
  margin: 0;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 0.25rem 0 0.75rem;
}

.calendar-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #53694a;
  font-weight: 600;
}

.calendar-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.calendar-legend__swatch.is-free {
  background: #c8eaa9;
  border-color: #add58d;
}

.calendar-legend__swatch.is-booked {
  background: #ffc5bd;
  border-color: #e7a79d;
}

.calendar-legend__swatch.is-inactive {
  background: #e5ece0;
  border-color: #cfd9ca;
}

.week-calendar {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 0.55rem;
}

.week-calendar__times {
  display: grid;
  align-items: start;
  color: #7b8d73;
  font-size: 0.72rem;
  padding-top: 2rem;
}

.week-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.week-calendar__col {
  min-width: 140px;
}

.week-calendar__col-head {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5f7454;
  background: #f4f9f0;
  border: 1px solid #d8e7cd;
  border-radius: 10px;
  padding: 0.42rem 0.35rem;
  margin-bottom: 0.35rem;
}

.week-calendar__col-head strong {
  color: #2f4d22;
}

.week-calendar__col-body {
  position: relative;
  border: 1px solid #dfeadd;
  border-radius: 12px;
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff 0,
      #ffffff 53px,
      #eef5ea 54px
    );
  overflow: hidden;
}

.week-block {
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  border-radius: 12px;
  padding: 0.22rem 0.36rem;
  border: 1px solid #bad8a2;
  box-shadow: 0 1px 3px rgba(32, 62, 21, 0.08);
  overflow: hidden;
}

.week-block--link {
  text-decoration: none;
}

.week-block--link:hover {
  filter: brightness(0.98);
  box-shadow: 0 2px 6px rgba(32, 62, 21, 0.12);
}

.week-block.is-active {
  background: linear-gradient(165deg, #dff4cb 0%, #c8eaa9 100%);
  color: #1f4611;
}

.week-block.is-inactive {
  background: linear-gradient(165deg, #f3f6f1 0%, #e5ece0 100%);
  color: #60715b;
  border-color: #cfd9ca;
}

.week-block__time {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.85;
  line-height: 1.15;
}

.week-block strong {
  display: block;
  font-size: 0.7rem;
  line-height: 1.2;
  margin-top: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-block__status {
  display: block;
  margin-top: 0.08rem;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.week-block--compact strong {
  display: none;
}

.week-block--compact .week-block__time {
  font-size: 0.64rem;
}

.week-block--compact .week-block__status {
  display: none;
}

.week-block.is-booked {
  background: linear-gradient(165deg, #ffd9d4 0%, #ffc5bd 100%);
  border-color: #e7a79d;
  color: #6d1e14;
}

.week-block.is-free {
  background: linear-gradient(165deg, #dff4cb 0%, #c8eaa9 100%);
  border-color: #add58d;
  color: #1f4611;
}

.pill--booked {
  background: #ffe3de;
  border-color: #efb6ae;
  color: #8a2b21;
}

.pill--free {
  background: #eaf6de;
  border-color: #c8e2b2;
  color: #2f5b1f;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.58rem 0.62rem;
  margin-bottom: 0.7rem;
  background: var(--surface-soft);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-deep);
  box-shadow: 0 0 0 3px rgba(171, 232, 109, 0.3);
  background: #fff;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.inline-check input {
  width: auto;
  margin: 0;
}

.btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--brand), #7ec74a);
  color: #142010;
  border-radius: 10px;
  padding: 0.56rem 0.84rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: inherit;
  line-height: 1.1;
  appearance: none;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn--primary {
  box-shadow: 0 6px 16px rgba(47, 77, 34, 0.18);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--brand-deep);
}

.btn--ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn--danger {
  background: #fff;
  border-color: #ebc5c1;
  color: var(--danger);
}

.btn--small {
  padding: 0.38rem 0.66rem;
  font-size: 0.8rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid #e8efe2;
  text-align: left;
  padding: 0.52rem 0.45rem;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill {
  display: inline-block;
  background: #edf6e6;
  border: 1px solid #d6e7c8;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  font-size: 0.75rem;
}

.simple-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* —— Toasts (centrado, tonos semánticos) —— */
.toast {
  --toast-accent: #3d7a2e;
  --toast-bg: rgba(255, 255, 255, 0.94);
  --toast-border: rgba(61, 102, 40, 0.22);
  --toast-shadow: 0 18px 50px rgba(20, 40, 14, 0.12), 0 2px 8px rgba(20, 40, 14, 0.06);
  position: fixed;
  top: 4.85rem;
  left: 50%;
  z-index: 3000;
  display: flex;
  align-items: stretch;
  gap: 0;
  width: min(32rem, calc(100vw - 1.5rem));
  max-width: min(32rem, calc(100vw - 1.5rem));
  padding: 0;
  margin: 0;
  color: #152212;
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  border-radius: 16px;
  box-shadow: var(--toast-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  transform: translateX(-50%);
  animation: toast-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast__accent {
  width: 5px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--toast-accent), rgba(0, 0, 0, 0.18));
}

.toast__body {
  flex: 1;
  padding: 0.95rem 0.35rem 0.95rem 0.85rem;
  display: flex;
  align-items: center;
  min-width: 0;
}

.toast__msg {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.toast__close {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
  color: rgba(21, 34, 18, 0.45);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.toast__close:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #152212;
}

.toast--success {
  --toast-accent: #4a9a38;
  --toast-border: rgba(74, 154, 56, 0.28);
  --toast-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(245, 252, 240, 0.96) 100%);
}

.toast--error {
  --toast-accent: #b83226;
  --toast-border: rgba(184, 50, 38, 0.22);
  --toast-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 246, 0.96) 100%);
  color: #3d1512;
}

.toast--warning {
  --toast-accent: #c27f12;
  --toast-border: rgba(194, 127, 18, 0.28);
  --toast-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 251, 240, 0.96) 100%);
  color: #3d2a0f;
}

.toast--info {
  --toast-accent: #2a6f8f;
  --toast-border: rgba(42, 111, 143, 0.22);
  --toast-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 249, 252, 0.96) 100%);
  color: #142830;
}

.toast--out {
  animation: toast-out 0.34s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
  .toast--out {
    animation: none;
    opacity: 0;
  }
}

.login-wrap {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-wrap::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(880px 420px at 8% 22%, rgba(97, 173, 255, 0.14), transparent 68%),
    radial-gradient(920px 460px at 92% 24%, rgba(114, 212, 114, 0.15), transparent 66%),
    radial-gradient(980px 460px at 50% 88%, rgba(138, 165, 255, 0.11), transparent 70%);
}

.login-card {
  width: min(92vw, 440px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem 1.15rem 1rem;
  box-shadow: 0 14px 40px rgba(28, 42, 19, 0.08);
}

.login-card h1 {
  margin: 0 0 0.35rem;
}

.login-card p {
  margin: 0 0 0.9rem;
  color: var(--muted);
}

.login-card--premium {
  width: min(92vw, 470px);
  border: 1px solid rgba(179, 209, 224, 0.85);
  border-radius: 18px;
  padding: 1.35rem 1.3rem 1.1rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95) 0%, rgba(246, 251, 255, 0.94) 100%);
  box-shadow: 0 24px 65px rgba(20, 55, 78, 0.14), 0 8px 18px rgba(31, 60, 33, 0.08);
  backdrop-filter: blur(6px);
}

.login-card__eyebrow {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1c5878;
  background: rgba(86, 152, 230, 0.14);
  border: 1px solid rgba(91, 146, 214, 0.2);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
}

.login-card--premium h1 {
  margin-bottom: 0.25rem;
}

.login-card--premium p {
  color: #4f6674;
}

.login-card__submit {
  width: 100%;
  margin-top: 0.1rem;
  min-height: 42px;
  font-size: 0.9rem;
}

.login-links {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.login-links a {
  font-size: 0.84rem;
}

.login-links .btn {
  margin-left: auto;
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    padding: 0.65rem 0.8rem;
  }
  .topbar__brand {
    flex: 1 1 46%;
    min-width: 0;
    gap: 0.45rem;
  }
  .topbar__logo {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 9px;
  }
  .topbar__brand strong {
    font-size: 0.95rem;
  }
  .topbar__subtitle {
    font-size: 0.7rem;
  }
  .topbar__user {
    flex: 1 1 52%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .topbar__identity {
    width: 100%;
  }
  .topbar__identity > span:last-child {
    max-width: 100%;
    text-align: right;
    font-size: 0.74rem;
  }
  .topbar__user .btn {
    padding: 0.46rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.1;
    min-height: 38px;
    border-radius: 11px;
  }
  .topbar__avatar {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }
  .topbar__avatar svg {
    width: 14px;
    height: 14px;
  }
  .portal-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.75rem;
    overflow: clip;
    background: rgba(255, 255, 255, 0.95);
  }
  .sidebar__mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
  }
  .sidebar__title {
    margin: 0;
    padding: 0;
    font-size: 0.92rem;
  }
  .sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    background: #f6fbf2;
    color: var(--brand-deep);
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.38rem 0.65rem;
    min-height: 34px;
    cursor: pointer;
  }
  .sidebar__nav {
    display: none;
    flex-direction: column;
    gap: 0.18rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
    max-height: min(58vh, 420px);
    overflow-y: auto;
  }
  .sidebar.is-open .sidebar__nav {
    display: flex;
  }
  .sidebar__nav a {
    padding: 0.54rem 0.6rem;
    font-size: 0.89rem;
  }
  .sidebar__group-label {
    margin: 0.72rem 0.52rem 0.28rem;
  }
  .portal-main {
    height: auto;
    overflow: visible;
    padding: 0.95rem 0.8rem 1.4rem;
  }
  .container {
    padding: 0.95rem 0.8rem 1.4rem;
  }
  .patient-hero-card {
    padding: 0.85rem;
  }
  .patient-avatar {
    width: 46px;
    height: 46px;
    font-size: 0.95rem;
  }
  .patient-hero-card h2 {
    font-size: 1.05rem;
  }
  .week-calendar {
    grid-template-columns: 1fr;
  }
  .week-calendar__times {
    display: none;
  }
}
