:root {
  --primary: 219 87% 58%;
  --secondary: 218 86% 95%;
  --muted: 220 15% 96%;
  --border: 216 12% 84%;
  --ring: 219 87% 58%;
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --danger: 0 84.2% 60.2%;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
}

.page {
  min-height: 100vh;
  padding: 24px;
}

.logo-img {
  width: 120px;
  height: auto;
}

.hero__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hero__content {
  margin-top: 48px;
  max-width: 800px;
  text-align: center;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  justify-items: center;
  margin-top: 48px;
}

.hero-logo {
  width: 260px;
  height: auto;
  margin: 0 auto 12px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: hsl(var(--secondary));
  color: hsl(var(--primary));
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 12px;
}

.hero__content h1 {
  font-size: 40px;
  margin-bottom: 12px;
}

.lead {
  font-size: 16px;
  color: hsl(var(--foreground) / 0.6);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 40px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.steps {
  display: grid;
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.steps::before {
  content: "";
  position: absolute;
  left: 34px;
  top: 20px;
  bottom: 20px;
  border-left: 3px dashed hsl(var(--primary) / 0.8);
}

.step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  align-items: start;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: hsl(var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.step-content h3 {
  margin: 0 0 6px;
}

.step:hover,
.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border-color: hsl(var(--primary));
}

.section {
  margin-top: 64px;
}

.section-title {
  margin-bottom: 16px;
  text-align: center;
}

.legal-article {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.legal-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.legal-back {
  font-weight: 600;
  color: hsl(var(--primary));
  text-decoration: none;
  white-space: nowrap;
}

.legal-back:hover {
  text-decoration: underline;
}

.legal-updated {
  font-size: 13px;
  color: hsl(var(--foreground) / 0.6);
  margin-bottom: 24px;
}

.legal-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 8px;
}

.legal-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: hsl(var(--foreground) / 0.85);
  white-space: pre-line;
  text-align: justify;
  text-align-last: left;
}

.legal-empty {
  font-size: 14px;
  color: hsl(var(--foreground) / 0.6);
}

.footer {
  margin-top: 64px;
  padding: 24px 0 12px;
  border-top: 1px solid hsl(var(--border));
  text-align: center;
  color: hsl(var(--foreground) / 0.6);
  font-size: 12px;
  display: grid;
  gap: 8px;
}

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer a {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 600;
}

.info-card {
  background: hsl(var(--background));
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid hsl(var(--border));
  display: grid;
  gap: 8px;
  text-align: center;
}

.info-card .material-icons-outlined {
  font-size: 44px;
}

.btn {
  padding: 16px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.btn--primary {
  background: hsl(var(--primary));
  color: #fff;
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn--static {
  cursor: default;
  pointer-events: none;
}

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

.btn--text {
  background: transparent;
  color: hsl(var(--primary));
}

.btn--floating {
  background: hsl(var(--primary));
  color: #fff;
  box-shadow: var(--shadow);
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 10;
}

.waitlist-btn {
  font-size: 1rem;
  padding: 14px 28px;
  margin-top: 24px;
}

.waitlist-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 48px;
}

.waitlist-lead {
  color: hsl(220 10% 50%);
  font-size: 1rem;
  margin-top: 8px;
}

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 60px;
  justify-content: center;
}

.store-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-left: 25px;
  margin-right: 25px;
}

.store-badge img {
  width: 250px;
  height: auto;
}

.store-btn {
  padding: 12px 18px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.store-btn--purple {
  color: hsl(var(--primary));
  border: 1px solid #a0a0a0;
}

.stepper {
  display: flex;
  flex-direction: column;
  margin-bottom: 28px;
  text-align: left;
}

.stepper__step {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.stepper__indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.stepper__circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: hsl(var(--muted));
  border: 2px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: hsl(var(--foreground) / 0.4);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.stepper__circle::before {
  content: attr(data-step);
}

.stepper__line {
  width: 2px;
  flex: 1;
  min-height: 16px;
  background: hsl(var(--border));
  margin: 4px 0;
  transition: background 0.3s ease;
}

@keyframes stepContentIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stepper__content--entering {
  animation: stepContentIn 0.35s ease forwards;
}

.stepper__body {
  flex: 1;
  padding-bottom: 8px;
}

.stepper__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--foreground) / 0.4);
  padding-top: 4px;
  transition: color 0.25s;
}

.stepper__content {
  margin-top: 16px;
  padding-bottom: 8px;
}

.stepper__content--hidden {
  display: none;
}

/* kept for backward compat */
.stepper__label {
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--foreground) / 0.4);
  padding-top: 4px;
  transition: color 0.25s;
}

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

.stepper__step--active .stepper__title,
.stepper__step--active .stepper__label {
  color: hsl(var(--foreground));
}

.stepper__step--done .stepper__circle {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: #fff;
}

.stepper__step--done .stepper__circle::before {
  content: '✓';
}

.stepper__step--done .stepper__line {
  background: hsl(var(--primary));
}

.stepper__step--done .stepper__title,
.stepper__step--done .stepper__label {
  color: hsl(var(--primary));
}

.access-page {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.access-card {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px;
  background: hsl(var(--background));
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid hsl(var(--border));
}

.access-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.access-subtitle {
  color: hsl(var(--foreground) / 0.6);
  margin-bottom: 24px;
}

.access-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-error {
  color: #d32f2f;
  font-size: 12px;
  display: none;
}

.field-error.is-visible {
  display: block;
}

.input-label {
  font-size: 13px;
  color: hsl(var(--foreground) / 0.6);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  padding: 10px 12px;
  border-radius: 12px;
}

.input-row input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  outline: none;
}

.material-icons-outlined {
  color: hsl(var(--primary));
  font-size: 20px;
  line-height: 1;
}


.access-icon .material-icons-outlined {
  color: hsl(var(--primary));
  font-size: 50px;
  line-height: 1;
}

.code-input {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.code-input input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid hsl(var(--border));
  text-align: center;
  font-size: 16px;
}

.access-error {
  margin-top: 12px;
  color: hsl(var(--danger));
  font-size: 13px;
}

.access-expired {
  background: rgba(198, 40, 40, 0.08);
  border: 1px solid rgba(198, 40, 40, 0.2);
  color: hsl(var(--danger));
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.hidden {
  display: none;
}

.read-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 72px;
}

.read-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 10px 20px;
  background: hsl(var(--primary));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.read-header .btn {
  padding: 7px 12px;
  margin-top: 0;
  gap: 6px;
  font-size: 13px;
}

.read-header .btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  justify-self: start;
}

.read-header-label {
  justify-self: start;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  pointer-events: none;
  cursor: default;
}

.read-header .btn--danger {
  background: #fff;
  color: hsl(var(--foreground));
  justify-self: end;
}

.read-header,
.read-header .read-timer,
.read-header .material-icons-outlined {
  color: #fff;
}

.read-header .btn--danger .material-icons-outlined {
  color: hsl(var(--foreground));
}

.read-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-weight: 600;
}

.antecedentes {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.antecedentes-card {
  background: #fff;
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 10px;
}

.antecedentes-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.antecedentes-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eef2f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: hsl(var(--foreground) / 0.7);
}

.antecedentes-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.antecedentes-card__body {
  display: grid;
  gap: 8px;
}

.antecedentes-list {
  margin: 0;
  padding-left: 16px;
  color: hsl(var(--foreground) / 0.72);
  font-size: 13px;
}

.antecedentes-list li {
  margin-bottom: 6px;
}

.antecedentes-list li:last-child {
  margin-bottom: 0;
}

.antecedentes-text {
  margin: 0;
  color: hsl(var(--foreground) / 0.72);
  font-size: 13px;
}

.antecedentes-empty,
.antecedentes-loading {
  margin: 0;
  color: hsl(var(--foreground) / 0.6);
}

.antecedentes-empty-state {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 24px 0;
}

.antecedentes-empty-icon {
  font-size: 48px;
  color: hsl(var(--primary) / 0.4);
}

.antecedentes-empty-title {
  margin: 0;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.antecedentes-empty-subtitle {
  margin: 0;
  font-size: 13px;
  color: hsl(var(--foreground) / 0.6);
}

@media (max-width: 900px) {
  .antecedentes {
    grid-template-columns: 1fr;
  }
}

.patient-card {
  background: hsl(var(--background));
  padding: 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid hsl(var(--border));
}

.patient-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: hsl(var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
}

.patient-avatar.has-image {
  color: transparent;
}

.patient-avatar.has-image .material-icons-outlined {
  display: none;
}

.patient-avatar img {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  display: none;
}

.patient-avatar.has-image img {
  display: block;
}

.tabs {
  background: hsl(var(--background));
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid hsl(var(--border));
}

.tabs__bar {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid hsl(var(--border));
}

.tab {
  border: none;
  padding: 10px 4px 12px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: hsl(var(--primary) / 0.6);
  border-bottom: 3px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.tab.active {
  color: hsl(var(--primary));
  border-bottom-color: hsl(var(--primary));
}

.tab:hover {
  color: hsl(var(--primary) / 0.8);
}

.tab-content {
  display: none;
  color: hsl(var(--foreground) / 0.6);
}

.tab-content.active {
  display: block;
}

.documents-panel {
  display: grid;
  gap: 16px;
}

.documents-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.documents-header h3 {
  margin: 0;
  font-size: 16px;
}

.documents-header p {
  margin: 4px 0 0;
  color: hsl(var(--foreground) / 0.6);
  font-size: 13px;
}

.documents-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
}

.documents-toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  color: hsl(var(--primary) / 0.6);
}

.documents-toggle-btn.active {
  background: #fff;
  color: hsl(var(--primary));
  box-shadow: var(--shadow);
}

.documents-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.documents-filter.hidden {
  display: none;
}

.documents-filter-label {
  font-size: 12px;
  color: hsl(var(--foreground) / 0.6);
}

.documents-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.documents-chip {
  border: 1px solid hsl(var(--border));
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--primary) / 0.7);
  cursor: pointer;
}

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

.documents-folders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.documents-folders.hidden {
  display: none;
}

.documents-folder-card {
  border: 1px solid hsl(var(--border));
  background: #fff;
  padding: 14px;
  border-radius: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
}

.documents-folder-card .material-icons-outlined {
  font-size: 28px;
  color: hsl(var(--primary));
}

.documents-folder-content h4 {
  margin: 0;
  font-size: 14px;
}

.documents-folder-content p {
  margin: 4px 0 0;
  font-size: 12px;
  color: hsl(var(--foreground) / 0.6);
}

.documents-files {
  display: grid;
  gap: 12px;
}

.documents-files.hidden {
  display: none;
}

.documents-file-card {
  border: 1px solid hsl(var(--border));
  background: #fff;
  padding: 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}

.documents-file-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.documents-file-header h4 {
  margin: 0;
  font-size: 14px;
}

.documents-file-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: hsl(var(--secondary));
  color: hsl(var(--primary));
  font-weight: 600;
}

.documents-file-meta {
  margin: 0;
  font-size: 12px;
  color: hsl(var(--foreground) / 0.6);
}

.documents-file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.documents-action {
  border: 1px solid hsl(var(--border));
  background: #fff;
  color: hsl(var(--primary));
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.documents-action .material-icons-outlined {
  font-size: 16px;
}

.documents-empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  color: hsl(var(--foreground) / 0.6);
  padding: 16px 0;
}

.documents-empty.hidden {
  display: none;
}

.documents-empty .material-icons-outlined {
  font-size: 36px;
  color: hsl(var(--primary) / 0.4);
}

.documents-viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.documents-viewer.hidden {
  display: none;
}

.documents-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.documents-viewer__panel {
  position: relative;
  width: min(960px, 92vw);
  height: min(80vh, 720px);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.documents-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid hsl(var(--border));
}

.documents-viewer__header h4 {
  margin: 0;
  font-size: 14px;
}

.documents-viewer-close {
  margin-top: 0;
  padding: 8px 12px;
}

#documents-viewer-frame {
  border: none;
  width: 100%;
  flex: 1;
}

@media (max-width: 768px) {
  .hero__content h1 {
    font-size: 32px;
  }

  .hero__grid {
    margin-top: 32px;
  }

  .read-header {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 8px 12px;
  }

  .read-header .btn--ghost,
  .read-header .btn--danger {
    width: auto;
  }

  .read-page {
    padding-top: 90px;
  }

  .documents-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .code-input {
    gap: 6px;
  }

  .code-input input {
    height: 38px;
    font-size: 15px;
  }
}
