:root {
  color-scheme: light;
  --mv-navy: #041830;
  --mv-gold: #d1a13a;
  --mv-purple: #6750a4;
  --mv-white: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17233c;
  background: #f8fafc;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; padding: 0 !important; margin: -1px !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

body { margin: 0; min-height: 100vh; background: #f8fafc; }

.portal-page { height: 100svh; min-height: 100svh; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }

.shell {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  place-items: stretch;
}

.panel, .portal-story { min-height: 0; }

body:not(.app-authenticated) .portal-page > .shell { overflow: auto; }

.panel { display: grid; place-items: center; padding: clamp(2rem, 5vw, 4.75rem); background: #f8fafc; }
.portal-entry-card { width: min(32rem, 100%); min-height: 43.125rem; display: grid; align-content: start; padding: 2.375rem 2.125rem 1.875rem; border: 1px solid #e2e8f0; border-radius: .625rem; background: var(--mv-white); box-shadow: 0 .5rem 1.5rem rgba(15, 23, 42, .08); }
.portal-brand { display: flex; align-items: center; gap: .75rem; width: max-content; }
.portal-brand img { width: 2.875rem; height: 2.75rem; object-fit: contain; }
.portal-brand span { font-size: 1.8rem; font-weight: 700; line-height: 1; letter-spacing: -.035em; }
.portal-brand b { color: var(--mv-gold); }
.portal-brand--light { margin: 0 auto 2.125rem; color: var(--mv-navy); }
.portal-login-eyebrow { margin: 0 0 .75rem; color: #9a711b; font-size: .6875rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.portal-entry-card h1 { margin: 0; color: #0f172a; font-size: 2rem; line-height: 1.2; letter-spacing: -.025em; }
.portal-entry-card h1[tabindex="-1"]:focus, .workspace[tabindex="-1"]:focus { outline: none; }
.portal-entry-view { min-width: 0; display: grid; gap: 1rem; animation: portal-state-in .22s ease-out; }
.portal-login-form { gap: 1.125rem; }
.portal-stepper { margin: .5rem 0 1.75rem; }
.portal-stepper ol { display: flex; align-items: center; gap: .65rem; padding: 0; margin: 0; list-style: none; }
.portal-stepper li { min-width: 0; display: flex; align-items: center; gap: .45rem; color: #475569; font-size: .75rem; white-space: nowrap; }
.portal-stepper li:not(:last-child) { flex: 1; }
.portal-stepper li:not(:last-child)::after { content: ""; height: 1px; flex: 1; min-width: .75rem; margin-left: .2rem; background: #cbd5e1; }
.portal-stepper li > span { width: 1.625rem; height: 1.625rem; display: grid; place-items: center; flex: 0 0 1.625rem; border-radius: 999px; background: #e2e8f0; color: #475569; font-weight: 800; }
.portal-stepper li > b { font-weight: 500; }
.portal-stepper li.is-current { color: #4c1d95; }
.portal-stepper li.is-current > span { background: #4c1d95; color: white; }
.portal-stepper li.is-current > b { font-weight: 800; }
.portal-stepper li.is-complete > span { background: #22a447; color: white; }
.portal-bootstrap-state, .invitation-acceptance, .portal-loading-state, .portal-error-state { place-items: center; align-content: center; min-height: 26rem; text-align: center; }
.portal-bootstrap-state p, .portal-loading-state > p, .portal-error-state p { margin: 0; color: #475569; line-height: 1.5; }
.portal-loader { width: 2.5rem; height: 2.5rem; display: block; border: .2rem solid #e2e8f0; border-top-color: var(--mv-purple); border-radius: 999px; animation: portal-spin .8s linear infinite; }
.portal-entry-description { margin: -.35rem 0 .2rem; color: #475569; line-height: 1.5; }
.portal-entry-notice { display: grid; gap: .25rem; margin: 0; padding: .75rem .875rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #f8fafc; color: #334155; font-size: .8125rem; line-height: 1.45; }
.portal-entry-identity { display: grid; grid-template-columns: 2.75rem minmax(0,1fr) auto; align-items: center; gap: .75rem; margin: .25rem 0; }
.portal-entry-identity > span:nth-child(2) { display: grid; gap: .125rem; min-width: 0; }
.portal-entry-identity small { color: #64748b; overflow-wrap: anywhere; }
.portal-avatar { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 999px; background: #eeeafd; color: #382284; font-weight: 800; }
.portal-page .portal-link-button { min-height: 2.75rem; margin: 0; padding: .35rem 0; border: 0; border-radius: 0; background: transparent; color: #4c1d95; font-weight: 700; text-decoration: none; cursor: pointer; }
.portal-page .portal-link-button:hover { background: transparent; color: #2e1065; text-decoration: underline; }
.portal-page .portal-link-button--outlined, .portal-page .mv-link-button--outlined { width: 100%; min-height: 2.75rem; padding: .55rem 1rem; border: 1px solid var(--mv-purple); border-radius: .5rem; background: var(--mv-white); color: var(--mv-purple); font-size: .8125rem; text-align: center; }
.portal-page .portal-link-button--outlined:hover, .portal-page .mv-link-button--outlined:hover { background: var(--mv-purple); color: var(--mv-white); text-decoration: none; }
.portal-safe { width: max-content; justify-self: center; display: flex; align-items: center; gap: .45rem; margin: 0; padding: .35rem .7rem; border: 1px solid #86d59a; border-radius: 999px; background: #f0fdf4; color: #15803d; font-size: .75rem; font-weight: 700; }
.portal-safe > span:first-child { width: 1rem; height: 1rem; display: grid; place-items: center; border-radius: 999px; background: #22a447; color: white; font-size: .65rem; }
.portal-language-options { display: grid; grid-template-columns: repeat(3,1fr); gap: .625rem; padding: 0; margin: .15rem 0 0; border: 0; }
.portal-language-options legend { grid-column: 1/-1; margin-bottom: .15rem; font-size: .875rem; font-weight: 700; }
.portal-page .portal-language-options button { position: relative; min-height: 5.25rem; display: grid; place-items: center; align-content: center; gap: .25rem; margin: 0; padding: .6rem; border: 1px solid var(--mv-purple) !important; border-radius: .5rem; background: var(--mv-white) !important; color: #0f172a !important; }
.portal-page .portal-language-options button:hover, .portal-page .portal-language-options button:focus-visible { border-color: var(--mv-purple) !important; background: var(--mv-purple) !important; color: var(--mv-white) !important; }
.portal-page .portal-language-options button.is-selected { border: 2px solid #4c1d95 !important; background: var(--mv-purple) !important; color: var(--mv-white) !important; }
.portal-language-options button.is-selected::after { content: "✓"; position: absolute; top: .45rem; right: .45rem; width: 1.25rem; height: 1.25rem; display: grid; place-items: center; border-radius: 999px; background: #4c1d95; color: white; font-size: .7rem; }
.portal-language-options button span { color: #64748b; font-size: .75rem; }
.portal-language-options button:hover span, .portal-language-options button:focus-visible span, .portal-language-options button.is-selected span { color: var(--mv-white); }
.portal-reset-language { justify-self: start; min-height: 2rem; margin-top: -.35rem; font-size: .8125rem; }
.portal-language-tenant { display: grid; gap: .4rem; }
.portal-language-tenant label { margin: 0; font-size: .875rem; }
.portal-language-tenant select { min-height: 2.875rem; padding: .5rem .75rem; border-radius: .5rem; }
.portal-language-tenant small { color: #64748b; font-size: .75rem; }
.portal-later { justify-self: center; }
.portal-loading-symbol { width: 7rem; height: 7rem; display: grid; place-items: center; margin-bottom: .75rem; border-radius: 999px; background: radial-gradient(circle,#fff 20%,#f1eafe 50%,#fff4dd 70%,transparent 72%); }
.portal-loading-symbol img { width: 3rem; height: 3rem; }
.portal-progress { width: 100%; height: .65rem; overflow: hidden; margin: 1rem 0 .25rem; border-radius: 999px; background: #e2e8f0; }
.portal-progress span { display: block; width: 78%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#4c1d95,#7c3aed,#f59e0b); animation: portal-progress 1.6s ease-in-out infinite alternate; }
.portal-loading-active { min-height: 1.5rem; font-weight: 600; }
.portal-loading-tasks { width: 100%; display: grid; gap: .75rem; padding: 0; margin: .75rem 0; list-style: none; text-align: left; }
.portal-loading-tasks li { display: flex; align-items: center; gap: .65rem; color: #334155; }
.portal-loading-tasks li > span { width: 1.35rem; height: 1.35rem; display: grid; place-items: center; flex: 0 0 1.35rem; border-radius: 999px; border: 2px solid #cbd5e1; font-size: .7rem; }
.portal-loading-tasks li.is-active > span { border-color: var(--mv-purple); border-top-color: transparent; animation: portal-spin .8s linear infinite; }
.portal-loading-tasks li.is-complete > span { border-color: #22a447; background: #22a447; color: white; }
.portal-loading-tasks li.is-error > span { border-color: #b91c1c; background: #fef2f2; color: #b91c1c; }
.portal-loading-tasks li > b { font-weight: 500; }
.portal-error-icon { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 999px; background: #fef2f2; color: #b91c1c; font-size: 1.5rem; font-weight: 800; }
.account-actions { display: flex; gap: .65rem; flex-wrap: wrap; justify-content: flex-end; }
@keyframes portal-spin { to { transform: rotate(360deg); } }
@keyframes portal-progress { from { transform: translateX(-8%); } to { transform: translateX(28%); } }
@keyframes portal-state-in { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: translateY(0); } }

/* Match the Platform Admin login shell: content determines height, footer owns its row. */
.portal-page { min-height: 100svh; grid-template-rows: minmax(0, 1fr) auto; }
.portal-entry-card { min-height: 0; }
.portal-login-description { margin: .5rem 0 1.75rem; color: #64748b; font-size: .9375rem; line-height: 1.5; }
.portal-login-field { display: grid; gap: .4375rem; }
.portal-login-field label { margin: 0; color: #0f172a; font-size: .875rem; font-weight: 600; }
.portal-login-field input { width: 100%; min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid #cbd5e1; border-radius: .375rem; background: var(--mv-white); color: #0f172a; font: inherit; }
.portal-login-field input::placeholder { color: #94a3b8; }
.portal-login-field input:focus, .portal-login-remember input:focus-visible, .portal-password-toggle:focus-visible { outline: .1875rem solid var(--mv-gold); outline-offset: .125rem; }
.portal-password-control { position: relative; }
.portal-password-control input { padding-right: 3rem; }
.portal-page .portal-password-toggle { position: absolute; top: 50%; right: .3125rem; width: 2.375rem; height: 2.375rem; min-height: 0; display: grid; place-items: center; margin: 0; padding: 0; transform: translateY(-50%); border: 0; border-radius: .375rem; background: transparent; color: #64748b; cursor: pointer; }
.portal-password-toggle:hover { color: var(--mv-navy); background: #f1f5f9; }
.portal-password-toggle svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal-login-remember { width: max-content; min-height: 1.75rem; display: flex; align-items: center; gap: .625rem; margin: 0; color: #0f172a; font-size: .875rem; font-weight: 600; cursor: pointer; }
.portal-login-remember input { width: 1.125rem; min-height: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--mv-purple); }
.portal-login-error { min-height: 0; margin: 0; }
.portal-login-error:not(:empty) { min-height: 1.5rem; padding: .75rem .875rem; border-radius: .375rem; background: #fff0ee; }

@media (min-width: 761px) and (max-height: 900px) {
  .panel { padding-block: .75rem; }
  .portal-entry-card { padding-top: 1.5rem; padding-bottom: 1.25rem; }
  .portal-brand--light { margin-bottom: 1.5rem; }
  .portal-stepper { margin-bottom: 1rem; }
  .portal-entry-view { gap: .75rem; }
  .portal-entry-identity { margin-block: .5rem; }
  .portal-language-options button { min-height: 4.25rem; }
}

body.app-authenticated .portal-page { display: block; height: auto; min-height: 0; overflow: visible; }
body.app-authenticated .shell { display: block; min-height: 100vh; }
body.app-authenticated .panel { display: block; width: 100%; min-width: 0; max-width: none; margin: 0; padding: 0; background: transparent; }
body.app-authenticated #account { width: 100%; min-width: 0; max-width: none; margin: 0; }
body.app-authenticated .portal-story, body.app-authenticated .portal-footer { display: none; }
