:root {
  font-family:
    'DM Sans',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #171a1f;
  background: #fff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light;
  --ink: #16181d;
  --teal: #1a9a84;
  --teal-deep: #147e6c;
  --muted: #8b919a;
  --label: #5e6570;
  --line: #e6e8ec;
  --placeholder: #c5c9d0;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background: #fff;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border: 0;
  background: transparent;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
::selection {
  color: #0f3d36;
  background: #d5f0ea;
}

.login-page {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(460px, 1.05fr);
  background: #fff;
  padding: 16px 16px 16px 0;
}

.login-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
}

.login-content {
  width: 100%;
  max-width: 400px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 44px;
  text-decoration: none;
}


.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
}

.brand-name {
  color: var(--teal);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.form-heading {
  margin-bottom: 36px;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.038em;
  line-height: 1.15;
}

h1:focus {
  outline: none;
}

.form-heading > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.field-group {
  margin-bottom: 26px;
}

.field-group > label {
  display: block;
  margin-bottom: 4px;
  color: var(--label);
  font-size: 14px;
  font-weight: 500;
}

.input-line {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}

.input-line:focus-within {
  border-bottom-color: var(--teal);
}

.input-line input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  padding: 10px 0 12px;
}

.input-line input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.input-line input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 9999s ease-out;
}

.password-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 2px;
  color: #9aa1aa;
  border-radius: 8px;
  flex-shrink: 0;
}

.password-toggle:hover:not(:disabled) {
  color: var(--label);
  background: #f4f6f7;
}

.password-group {
  margin-bottom: 18px;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 22px;
  font-size: 14px;
}

.remember-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  color: #6d7480;
  cursor: pointer;
}

.remember-control input {
  position: absolute;
  left: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
}

.checkbox-visual {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1.5px solid #cfd3d8;
  border-radius: 3px;
  background: #fff;
  color: #fff;
  flex-shrink: 0;
}

.remember-control input:checked + .checkbox-visual {
  background: var(--teal);
  border-color: var(--teal);
}

.remember-control input:focus-visible + .checkbox-visual {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.text-button {
  padding: 0;
  color: var(--teal);
  font-size: inherit;
  font-weight: 600;
}

.text-button:hover:not(:disabled) {
  color: var(--teal-deep);
}

.submit-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.submit-button:hover:not(:disabled) {
  background: var(--teal-deep);
}
.submit-button:active:not(:disabled) {
  background: #11685a;
}

.access-help {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.story-panel {
  position: relative;
  min-height: calc(100svh - 32px);
  display: flex;
  flex-direction: column;
  padding: 28px 28px 24px;
  border-radius: 28px;
  overflow: hidden;
  background-color: #c7e4dc;
  background-image:
    radial-gradient(
      ellipse 85% 70% at -8% -12%,
      #f7d4c2 0%,
      rgba(247, 212, 194, 0.65) 32%,
      rgba(247, 212, 194, 0) 62%
    ),
    radial-gradient(
      ellipse 70% 55% at 92% 8%,
      rgba(255, 255, 255, 0.45) 0%,
      rgba(255, 255, 255, 0) 58%
    ),
    radial-gradient(ellipse 80% 75% at 108% 108%, #6eb8ab 0%, rgba(110, 184, 171, 0) 52%),
    linear-gradient(168deg, #f6e6de 0%, #e7f3ee 24%, #d4ebe4 52%, #b7ddd2 100%);
  box-shadow: 0 12px 40px rgba(40, 80, 72, 0.06);
}

.panel-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 10px rgba(90, 70, 60, 0.12);
}

.panel-card {
  margin-top: auto;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: #1c2533;
  color: #fff;
  box-shadow: 0 18px 40px rgba(18, 32, 36, 0.16);
}

.panel-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-card-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: #fff;
}

.panel-card-mark img {
  display: block;
  width: 28px;
  height: 28px;
}

.panel-card-name,
.panel-card-meta,
.panel-card-body {
  margin: 0;
}

.panel-card-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.panel-card-meta {
  margin-top: 2px;
  color: #9aa3b2;
  font-size: 13px;
  line-height: 1.3;
}

.panel-card-body {
  margin-top: 14px;
  color: #d7dee6;
  font-size: 14.5px;
  line-height: 1.45;
}

.has-error {
  border-bottom-color: #c4544a;
}
.has-error:focus-within {
  border-bottom-color: #c4544a;
}

.field-error {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 13px;
  line-height: 1.45;
}

.form-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fdf6f3;
  color: #8a4b32;
  font-size: 13px;
  line-height: 1.55;
}

.spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.back-button {
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.back-button:hover:not(:disabled) {
  color: var(--teal);
}

.success-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #e7f6f2;
  color: var(--teal);
}

.sent-email {
  margin: 0;
  color: var(--teal);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.reset-hint {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.help-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 32px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(16, 24, 32, 0.18);
}

.help-dialog::backdrop {
  background: rgba(17, 24, 32, 0.45);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #75808c;
}

.dialog-close:hover {
  background: #f3f5f6;
}

.help-dialog h2 {
  margin: 18px 0 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.help-dialog p {
  margin: 0 0 10px;
  color: #6d7580;
  font-size: 14px;
  line-height: 1.6;
}

.help-dialog .submit-button {
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .login-page {
    grid-template-columns: 1fr 1fr;
    padding-right: 12px;
  }
  .login-side {
    padding: 40px 32px;
  }
  .story-panel {
    padding: 22px 20px 18px;
    border-radius: 22px;
  }
  h1 {
    font-size: 36px;
  }
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .story-panel {
    display: none;
  }
  .login-side {
    min-height: 100svh;
    align-items: center;
    padding: 40px 24px 32px;
  }
  .login-content {
    max-width: 420px;
  }
}

@media (max-width: 440px) {
  .login-side {
    padding: 32px 22px 28px;
  }
  .brand {
    margin-bottom: 36px;
  }
  h1 {
    font-size: 34px;
  }
  .form-heading {
    margin-bottom: 30px;
  }
  .form-heading > p {
    font-size: 15px;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  .login-side {
    padding-top: 28px;
    padding-bottom: 28px;
  }
  .brand {
    margin-bottom: 28px;
  }
  .form-heading {
    margin-bottom: 24px;
  }
  h1 {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/*
 * Sign-in: split screen. The panel uses the Soliana mark as a rim-lit light source
 * and a single illustrative ERA that balances itself; the form side stays quiet.
 */
.login-page.login-themed {
  --ink: #142a3f;
  --teal: #007a71;
  --teal-deep: #00645d;
  --lagoon: #0abcb0;
  --foam: #bff5ea;
  --abyss: #032422;
  --muted: #536676;
  --label: #34495a;
  --line: #c6d3d6;
  --placeholder: #63727e;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  grid-template-areas: 'panel main';
  min-height: 100svh;
  padding: 0;
  background: #fff;
  color: var(--ink);
  color-scheme: light;
}

/* ---------- Form column ---------- */

.login-themed .login-main {
  grid-area: main;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  gap: 32px;
  padding: 56px clamp(24px, 5vw, 72px) 24px;
}

.login-themed .form-area {
  width: min(100%, 384px);
  background: #fff;
}

.login-themed .login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 48px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.035em;
}
.login-themed .login-card-mark {
  display: block;
}

.login-themed .form-heading {
  margin-bottom: 32px;
}
.login-themed h1 {
  color: var(--ink);
  font-size: 32px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.login-themed .form-heading > p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.login-themed .field-group {
  margin: 0 0 18px;
}
.login-themed .field-group > label {
  margin-bottom: 7px;
  color: var(--label);
  font-size: 13.5px;
  font-weight: 550;
}
.login-themed .input-line {
  min-height: 48px;
  padding-inline: 14px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: #fff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.login-themed .input-line:hover {
  border-color: #9fb3b8;
}
.login-themed .input-line:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgb(10 188 176 / 0.2);
}
.login-themed .input-line.has-error {
  border-color: #b42318;
}
.login-themed .input-line.has-error:focus-within {
  box-shadow: 0 0 0 4px rgb(180 35 24 / 0.14);
}
.login-themed .input-line input {
  padding: 12px 0;
  font-size: 16px;
}
.login-themed .input-line input::placeholder {
  color: var(--placeholder);
}

.login-themed .password-toggle {
  color: var(--muted);
}
.login-themed .password-toggle:hover:not(:disabled) {
  color: var(--ink);
  background: #eef4f4;
}

.login-themed .form-options {
  flex-wrap: wrap;
  margin: 2px 0 24px;
  gap: 4px 12px;
  font-size: 13.5px;
}
.login-themed .remember-control {
  color: var(--muted);
}
.login-themed .checkbox-visual {
  border-color: #9fb3b8;
  border-radius: 4px;
}
.login-themed .text-button {
  color: var(--teal);
}
.login-themed .text-button:hover:not(:disabled) {
  color: var(--teal-deep);
}

.login-themed .submit-button {
  min-height: 48px;
  border-radius: 999px;
  background-color: var(--teal);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.16),
    0 1px 2px rgb(0 70 64 / 0.25);
  font-size: 15px;
}
.login-themed .submit-button:hover:not(:disabled) {
  background-color: var(--teal-deep);
}
.login-themed .submit-button:active:not(:disabled) {
  background-color: #00544e;
}

.login-themed .back-button:hover:not(:disabled) {
  color: var(--teal);
}

.login-themed .demo-entry {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #e1e9ea;
}
.login-themed .demo-entry-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 2px 10px;
  border-radius: 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 650;
}
.login-themed .demo-entry-button:hover {
  color: var(--teal-deep);
  background: #edf6f5;
}
.login-themed .demo-entry > span {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.login-themed .access-help {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.login-themed .reset-confirmation .sent-email {
  color: var(--teal);
}

.login-themed .help-dialog {
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
}
.login-themed .help-dialog a {
  color: var(--teal);
}

.login-themed .login-copyright {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Panel ---------- */

.login-panel {
  grid-area: panel;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 392px);
  place-content: center;
  gap: 20px;
  padding: clamp(36px, 4.2vw, 64px);
  color: #effffb;
  background-color: var(--abyss);
  background-image:
    radial-gradient(ellipse 55% 40% at 82% 18%, rgb(10 188 176 / 0.34), transparent 70%),
    radial-gradient(ellipse 80% 55% at 0% 105%, rgb(0 105 99 / 0.5), transparent 70%),
    linear-gradient(165deg, #053b37 0%, var(--abyss) 52%, #021715 100%);
}

/* Film grain keeps the dark gradient from banding. */
.login-panel::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: '';
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.panel-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
}

.panel-copy {
  position: relative;
  z-index: 2;
}
.panel-title {
  margin: 0;
  color: #f2fffc;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.038em;
  text-wrap: balance;
}
.panel-lede {
  max-width: 34ch;
  margin: 8px 0 0;
  color: #a3cbc4;
  font-size: 16px;
  line-height: 1.5;
}

/* Illustrative ERA card */
.era-card {
  width: min(100%, 392px);
  padding: 20px 22px 20px;
  border: 1px solid rgb(191 245 234 / 0.15);
  border-radius: 18px;
  background: rgb(2 26 24 / 0.6);
  box-shadow:
    0 40px 80px -30px rgb(0 0 0 / 0.75),
    inset 0 1px 0 rgb(255 255 255 / 0.07);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  color: #effffb;
  font-variant-numeric: tabular-nums;
}
.era-card p {
  margin: 0;
}

.era-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgb(191 245 234 / 0.1);
}
.era-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.era-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgb(255 255 255 / 0.07);
  color: #a3bdb8;
  font-size: 12.5px;
  font-weight: 600;
  transition:
    color 0.3s ease,
    background-color 0.3s ease;
}
.era-card[data-state='balanced'] .era-badge {
  background: rgb(10 188 176 / 0.18);
  color: #92f2dc;
}
.era-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f1c27d;
  animation: era-pulse 1s ease-in-out infinite alternate;
}

.era-patient {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 14px;
}
.era-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--lagoon), #006963);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.era-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.era-card .era-meta {
  margin-top: 2px;
  color: #8fb3ac;
  font-size: 13px;
}

.era-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.era-lines li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px dashed rgb(191 245 234 / 0.24);
  border-radius: 6px;
  color: #7fa49d;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    color 0.25s ease,
    background-color 0.25s ease,
    border-color 0.25s ease;
}
.era-lines li[data-posted='true'] {
  border-style: solid;
  border-color: transparent;
  background: rgb(10 188 176 / 0.16);
  color: var(--foam);
}

.era-totals {
  display: grid;
  gap: 9px;
  margin: 0;
}
.era-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}
.era-totals dt {
  color: #8fb3ac;
}
.era-totals dd {
  margin: 0;
  color: #f2fffc;
  font-weight: 600;
  animation: era-tick 0.35s ease-out;
}
.era-difference dd {
  color: #f1c27d;
  transition: color 0.3s ease;
}
.era-card[data-state='balanced'] .era-difference dd {
  color: #92f2dc;
}

@keyframes era-tick {
  from {
    opacity: 0.3;
    transform: translateY(3px);
  }
}
@keyframes era-pulse {
  to {
    opacity: 0.35;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) and (min-width: 880px) {
  .login-panel {
    padding: 36px;
  }
}

@media (max-width: 879px) {
  .login-page.login-themed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      'panel'
      'main';
  }
  .login-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 196px;
    padding: 36px 24px 28px;
  }
  .panel-stage {
    display: none;
  }
  .panel-lede {
    margin-top: 10px;
    font-size: 15px;
  }
  .login-themed .login-main {
    align-items: start;
    padding: 40px 20px 24px;
  }
  .login-themed .login-brand {
    margin-bottom: 32px;
  }
}

@media (max-width: 480px) {
  .panel-lede {
    display: none;
  }
  .login-panel {
    min-height: 168px;
    padding: 30px 20px 24px;
  }
  .login-themed h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .era-totals dd,
  .era-pulse {
    animation: none;
  }
  .era-badge,
  .era-lines li,
  .era-difference dd {
    transition: none;
  }
}

.access-help a, .access-help summary { color: var(--teal-deep); cursor: pointer; }
.submit-button:disabled { cursor: default; }
