:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-strong: #ffffff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-soft: #f2f6ff;
  --primary: #0a84ff;
  --primary-dark: #0066cc;
  --primary-soft: rgba(10, 132, 255, 0.12);
  --secondary: #111827;
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.14);
  --warning: #ff9f0a;
  --warning-soft: rgba(255, 159, 10, 0.16);
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.13);
  --purple: #af52de;
  --orange: #ff9500;
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --line: rgba(17, 24, 39, 0.10);
  --line-strong: rgba(17, 24, 39, 0.16);
  --shadow: 0 24px 70px rgba(17, 24, 39, 0.10);
  --shadow-soft: 0 14px 35px rgba(17, 24, 39, 0.07);
  --radius-lg: 34px;
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(10, 132, 255, 0.13), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(48, 209, 88, 0.10), transparent 26%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 38%, #f2f2f7 100%);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.018em;
}

body.auth-body,
body.landing-body {
  background:
    radial-gradient(circle at 12% 4%, rgba(10, 132, 255, 0.18), transparent 32%),
    radial-gradient(circle at 88% 14%, rgba(175, 82, 222, 0.10), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(48, 209, 88, 0.10), transparent 28%),
    #f5f5f7;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.32) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.32) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at top, black 0%, transparent 64%);
  opacity: 0.5;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.icon,
svg.icon,
.btn svg.icon,
.app-nav svg.icon,
.notice-title svg.icon,
.badge svg.icon {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  max-width: 20px;
  max-height: 20px;
  flex: 0 0 20px;
  stroke-width: 2.15;
}

.icon-lg,
svg.icon-lg {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px;
  max-width: 34px;
  max-height: 34px;
  flex: 0 0 34px;
  stroke-width: 1.9;
}

.brand-mark > svg.icon-lg {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px;
  max-width: 42px;
  max-height: 42px;
}

.brand-icon > svg.icon-lg,
.app-brand-mark > svg.icon-lg,
.empty-icon > svg.icon-lg {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px;
  max-width: 30px;
  max-height: 30px;
}

.landing,
.auth-wrapper {
  width: min(100%, 1020px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 5vw, 34px);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.hero-card,
.auth-card {
  width: min(100%, 640px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 58px);
  backdrop-filter: blur(28px) saturate(160%);
}

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

.brand-mark,
.brand-icon,
.app-brand-mark,
.empty-icon,
.help-card > span {
  display: grid;
  place-items: center;
  color: var(--primary);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.88), rgba(242,246,255,0.82)),
    var(--surface-soft);
  border: 1px solid rgba(10, 132, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 12px 24px rgba(10,132,255,0.09);
}

.brand-mark {
  width: 86px;
  height: 86px;
  border-radius: 27px;
  margin: 0 auto 22px;
}

.brand-icon,
.app-brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  flex: 0 0 56px;
}

.brand-line {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.73rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(2.15rem, 7vw, 4.15rem);
  line-height: 0.98;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.35rem, 4vw, 2.05rem);
  margin-bottom: 12px;
}

h3 {
  font-size: 1.22rem;
}

.hero-text,
.auth-intro,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.hero-text,
.auth-intro {
  font-size: 1.1rem;
}

.small-note,
small {
  color: var(--muted);
  line-height: 1.45;
}

.small-note {
  margin: 18px 0 0;
  font-size: 0.96rem;
}

.hero-actions {
  margin-top: 30px;
}

.btn {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.02em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.975);
}

.btn[disabled] {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn-xl {
  width: 100%;
  min-height: 66px;
  font-size: 1.1rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 16px 28px rgba(10, 132, 255, 0.24);
}

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

.btn-secondary {
  background: var(--secondary);
  color: white;
  box-shadow: 0 16px 28px rgba(17, 24, 39, 0.17);
}

.btn-light {
  background: rgba(17, 24, 39, 0.06);
  color: var(--text);
  border: 1px solid rgba(17, 24, 39, 0.04);
}

.btn-danger {
  background: var(--danger-soft);
  color: #b42318;
}

.btn-success {
  background: var(--success-soft);
  color: #176c32;
}

.btn-warning {
  background: var(--warning-soft);
  color: #8a4b00;
}

.form-stack {
  display: grid;
  gap: 20px;
}


.login-step {
  display: grid;
  gap: 18px;
}

.step-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(10, 132, 255, 0.12);
  border-radius: 18px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--muted-strong);
  font-weight: 800;
}


.step-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.1;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  margin-bottom: 4px;
}

.step-help {
  margin: -4px 0 0;
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.45;
}

input[type="tel"],
input[inputmode="numeric"] {
  letter-spacing: 0.04em;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 900;
  padding: 8px 0;
}

.link-button:active {
  transform: scale(0.97);
}

.field-group {
  display: grid;
  gap: 9px;
}

.field-group.compact {
  gap: 6px;
}

label {
  font-weight: 850;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  min-height: 60px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: 15px 16px;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(10, 132, 255, 0.72);
  box-shadow: 0 0 0 5px rgba(10, 132, 255, 0.13);
}

.message {
  min-height: 24px;
  color: var(--muted);
  margin-bottom: 0;
}

.message.error {
  color: var(--danger);
  font-weight: 800;
}

.message.success {
  color: #1d7f3a;
  font-weight: 800;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(26px) saturate(180%);
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.app-header-inner {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-brand-title {
  display: grid;
  line-height: 1.12;
}

.app-brand-title strong {
  font-size: 1.05rem;
  letter-spacing: -0.035em;
}

.app-brand-title small {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-nav a {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted-strong);
  font-weight: 800;
}

.app-nav a.active,
.app-nav a:hover {
  background: rgba(10, 132, 255, 0.10);
  color: var(--primary);
}

.app-container {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 28px 20px 96px;
  position: relative;
  z-index: 1;
}

.app-container.narrow {
  width: min(100%, 860px);
}

.welcome-panel,
.section-hero,
.panel,
.notice-card,
.status-card,
.dose-card,
.med-card,
.help-card,
.empty-state {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(150%);
}

.welcome-panel,
.section-hero {
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-hero.small h1,
.welcome-panel h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
}

.panel {
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 32px);
}

.quick-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.status-card {
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 8px;
}

.status-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.status-number {
  font-size: 2.25rem;
  font-weight: 950;
  color: var(--text);
  letter-spacing: -0.06em;
}

.status-label {
  color: var(--muted);
  font-weight: 800;
}

.notice-card {
  border-radius: 24px;
  padding: 18px;
  margin: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: rgba(255, 251, 235, 0.82);
  border-color: rgba(255, 159, 10, 0.17);
}

.notice-card p {
  margin-bottom: 0;
  color: #7a4a05;
}

.notice-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}

.dose-list {
  display: grid;
  gap: 14px;
}

.dose-card {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 18px;
  align-items: center;
  border-radius: 28px;
  padding: 18px;
  border-left: 6px solid var(--primary);
}

.dose-card.verde { border-left-color: var(--success); }
.dose-card.morado { border-left-color: var(--purple); }
.dose-card.naranja { border-left-color: var(--orange); }
.dose-card.rojo { border-left-color: var(--danger); }

.dose-time {
  min-height: 78px;
  border-radius: 22px;
  background: rgba(10, 132, 255, 0.09);
  color: var(--primary);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 950;
  font-size: 1.22rem;
  letter-spacing: -0.05em;
}

.dose-info h3 {
  font-size: 1.38rem;
  margin-bottom: 6px;
}

.dose-info p {
  margin-bottom: 4px;
}

.dose-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.10);
  color: #0756a5;
  font-weight: 850;
  font-size: 0.86rem;
}

.badge.success {
  background: var(--success-soft);
  color: #176c32;
}

.badge.warning {
  background: var(--warning-soft);
  color: #8a4b00;
}

.badge.danger {
  background: var(--danger-soft);
  color: #b42318;
}

.dose-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 360px;
}

.med-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.med-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px;
}

.med-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--primary);
}

.med-card.verde::before { background: var(--success); }
.med-card.morado::before { background: var(--purple); }
.med-card.naranja::before { background: var(--orange); }
.med-card.rojo::before { background: var(--danger); }

.med-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.med-title {
  font-size: 1.45rem;
  margin-bottom: 6px;
}

.med-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.empty-state {
  text-align: center;
  border: 1.5px dashed rgba(17, 24, 39, 0.16);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  margin-top: 24px;
}

.empty-icon {
  width: 78px;
  height: 78px;
  border-radius: 25px;
  margin: 0 auto 14px;
}

.hidden {
  display: none !important;
}

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

.time-list {
  display: grid;
  gap: 10px;
}

.time-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.time-row input {
  max-width: 240px;
}

.segmented,
.days-picker,
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment,
.days-picker button {
  min-height: 50px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 11px 15px;
  font-weight: 850;
  color: var(--text);
}

.segment.active,
.days-picker button.active {
  border-color: rgba(10, 132, 255, 0.58);
  background: var(--primary-soft);
  color: var(--primary);
}

.color-option {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 4px solid rgba(255, 255, 255, 0.85);
  background: var(--primary);
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.08);
}

.color-option.green { background: var(--success); }
.color-option.purple { background: var(--purple); }
.color-option.orange { background: var(--orange); }
.color-option.red { background: var(--danger); }
.color-option.active {
  outline: 3px solid rgba(17, 24, 39, 0.82);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-panel {
  display: flex;
  align-items: end;
  gap: 14px;
  margin: 18px 0;
}

.soft-line {
  border: 0;
  border-top: 1px solid var(--line);
  width: 100%;
  margin: 6px 0;
}

.subheading {
  font-size: 1.4rem;
  margin-bottom: 0;
}

.help-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.help-card {
  display: flex;
  gap: 16px;
  border-radius: 28px;
  padding: 22px;
}

.help-card > span {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 950;
}

.help-card p {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  width: min(calc(100% - 32px), 520px);
  background: rgba(17, 24, 39, 0.94);
  color: white;
  padding: 16px 18px;
  border-radius: 22px;
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 850;
  backdrop-filter: blur(18px);
}

@media (max-width: 900px) {
  html {
    font-size: 17px;
  }

  .app-header-inner {
    padding: 12px 16px;
  }

  .app-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.16);
    backdrop-filter: blur(28px) saturate(180%);
  }

  .app-nav a {
    min-height: 58px;
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    font-size: 0.68rem;
    border-radius: 20px;
    text-align: center;
  }

  .app-nav .icon {
    width: 21px;
    height: 21px;
  }

  .app-container {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .welcome-panel,
  .section-hero,
  .notice-card,
  .filter-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .med-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .dose-card {
    grid-template-columns: 1fr;
  }

  .dose-time {
    min-height: 58px;
    place-items: center start;
    padding-left: 18px;
  }

  .dose-actions {
    max-width: none;
    justify-content: stretch;
  }

  .dose-actions .btn,
  .form-actions .btn,
  .welcome-panel .btn,
  .section-hero .btn,
  .notice-card .btn,
  .filter-panel .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .landing,
  .auth-wrapper,
  .app-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-card,
  .auth-card,
  .panel,
  .welcome-panel,
  .section-hero,
  .empty-state {
    border-radius: 26px;
  }

  .brand-line {
    align-items: flex-start;
  }

  .step-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  
.step-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.1;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  margin-bottom: 4px;
}

.step-help {
  margin: -4px 0 0;
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.45;
}

input[type="tel"],
input[inputmode="numeric"] {
  letter-spacing: 0.04em;
}

.link-button {
    min-height: 34px;
  }


  .quick-status-grid {
    gap: 8px;
  }

  .status-card {
    padding: 14px 10px;
    border-radius: 20px;
    text-align: center;
  }

  .status-number {
    font-size: 1.8rem;
  }

  .status-label {
    font-size: 0.78rem;
  }

  .time-row {
    align-items: stretch;
    flex-direction: column;
  }

  .time-row input {
    max-width: none;
  }

  .med-top {
    flex-direction: column;
  }
}

/* =====================================================
   Barra inferior de secciones
   ===================================================== */
.bottom-nav-shell {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 45;
  width: min(calc(100% - 28px), 780px);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.bottom-nav-toggle,
.bottom-app-nav {
  pointer-events: auto;
}

.bottom-nav-toggle {
  justify-self: center;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(24px) saturate(180%);
  transition: transform 0.22s ease, background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.bottom-nav-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary);
}

.bottom-app-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 9px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(17, 24, 39, 0.09);
  box-shadow: 0 22px 60px rgba(17, 24, 39, 0.17);
  backdrop-filter: blur(30px) saturate(185%);
  overflow: hidden;
  max-height: 112px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: bottom center;
  transition: opacity 0.24s ease, transform 0.24s ease, max-height 0.24s ease, padding 0.24s ease, border-color 0.24s ease;
}

.bottom-app-nav a {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 9px 6px;
  border-radius: 23px;
  color: var(--muted-strong);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bottom-app-nav a:hover {
  transform: translateY(-1px);
  background: rgba(10, 132, 255, 0.08);
  color: var(--primary);
}

.bottom-app-nav a.active {
  background: rgba(10, 132, 255, 0.12);
  color: var(--primary);
}

.bottom-app-nav svg.icon,
.bottom-nav-toggle svg.icon {
  width: 21px !important;
  height: 21px !important;
  min-width: 21px;
  max-width: 21px;
  max-height: 21px;
}

.bottom-nav-shell.is-hidden {
  width: auto;
}

.bottom-nav-shell.is-hidden .bottom-app-nav {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  pointer-events: none;
}

.bottom-nav-shell.is-hidden .bottom-nav-toggle {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(10, 132, 255, 0.18);
}

.app-container {
  padding-bottom: calc(172px + env(safe-area-inset-bottom));
}

body.bottom-nav-hidden .app-container {
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
}

body.bottom-nav-hidden .toast {
  bottom: calc(72px + env(safe-area-inset-bottom));
}

.toast {
  bottom: calc(138px + env(safe-area-inset-bottom));
}

@media (min-width: 901px) {
  .app-header-inner {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .bottom-nav-shell {
    width: min(calc(100% - 20px), 640px);
    bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 7px;
  }

  .bottom-app-nav {
    gap: 6px;
    padding: 8px;
    border-radius: 28px;
  }

  .bottom-app-nav a {
    min-height: 62px;
    padding: 8px 4px;
    border-radius: 21px;
    font-size: 0.68rem;
  }

  .app-container {
    padding-bottom: calc(158px + env(safe-area-inset-bottom));
  }

  body.bottom-nav-hidden .app-container {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(128px + env(safe-area-inset-bottom));
  }

  body.bottom-nav-hidden .toast {
    bottom: calc(68px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .bottom-nav-toggle span {
    font-size: 0.72rem;
  }

  .bottom-app-nav a {
    min-height: 58px;
    font-size: 0.62rem;
  }

  .bottom-app-nav svg.icon,
  .bottom-nav-toggle svg.icon {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    max-width: 20px;
    max-height: 20px;
  }
}

/* =====================================================
   Programación automática por intervalos
   ===================================================== */
.interval-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(242, 247, 255, 0.78);
  border: 1px solid rgba(10, 132, 255, 0.12);
}

.interval-panel.hidden {
  display: none;
}

.interval-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(17, 24, 39, 0.08);
}

.interval-preview strong {
  font-size: 0.94rem;
  letter-spacing: -0.025em;
}

.interval-preview p {
  margin-bottom: 0;
}

.preview-times {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.time-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.10);
  color: #0756a5;
  font-weight: 900;
  font-size: 0.86rem;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(18px) saturate(150%);
}

.app-modal.hidden {
  display: none;
}

.app-modal-card {
  width: min(100%, 440px);
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.22);
}

.app-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-modal-title h2 {
  margin-bottom: 0;
  font-size: 1.38rem;
}

.app-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .app-modal-card {
    padding: 20px;
    border-radius: 26px;
  }

  .app-modal-actions {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   Estado de conexión y modo offline
   ===================================================== */
.connection-area {
  margin-left: auto;
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 178px;
}

.connection-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(22px) saturate(170%);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.connection-pill:hover {
  transform: translateY(-1px);
}

.connection-pill.online {
  color: #147a35;
  background: rgba(240, 255, 244, 0.86);
  border-color: rgba(48, 209, 88, 0.20);
}

.connection-pill.offline,
.connection-pill.sin-internet {
  color: #a65f00;
  background: rgba(255, 247, 237, 0.90);
  border-color: rgba(255, 159, 10, 0.28);
}

.connection-pill.syncing {
  color: var(--primary);
  background: rgba(242, 247, 255, 0.92);
  border-color: rgba(10, 132, 255, 0.22);
}

.connection-area small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-align: right;
  max-width: 260px;
}

.badge-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 720px) {
  .app-header-inner {
    align-items: flex-start;
    gap: 10px;
  }

  .connection-area {
    min-width: auto;
  }

  .connection-area small {
    display: none;
  }

  .connection-pill {
    min-height: 40px;
    padding: 9px 11px;
    font-size: 0.7rem;
  }

  .connection-pill span {
    max-width: 82px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 390px) {
  .app-brand-title small {
    max-width: 120px;
  }

  .connection-pill span {
    display: none;
  }
}

/* =====================================================
   Transiciones suaves entre secciones
   ===================================================== */
.page-transition-enabled .auth-card,
.page-transition-enabled .hero-card,
.page-transition-enabled .app-header,
.page-transition-enabled .app-container > section {
  animation: pageSoftIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-transition-enabled .app-container > section:nth-child(2) { animation-delay: 0.035s; }
.page-transition-enabled .app-container > section:nth-child(3) { animation-delay: 0.065s; }
.page-transition-enabled .app-container > section:nth-child(4) { animation-delay: 0.095s; }
.page-transition-enabled .app-container > section:nth-child(5) { animation-delay: 0.125s; }

.page-leaving .auth-card,
.page-leaving .hero-card,
.page-leaving .app-header,
.page-leaving .app-container {
  opacity: 0;
  transform: translateY(8px) scale(0.992);
  filter: blur(2px);
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.page-transition-enabled .bottom-nav-shell {
  animation: bottomNavSoftIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-leaving .bottom-nav-shell {
  opacity: 0;
  transform: translateX(-50%) translateY(8px) scale(0.992);
  filter: blur(2px);
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}


.route-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(245, 245, 247, 0.70);
  backdrop-filter: blur(22px) saturate(160%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.page-loading .route-loader {
  opacity: 1;
  pointer-events: auto;
}

.route-loader-card {
  width: min(100%, 250px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.70);
  box-shadow: 0 22px 70px rgba(17, 24, 39, 0.14);
  text-align: center;
}

.route-loader-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--primary);
  background: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(242,246,255,0.92));
  border: 1px solid rgba(10, 132, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 14px 32px rgba(10,132,255,0.12);
  animation: loaderPulse 1.25s ease-in-out infinite;
}

.route-loader-mark svg.icon-lg {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px;
  max-width: 30px;
  max-height: 30px;
}

.route-loader-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(10, 132, 255, 0.16);
  border-top-color: var(--primary);
  animation: loaderSpin 0.78s linear infinite;
}

.route-loader-card strong {
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}

.route-loader-card small {
  margin-top: -8px;
  font-weight: 700;
}

.dose-card,
.medicine-card,
.history-card,
.help-card,
.status-card,
.notice-card,
.form-card {
  animation: cardSoftIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes pageSoftIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.992);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes bottomNavSoftIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px) scale(0.992);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    filter: blur(0);
  }
}


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

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

@keyframes loaderPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@media (prefers-reduced-motion: reduce) {
  .page-transition-enabled .auth-card,
  .page-transition-enabled .hero-card,
  .page-transition-enabled .app-header,
  .page-transition-enabled .app-container > section,
  .dose-card,
  .medicine-card,
  .history-card,
  .help-card,
  .status-card,
  .notice-card,
  .form-card,
  .route-loader-mark,
  .route-loader-spinner {
    animation: none !important;
  }

  .page-leaving .auth-card,
  .page-leaving .hero-card,
  .page-leaving .app-header,
  .page-leaving .app-container,
  .route-loader {
    transition: none !important;
    transform: none !important;
    filter: none !important;
  }

  .page-transition-enabled .bottom-nav-shell,
  .page-leaving .bottom-nav-shell {
    animation: none !important;
    transition: none !important;
    transform: translateX(-50%) !important;
    filter: none !important;
  }
}
