.portal {
  --portal-navy: #163a5b;
  --wallet-green: #4d6833;
  --wallet-green-soft: #f2f6ed;
}

.portal main { min-height: 65vh; }
.portal [hidden] { display: none !important; }
.portal-identity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--portal-navy);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}
.portal-identity img { flex: none; }
.portal-identity strong { font-weight: 650; }
.portal-biounity { flex: none; object-fit: contain; }
.portal #portal-status { color: var(--muted); }
.portal-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 350px);
  gap: clamp(20px, 5vw, 56px);
  align-items: start;
}
.portal-login h1, .portal-greeting h1 { margin: 2px 0 8px; color: var(--portal-navy); }
.portal-login h1 { font-size: clamp(28px, 4.4vw, 48px); line-height: 1.14; letter-spacing: -.04em; }
.portal-login h1 span { color: var(--action); }
.portal-login-intro > p, .portal-greeting > p { margin: 0 0 16px; color: var(--muted); }
.portal-login .founders { margin-top: 20px; }
.portal .login { width: 100%; }
.portal .login input { font-size: 16px; }
.portal .login button { min-height: 44px; }
.portal .login [role="status"]:empty { display: none; }

.portal-dashboard {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
}
.portal-sidebar {
  position: sticky;
  top: 83px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.portal-sidebar > p {
  margin: 2px 8px 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.portal-sidebar nav { display: grid; gap: 4px; }
.portal-sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 9px;
  padding: 8px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
  font-size: 13px;
}
.portal-sidebar nav a:hover,
.portal-sidebar nav a[aria-current="page"] { background: var(--blue-soft); color: var(--action); }
.portal-sidebar nav a[aria-current="page"] { font-weight: 650; }
.portal-sidebar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.portal-greeting { margin-bottom: 18px; }
.portal-greeting h1 { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.22; letter-spacing: -.02em; }
.portal-welcome-photo { margin: 16px 0; }
.portal-welcome-photo img { max-height: 365px; object-fit: cover; object-position: center; }
.portal-letter { margin: 18px 0 0; }
.portal-letter h2 { margin: 0 0 10px; }

.portal-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(14px, 2.6vw, 22px);
  margin: 0 0 16px;
}
.portal-panel h2 { margin: 0 0 5px; color: var(--portal-navy); font-size: 17px; font-weight: 650; }
.portal-panel p { margin: 5px 0 0; }
.portal-message { color: var(--muted); }
.portal-message.is-error { border-color: #ecd4cb; background: #fdf8f5; color: #783a2b; }
.portal-message button { margin-top: 10px; min-height: 40px; }
.portal-wallet-kicker { color: var(--wallet-green); }
.wallet-overview { display: grid; gap: 16px; grid-template-columns: minmax(220px, .95fr) minmax(270px, 1.05fr); align-items: center; margin-bottom: 16px; }
.wallet-face {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1.586;
  margin: 0;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 8px 23px #27371a2c;
  container-type: inline-size;
}
.wallet-face.is-fallback { background: #36472a; }
.wallet-face img { display: block; width: 100%; height: 100%; object-fit: contain; }
.wallet-face figcaption {
  position: absolute;
  inset: auto 7.5% 11%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f9e5af;
  text-shadow: 0 1px 2px #110e08;
  font-size: 13px;
  font-size: clamp(9px, 3.1cqw, 17px);
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.wallet-balance {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #dce6d1;
  border-radius: 12px;
  background: var(--wallet-green-soft);
  font-variant-numeric: tabular-nums;
}
.wallet-balance dl { margin: 0; }
.wallet-balance dl div { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; padding: 5px 0; }
.wallet-balance dt { color: var(--muted); font-size: 12px; }
.wallet-balance dd { margin: 0; font-size: clamp(14px, 2vw, 19px); color: var(--wallet-green); font-weight: 700; }
.wallet-balance .wallet-total { border-top: 1px solid #cddbbf; margin-top: 4px; padding-top: 9px; }
.wallet-balance .wallet-total dt { color: #324226; font-weight: 650; }
.wallet-countdown { margin: 0; border-top: 1px solid #cddbbf; padding-top: 10px; line-height: 1.45; font-size: 12px; }
.wallet-countdown strong { color: var(--wallet-green); font-size: 19px; }
.wallet-countdown small { display: block; color: var(--muted); }
.wallet-balance .wallet-expired { margin: 0; color: var(--muted); font-size: 12px; }
.wallet-banner { background: #fff6f2; border-color: #efded4; color: #6f2726; }
.wallet-banner h2 { color: #6f2726; }
.wallet-test-banner { border-color: #bfd9d6; background: #eef7f6; }
.wallet-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 15px; }
.wallet-switch button[aria-pressed="true"] { background: var(--blue-soft); color: var(--action); border-color: #bed2ed; font-weight: 650; }
.wallet-movements { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wallet-movements th, .wallet-movements td { text-align: left; border-bottom: 1px solid var(--line); padding: 8px 7px; vertical-align: top; }
.wallet-movements th { color: var(--muted); font-size: 11px; font-weight: 650; }
.wallet-movements td { font-size: 12px; }
.wallet-movements th.money, .wallet-movements td.money { text-align: right; white-space: nowrap; }
.wallet-movements td.money { color: var(--wallet-green); font-weight: 650; }
.wallet-movements strong { color: var(--portal-navy); font-weight: 650; }
.wallet-movements small { display: block; color: var(--muted); font-size: 11px; }
.wallet-movements tr:last-child td { border-bottom: 0; }
.portal-terms summary { cursor: pointer; color: var(--action); font-weight: 650; }
.portal-terms ol { margin: 10px 0 0; padding-left: 22px; }
.portal-terms li { padding: 3px 0; }

.portal-record-list { list-style: none; margin: 0; padding: 0; }
.portal-record-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 11px 0; }
.portal-record-list li:first-child { border-top: 0; }
.portal-record-list strong { display: block; color: var(--portal-navy); font-size: 13px; overflow-wrap: anywhere; }
.portal-record-list time { color: var(--muted); font-size: 12px; }
.portal-record-list a { flex: none; padding: 6px 9px; color: var(--action); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; }
.portal-medical-actions { margin: 0 0 16px; }
.portal-medical-actions button { min-height: 40px; }
.portal-medical-actions p { margin: 6px 0 0; color: var(--muted); }

@media (max-width: 860px) {
  .portal-dashboard { grid-template-columns: 172px minmax(0, 1fr); }
  .wallet-overview { grid-template-columns: 1fr; }
  .wallet-face { width: min(100%, 350px); }
}
@media (max-width: 650px) {
  .portal-dashboard, .portal-login { grid-template-columns: minmax(0, 1fr); }
  .portal-login .login { order: -1; }
  .portal-sidebar { position: static; }
  .portal-sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal .portal-biounity { display: none; }
  .portal .portal-header { padding-inline: 14px; gap: 8px; }
  .portal .portal-header .header-tools { flex-basis: auto; width: auto; }
  .wallet-movements th, .wallet-movements td { padding-inline: 3px; }
  .wallet-movements td { font-size: 11px; }
}
@media (max-width: 380px) {
  .portal-identity { font-size: 13px; gap: 5px; }
  .portal-identity img { width: 31px; height: 31px; }
  .portal-sidebar nav { grid-template-columns: minmax(0, 1fr); }
}
