.portal-shell {
    width: min(1460px, calc(100% - 2rem));
    min-height: 100vh;
    margin: 0 auto;
    padding: .75rem 0 1rem;
}

.portal-header,
.portal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    border: 1px solid rgba(159, 177, 195, .76);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 30px rgba(20, 37, 50, .08);
}

.portal-header {
    position: sticky;
    top: .55rem;
    z-index: 20;
    min-height: 82px;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(15px);
}

.portal-header-compact { position: static; }

.portal-brand {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
    color: var(--ink);
}

.portal-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    flex: 0 0 auto;
    /* Größer sichtbar, ohne die Proportionen des Logos zu verändern. */
    transform: scale(1.1);
    transform-origin: left center;
}

.portal-brand > span { display: grid; gap: .05rem; min-width: 0; }
.portal-brand small { color: var(--ink-soft); font-size: .74rem; font-weight: 750; letter-spacing: .09em; text-transform: none; white-space: nowrap; }
.portal-brand strong { overflow: hidden; font-size: 1.06rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-header > .button { flex: 0 0 auto; white-space: nowrap; }
.portal-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; gap: .55rem; }
.portal-actions form { margin: 0; }
.portal-auth-error-banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: .6rem 0 0; }
.portal-auth-error-banner a { flex: 0 0 auto; color: inherit; font-weight: 750; text-decoration: underline; text-underline-offset: .16em; }

.portal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(430px, .98fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4.5rem);
    min-height: min(720px, calc(100vh - 6rem));
    margin-top: .8rem;
    padding: clamp(1.35rem, 4vw, 4.5rem);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: radial-gradient(circle at 88% 12%, rgba(50, 135, 168, .17), transparent 30%), linear-gradient(125deg, #f5fafc, #fff 62%);
    box-shadow: var(--shadow);
}

.portal-hero-copy h1,
.auth-portal-intro h1 {
    max-width: 14ch;
    margin: .25rem 0 1rem;
    font-size: clamp(2.35rem, 5.5vw, 5.3rem);
    line-height: .98;
    letter-spacing: -.05em;
}

.portal-hero-copy > p:not(.eyebrow) { max-width: 64ch; color: #435462; font-size: clamp(1rem, 1.45vw, 1.18rem); line-height: 1.6; }
.portal-hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.2rem; }
.portal-hero-copy .portal-beta-note { margin-top: .75rem; color: var(--ink-soft); font-size: .75rem; }

.portal-welcome-hero {
    grid-template-columns: minmax(0, .88fr) minmax(430px, 1.12fr);
    min-height: min(700px, calc(100vh - 6rem));
    background:
        linear-gradient(to right, #d9edf4 0%, #eef7fa 30%, #f8fcfd 46%, #fff 58%, #fff 100%);
}
.portal-welcome-brand { display: flex; align-items: center; gap: clamp(.75rem, 1.5vw, 1.25rem); min-width: 0; margin: -.25rem 0 .85rem; }
.portal-welcome-logo { width: clamp(76px, 9vw, 122px); height: clamp(76px, 9vw, 122px); flex: 0 0 auto; object-fit: contain; transform: scale(1.08); transform-origin: left center; }
.portal-welcome-brand h1 { max-width: none; margin: 0; color: var(--ink); font-size: clamp(3.78rem, 7.812vw, 7.56rem); line-height: .9; letter-spacing: -.07em; white-space: nowrap; }
.portal-welcome-hero .portal-hero-copy { position: relative; z-index: 1; align-self: start; }
.portal-welcome-hero .portal-hero-copy > p:not(.eyebrow) { margin: .55rem 0; font-size: clamp(.88rem, 1.15vw, 1.02rem); line-height: 1.56; }
.portal-welcome-hero .portal-hero-copy .portal-welcome-line { margin-top: 1rem; color: var(--ink); font-size: clamp(1.3rem, 1.885vw, 1.53rem); font-weight: 720; }
.landing-page main { display: flex; flex-direction: column; }
.landing-page .portal-welcome-hero { order: 1; }
.landing-page .portal-access-section { order: 2; margin-top: .55rem; }
.landing-page .portal-public-stats { order: 3; }
.landing-page .portal-feature-grid { order: 4; }
.portal-welcome-hero .portal-hero-actions { justify-content: flex-end; margin-top: 1.35rem; }
.portal-welcome-hero .portal-hero-access { margin: 1rem 0 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.portal-welcome-hero .portal-hero-access .portal-auth-tabs { width: 100%; margin: 0; }
.portal-welcome-hero .portal-hero-access .auth-grid-portal { width: 100%; margin: .45rem 0 0; }
.portal-welcome-hero .portal-hero-access .auth-card { padding: .75rem; gap: .58rem; background: rgba(255, 255, 255, .86); box-shadow: 0 8px 20px rgba(24, 44, 58, .07); }

.portal-public-hx { min-width: 0; margin: 0; }
.portal-hx-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.portal-hx-reference-image { display: block; width: min(100%, 720px); height: auto; max-height: min(84vh, 860px); object-fit: contain; border-radius: 0; }
.portal-welcome-hero .portal-public-hx { position: relative; align-self: start; width: 115%; transform: translateX(clamp(0rem, 2vw, 2rem)); margin-right: clamp(-1.5rem, -2vw, -0.2rem); }
.portal-welcome-hero .portal-hx-reference-image { width: 100%; max-width: none; }
.portal-welcome-hero .portal-public-hx figcaption { position: static; display: grid; gap: .12rem; width: 100%; margin: .45rem 0 0; color: var(--ink-soft); text-align: left; text-shadow: none; }
.portal-welcome-hero .portal-public-hx figcaption strong { font-size: .95rem; }
.portal-welcome-hero .portal-public-hx figcaption span { font-size: .69rem; }
.portal-hx-stage svg { display: block; width: 100%; height: auto; }
.portal-hx-stage .public-hx-grid { fill: none; stroke: #dbe5ea; stroke-width: .85; }
.portal-hx-stage .public-hx-enthalpy { fill: none; stroke: #c4d0d7; stroke-width: .7; }
.public-hx-saturation { fill: none; stroke: #111f27; stroke-width: 2; }
.public-hx-relative,
.public-hx-relative path { fill: none; stroke: #6a8391; stroke-width: 1.05; stroke-dasharray: 4 3; }
.public-hx-process { fill: none; stroke: #173f53; stroke-width: 2.5; }
.public-hx-states { fill: #fff; stroke: #173f53; stroke-width: 2.5; }
.public-hx-axis { fill: none; stroke: #12232c; stroke-width: 2; }
.public-hx-ticks { fill: none; stroke: #12232c; stroke-width: 1.5; }
.public-hx-labels { fill: #273a46; font-family: Georgia, "Times New Roman", serif; font-size: 13px; text-anchor: middle; }
.portal-hx-hat { position: absolute; top: -1rem; right: -1rem; display: grid; place-items: center; width: clamp(78px, 10vw, 116px); aspect-ratio: 1; border: 1px solid rgba(126, 158, 176, .68); border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: 0 18px 34px rgba(22,48,63,.2); transform: rotate(4deg); }
.portal-hx-hat img { width: 82%; height: 82%; object-fit: contain; }
.portal-public-hx figcaption { display: grid; gap: .14rem; margin: .8rem .4rem 0; color: var(--ink-soft); font-size: .73rem; text-align: center; }
.portal-public-hx figcaption strong { color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: .88rem; }

.portal-mini-hx { min-width: 0; margin: 0; padding: 1rem; border: 1px solid rgba(150, 173, 189, .72); border-radius: 20px; background: rgba(255,255,255,.93); box-shadow: 0 24px 55px rgba(26, 52, 68, .14); transform: rotate(1deg); }
.portal-mini-hx svg { display: block; width: 100%; height: auto; }
.portal-mini-hx figcaption { margin-top: .4rem; color: var(--ink-soft); font-size: .72rem; text-align: center; }
.portal-mini-hx text { fill: #283a46; font-family: Georgia, "Times New Roman", serif; font-size: 15px; text-anchor: middle; }
.mini-grid { fill: none; stroke: #d8e2e8; stroke-width: 1; }
.mini-axis { fill: none; stroke: #172b36; stroke-width: 2; }
.mini-curve { fill: none; stroke: #172b36; stroke-width: 2.1; }
.mini-rel { fill: none; stroke: #6b8796; stroke-width: 1.1; stroke-dasharray: 4 4; }

.portal-public-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .65rem;
    margin: .8rem 0;
}
.portal-public-stats > div { display: flex; align-items: baseline; justify-content: center; gap: .55rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(24,44,58,.06); }
.portal-public-stats strong { color: var(--brand-strong); font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.portal-public-stats span { color: var(--ink-soft); font-size: .78rem; }

.portal-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.portal-feature-grid article,
.portal-card { border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.96); box-shadow: 0 9px 26px rgba(24,44,58,.07); }
.portal-feature-grid article { padding: 1.1rem; }
.portal-feature-grid h2 { margin: .35rem 0 .35rem; font-size: 1rem; }
.portal-feature-grid p { margin: 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }
.portal-feature-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--brand-strong); background: #e4f0f5; font-size: 1.05rem; font-weight: 800; }

.portal-access-section { scroll-margin-top: 5.7rem; margin-top: .8rem; padding: clamp(1rem, 2.5vw, 1.7rem); border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(135deg, #eef6f9, #fff 48%, #f5faf8); box-shadow: 0 12px 34px rgba(24,44,58,.08); }
.portal-access-heading { display: grid; justify-items: center; margin: 0 auto 1rem; text-align: center; }
.portal-access-heading h2 { margin: .15rem 0 .35rem; font-size: clamp(1.45rem, 2.6vw, 2.2rem); }
.portal-access-heading > p:last-child { max-width: 68ch; margin: 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }
.portal-auth-error { width: min(820px, 100%); margin: 0 auto .8rem; }
.portal-access-section .auth-grid-portal { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: .75rem; width: min(1020px, 100%); margin: 0 auto; }
.portal-access-section .auth-card { background: rgba(255,255,255,.98); }
.portal-access-section .auth-card h3 { margin: .1rem 0 .25rem; font-size: 1.05rem; }
.portal-auth-tabs { display: flex; width: min(400px, 100%); margin: 0 auto .65rem; padding: .2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--muted-panel); }
.portal-auth-tab { flex: 1 1 0; min-height: 36px; padding: .42rem .75rem; border: 1px solid transparent; border-radius: 9px; color: var(--ink-soft); background: transparent; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.portal-auth-tab:hover { color: var(--brand-strong); }
.portal-auth-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.portal-auth-tab.is-active,
.portal-auth-tab[aria-selected="true"] { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 2px 7px rgba(22, 33, 43, .12); }
.portal-access-section .auth-grid-portal { grid-template-columns: 1fr; width: min(620px, 100%); margin: 0 auto; }
.portal-auth-panel[hidden] { display: none !important; }
.portal-login-compat { width: min(520px, calc(100% - 2rem)); margin: 4rem auto; text-align: center; }

.portal-dashboard-loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: color-mix(in srgb, var(--paper) 18%, transparent); backdrop-filter: blur(1px); }
.portal-dashboard-loading[hidden] { display: none; }
.portal-loading-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .85rem; width: min(440px, 100%); padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: var(--shadow); }
.portal-loading-mark { display: grid; place-items: center; width: 96px; height: 96px; }
.portal-loading-logo { display: block; width: 76px; height: 76px; object-fit: contain; transform-origin: center; animation: portal-loading-simple-spin 2.6s linear infinite; }
.portal-loading-copy { display: grid; gap: .22rem; min-width: 0; }
.portal-loading-copy strong { font-size: .9rem; }
.portal-loading-copy > span { color: var(--ink-soft); font-size: .72rem; line-height: 1.35; }
.portal-loading-progress { position: relative; width: 100%; height: 4px; margin-top: .25rem; overflow: hidden; border-radius: 99px; background: var(--muted-panel); }
.portal-loading-progress span { position: absolute; inset: 0 auto 0 -32%; width: 32%; border-radius: inherit; background: var(--brand); animation: portal-loading-progress 1.35s ease-in-out infinite; }
@keyframes portal-loading-simple-spin { to { transform: rotate(360deg); } }
@keyframes portal-loading-progress { 0% { transform: translateX(0); } 100% { transform: translateX(410%); } }
@media (prefers-reduced-motion: reduce) {
    .portal-loading-logo,
    .portal-loading-progress span { animation-duration: 2.8s; animation-timing-function: linear; }
}

.portal-footer { width: 100%; min-width: 0; margin-top: .8rem; padding: .62rem .8rem; border-radius: 13px; color: var(--ink-soft); font-size: .75rem; box-shadow: none; }
.portal-footer > strong { color: var(--ink); font-size: .76rem; }
.portal-footer nav { display: flex; min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: .5rem 1rem; }
.portal-footer a { color: var(--brand-strong); font-weight: 650; white-space: nowrap; }

.auth-portal-layout { display: grid; grid-template-columns: minmax(320px, .78fr) minmax(600px, 1.22fr); gap: 1rem; min-height: calc(100vh - 150px); margin-top: .8rem; }
.auth-portal-intro { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.2rem, 4vw, 4rem); border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, #e9f3f7, #fafdfe); }
.auth-portal-intro h1 { max-width: 11ch; font-size: clamp(2.2rem, 4vw, 4.2rem); }
.auth-portal-intro > p:not(.eyebrow) { max-width: 52ch; color: #425664; line-height: 1.58; }
.auth-benefits { display: grid; gap: .55rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.auth-benefits li { display: flex; align-items: center; gap: .55rem; font-size: .86rem; }
.auth-benefits li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--brand); font-weight: 800; }
.auth-portal-panel { display: flex; align-items: center; padding: .8rem; }
.auth-grid-portal { width: 100%; align-items: start; }
.auth-grid-portal .auth-card { display: flex; min-width: 0; max-width: 100%; flex-direction: column; gap: .8rem; padding: 1rem; }
.auth-grid-portal .auth-card > *,
.auth-grid-portal .auth-card label,
.auth-grid-portal .auth-card input,
.auth-grid-portal .auth-card button { min-width: 0; max-width: 100%; }
.auth-grid-portal .auth-card h2 { margin: .1rem 0 .65rem; }
.auth-grid-portal .auth-card > .button { margin-top: 0; }
.auth-password-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.auth-password-field { display: grid; gap: .35rem; min-width: 0; }
.portal-password-input { position: relative; display: block; }
.portal-password-input input { padding-right: 2.7rem; }
.portal-password-toggle { position: absolute; top: 50%; right: .3rem; display: grid; place-items: center; width: 2.15rem; height: 2.15rem; padding: 0; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; cursor: pointer; transform: translateY(-50%); }
.portal-password-toggle:hover { color: var(--brand-strong); background: #eaf3f7; }
.portal-password-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.portal-password-toggle[aria-pressed="true"] { color: var(--brand-strong); background: #e4f0f5; }
.portal-password-toggle svg { width: 1.18rem; height: 1.18rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.auth-password-guidance { display: grid; gap: .5rem; padding: .65rem .72rem; border: 1px solid #d7e1e7; border-radius: 12px; background: #f7fafc; }
.auth-password-guidance-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.auth-password-guidance-heading strong { font-size: .76rem; }
.auth-password-guidance-heading span { color: var(--ink-soft); font-size: .65rem; text-align: right; }
.auth-password-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .65rem; margin: 0; padding: 0; list-style: none; }
.auth-password-rules li { display: flex; align-items: center; gap: .38rem; min-width: 0; color: var(--ink-soft); font-size: .69rem; line-height: 1.25; transition: color .15s ease; }
.auth-password-rules li:last-child { grid-column: 1 / -1; }
.auth-password-rules li > span { display: grid; flex: 0 0 auto; place-items: center; width: .9rem; height: .9rem; border: 1px solid #aebbc5; border-radius: 50%; background: #fff; }
.auth-password-rules li > span::before { content: ""; }
.auth-password-rules li.is-met { color: #176443; }
.auth-password-rules li.is-met > span { border-color: #2c8b61; color: #fff; background: #2c8b61; }
.auth-password-rules li.is-met > span::before { content: "✓"; font-size: .62rem; font-weight: 900; line-height: 1; }
.auth-password-rules li.is-unmet { color: #a43932; }
.auth-password-rules li.is-unmet > span { border-color: #cf7770; background: #fff4f3; }
.auth-password-rules li.is-unmet > span::before { content: "×"; font-size: .72rem; font-weight: 800; line-height: 1; }
.auth-password-summary { margin: 0; color: var(--ink-soft); font-size: .66rem; line-height: 1.35; }
.auth-password-summary.is-complete { color: #176443; font-weight: 700; }
.auth-registration-note { margin: -.15rem 0 0; color: var(--ink-soft); font-size: .69rem; line-height: 1.4; }
.portal-consent-row { display: grid !important; grid-template-columns: 18px minmax(0, 1fr); align-items: start !important; gap: .45rem !important; color: var(--ink-soft); font-size: .72rem; line-height: 1.4; }
.portal-consent-row input { width: 16px !important; height: 16px !important; margin-top: .08rem; }
.portal-consent-row span { min-width: 0; overflow-wrap: break-word; }
.portal-consent-row a { color: var(--brand-strong); text-decoration: underline; text-underline-offset: .15em; }

.portal-verification-page { display: flex; min-height: 100vh; flex-direction: column; }
.portal-verification-shell { display: grid; flex: 1 1 auto; place-items: center; padding: clamp(1rem, 4vw, 3rem) 0; }
.auth-verification-card { display: grid; gap: .9rem; width: min(510px, 100%); padding: clamp(1rem, 3vw, 1.5rem); box-shadow: 0 20px 55px rgba(23, 53, 70, .13); }
.auth-registration-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; padding: .25rem; border-radius: 12px; background: #eef3f6; }
.auth-registration-progress span { display: flex; align-items: center; justify-content: center; gap: .38rem; min-height: 2rem; padding: .3rem .5rem; border-radius: 9px; color: var(--ink-soft); font-size: .68rem; font-weight: 700; text-align: center; }
.auth-registration-progress b { display: grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; color: var(--ink-soft); background: #fff; font-size: .64rem; }
.auth-registration-progress .is-complete { color: #176443; }
.auth-registration-progress .is-complete b { color: #fff; background: #2c8b61; }
.auth-registration-progress .is-current { color: #fff; background: var(--brand); }
.auth-registration-progress .is-current b { color: var(--brand-strong); background: #fff; }
.auth-verification-heading { display: flex; align-items: center; gap: .72rem; }
.auth-verification-heading h1 { margin-top: .08rem; font-size: clamp(1.28rem, 3vw, 1.65rem); line-height: 1.12; }
.auth-mail-icon { display: grid; flex: 0 0 auto; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 13px; color: var(--brand-strong); background: #e4f0f5; }
.auth-mail-icon svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.auth-verification-copy { margin: 0; color: #435462; font-size: .83rem; line-height: 1.55; }
.auth-verification-copy strong { color: var(--ink); overflow-wrap: anywhere; }
.auth-verification-copy.is-mail-error { padding: .58rem .68rem; border-left: 3px solid #c1473d; border-radius: 0 9px 9px 0; color: #763731; background: #fff5f4; }
.auth-inline-feedback { margin: 0; font-size: .76rem; line-height: 1.4; }
.auth-development-code { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .5rem .65rem; border: 1px dashed #b7a363; border-radius: 10px; color: #684f08; background: #fff9df; }
.auth-development-code span { font-size: .63rem; }
.auth-development-code strong { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 1rem; letter-spacing: .14em; }
.auth-verification-form { display: grid; gap: .48rem; }
.auth-verification-form label > span { font-size: .75rem; font-weight: 700; }
.auth-code-input { min-height: 3.35rem; padding: .6rem 1rem; border-width: 1.5px; border-radius: 13px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: clamp(1.45rem, 5vw, 2rem); font-variant-numeric: tabular-nums; font-weight: 750; letter-spacing: .38em; text-align: center; }
.auth-code-input:focus { border-color: var(--brand); outline: 3px solid rgba(32, 94, 122, .13); }
.auth-code-hint { margin: 0 0 .15rem; color: var(--ink-soft); font-size: .67rem; line-height: 1.4; }
.auth-verification-secondary { display: grid; justify-items: center; gap: .42rem; padding-top: .75rem; border-top: 1px solid var(--line); text-align: center; }
.auth-verification-secondary > p { color: var(--ink-soft); font-size: .7rem; line-height: 1.4; }
.auth-verification-secondary form { margin: 0; }
.auth-resend-button { min-width: 10.5rem; padding-block: .48rem; color: var(--brand-strong); font-size: .75rem; font-weight: 700; }
.auth-resend-button:disabled { color: var(--ink-soft); background: #f3f6f8; }
.auth-change-email { color: var(--brand-strong); font-size: .7rem; font-weight: 700; text-decoration: underline; text-underline-offset: .16em; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; border: 0 !important; white-space: nowrap !important; }

.portal-workspace { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: .7rem; min-height: calc(100vh - 154px); margin-top: .7rem; }
.portal-project-sidebar,
.portal-project-main { min-width: 0; padding: .75rem; }
.portal-project-sidebar { align-self: start; position: sticky; top: 5.25rem; max-height: calc(100vh - 6rem); overflow: hidden; }
.portal-section-title { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.portal-section-title h1 { margin: .05rem 0; font-size: 1.25rem; }
.portal-count-chip { display: grid; place-items: center; min-width: 30px; height: 25px; padding: 0 .4rem; border-radius: 999px; color: var(--brand-strong); background: #e4f0f5; font-size: .76rem; font-weight: 800; }
.portal-compact-copy { margin: .35rem 0 .65rem; color: var(--ink-soft); font-size: .74rem; line-height: 1.42; }
.dashboard-project-list { display: grid; gap: .38rem; max-height: calc(100vh - 13rem); overflow: auto; padding-right: .18rem; }
.portal-project-item { display: grid; gap: .32rem; width: 100%; padding: .65rem; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; text-align: left; cursor: pointer; }
.portal-project-item:hover { border-color: #83afc2; background: #f7fbfd; }
.portal-project-item.is-selected { border-color: var(--brand); background: #eaf4f8; box-shadow: inset 3px 0 0 var(--brand); }
.portal-project-item-title { overflow: hidden; font-size: .86rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.portal-project-item-meta,
.portal-project-item-counts { display: flex; align-items: center; justify-content: space-between; gap: .4rem; color: var(--ink-soft); font-size: .65rem; }
.portal-project-item-counts { justify-content: flex-start; }
.portal-project-item-counts span { padding: .14rem .32rem; border-radius: 999px; background: rgba(149,177,191,.15); }
.portal-empty-state { padding: 1rem; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-soft); font-size: .78rem; text-align: center; }

.portal-project-main { align-self: start; }
.portal-project-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.portal-editable-heading { display: block; max-width: 100%; margin: .08rem 0 .12rem; padding: 0; overflow: hidden; border: 0; color: var(--ink); background: none; font: inherit; font-size: 1.3rem; font-weight: 760; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.portal-editable-heading:not(:disabled):hover { color: var(--brand-strong); text-decoration: underline dotted; text-underline-offset: .2em; }
.portal-project-heading p:last-child { margin: 0; color: var(--ink-soft); font-size: .74rem; }
.portal-project-actions { justify-content: flex-end; }
.portal-info-toggle,
.portal-info-minimize { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.portal-chevron { display: block; flex: 0 0 1rem; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.portal-info-toggle[aria-expanded="true"] { border-color: #6c9eb4; color: var(--brand-strong); background: #eaf4f8; }
.portal-info-toggle[aria-expanded="true"] > .portal-chevron { transform: rotate(180deg); }
.portal-project-overview { display: grid; grid-template-columns: minmax(230px, .72fr) minmax(0, 1.28fr); align-items: start; gap: .7rem; margin-top: .7rem; }
.portal-project-context { display: grid; min-width: 0; gap: .55rem; align-content: start; }
.portal-preview-card,
.portal-info-block { border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.portal-preview-card { min-width: 0; padding: .65rem; }
.portal-mini-preview-head { display: grid; gap: .2rem; }
.portal-mini-preview-head h2,
.portal-info-block h2 { margin: 0; font-size: .79rem; }
.portal-mini-preview-head span { color: var(--ink-soft); font-size: .65rem; }
.portal-dashboard-mini-hx { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; min-width: 0; margin-top: .45rem; overflow: hidden; border: 1px solid #e3e9ec; border-radius: 9px; background: #fff; }
.portal-project-hx-raster { display: block; width: 100%; height: 100%; min-height: 0; max-height: 300px; object-fit: contain; image-rendering: auto; }
.portal-preview-loading,
.portal-preview-error { display: flex; align-items: center; justify-content: center; gap: .42rem; padding: .75rem; color: var(--ink-soft); font-size: .72rem; text-align: center; }
.portal-preview-loading > span { width: .82rem; height: .82rem; border: 2px solid #c9d6dc; border-top-color: var(--brand); border-radius: 50%; animation: portal-preview-spin .8s linear infinite; }
@keyframes portal-preview-spin { to { transform: rotate(360deg); } }
.portal-preview-placeholder { position: absolute; right: .55rem; bottom: .5rem; padding: .22rem .45rem; border-radius: 999px; color: var(--brand-strong); background: rgba(230,242,247,.94); font-size: .66rem; font-weight: 700; }
.portal-project-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; align-content: start; min-width: 0; }
.portal-info-block { min-width: 0; padding: .65rem; }
.portal-weather-summary,
.portal-chain-summary { grid-column: 1 / -1; }
.portal-meta-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .32rem .65rem; margin: .55rem 0 0; font-size: .71rem; }
.portal-meta-list dt { color: var(--ink-soft); }
.portal-meta-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.portal-save-meta { padding-top: .5rem; border-top: 1px solid var(--line); }
.portal-meta-list button { max-width: 100%; padding: 0; overflow: hidden; border: 0; color: var(--ink); background: none; font: inherit; text-align: left; text-decoration: underline dotted rgba(32,94,122,.45); text-overflow: ellipsis; cursor: text; }
.portal-weather-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .32rem; margin-top: .5rem; }
.portal-weather-item { display: grid; grid-template-columns: 5px minmax(0,1fr); gap: .42rem; min-width: 0; padding: .4rem; border-radius: 8px; background: #f5f8fa; }
.portal-weather-color { border-radius: 99px; background: var(--dataset-color); }
.portal-weather-item > span:last-child { display: grid; min-width: 0; }
.portal-weather-item strong,
.portal-weather-item small { overflow-wrap: anywhere; }
.portal-weather-item strong { font-size: .7rem; }
.portal-weather-item small { color: var(--ink-soft); font-size: .61rem; }

.portal-chain-list { display: grid; gap: .35rem; margin-top: .5rem; }
.portal-chain-item { min-width: 0; padding: .42rem; border-radius: 9px; background: #f5f8fa; }
.portal-chain-item header { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; align-items: center; gap: .42rem; min-width: 0; }
.portal-chain-item header strong { overflow: hidden; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-chain-item header small { color: var(--ink-soft); font-size: .6rem; white-space: nowrap; }
.portal-chain-color { align-self: stretch; min-height: 18px; border-radius: 99px; background: var(--chain-color); }
.portal-chain-states { display: flex; flex-wrap: wrap; gap: .25rem; margin: .35rem 0 0 .48rem; }
.portal-state-chip,
.portal-state-more { padding: .14rem .36rem; border: 1px solid color-mix(in srgb, var(--state-color, #7593a1) 35%, #fff); border-radius: 999px; color: #3d515d; background: color-mix(in srgb, var(--state-color, #7593a1) 9%, #fff); font-size: .59rem; }
.portal-state-more { --state-color: #7593a1; }

/* Project overview: compact context, then devices and their design cases. */
.dashboard-page .portal-project-heading > div:first-child { flex: 1 1 15rem; min-width: 0; }
.dashboard-page .portal-project-heading { flex-wrap: wrap; gap: .6rem; }
.dashboard-page .portal-project-actions { gap: .35rem; }
.dashboard-page .portal-project-actions .button { min-height: 34px; }
.portal-block-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.portal-block-heading .portal-count-chip { font-size: .63rem; white-space: nowrap; }
.portal-section-hint { margin: .2rem 0 0; color: var(--ink-soft); font-size: .65rem; }
.portal-device-item { min-width: 0; padding: .6rem; border: 1px solid #e1e9ed; border-radius: 9px; background: #f8fafb; }
.portal-device-item > header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .35rem; }
.portal-device-item > header > div { display: grid; min-width: 0; gap: .18rem; flex: 1 1 10rem; }
.portal-device-item > header strong { font-size: .77rem; overflow-wrap: anywhere; }
.portal-device-item > header small { color: var(--ink-soft); font-size: .65rem; }
.portal-component-list { display: flex; flex-wrap: wrap; gap: .22rem; margin: .45rem 0; }
.portal-component-list > span { max-width: 100%; padding: .15rem .35rem; border: 1px solid #dce5e9; border-radius: 5px; color: #466070; background: #fff; font-size: .62rem; overflow-wrap: anywhere; }
.portal-component-list > .muted { padding: 0; border: 0; background: none; }
.portal-device-cases { display: grid; min-width: 0; gap: .15rem; }
.portal-case-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .15rem .35rem; padding: .35rem 0; border-top: 1px solid #e1e9ed; }
.portal-case-name { font-size: .71rem; font-weight: 650; overflow-wrap: anywhere; }
.portal-case-count { grid-column: 1; grid-row: 2; color: var(--ink-soft); font-size: .61rem; }
.portal-case-row > .portal-calculation-status { grid-column: 2; grid-row: 1 / 3; }
.portal-calculation-status { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; width: max-content; max-width: 100%; padding: .2rem .42rem; border-radius: 99px; color: #5c6b75; background: #e9eef1; font-size: .61rem; line-height: 1.25; white-space: nowrap; }
.portal-calculation-status::before { content: ""; flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.portal-calculation-status.is-ready { color: #27623e; background: #e2f1e8; }
.portal-calculation-status.is-partial { color: #805b16; background: #fff1cf; }
.portal-calculation-status.is-error { color: #9c3838; background: #fae5e5; }
.portal-create-panel { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem 1.2rem; padding: .85rem; margin-top: .7rem; border-color: #94b7c7; }
.portal-create-panel[hidden] { display: none; }
.portal-create-panel h2 { margin: 0; font-size: .95rem; }
.portal-create-panel p { margin: .25rem 0 0; color: var(--ink-soft); font-size: .72rem; }
.portal-create-form { flex: 1 1 28rem; display: grid; grid-template-columns: minmax(140px, 1fr) auto auto; align-items: end; gap: .45rem; }
.portal-create-form label { display: grid; gap: .2rem; min-width: 0; font-size: .7rem; }
.portal-create-form input, .portal-create-form .button { width: 100%; min-height: 36px; margin: 0; }
.portal-create-form .portal-create-error { grid-column: 1 / -1; color: #a23c3c; }
.portal-create-error[hidden] { display: none; }

.portal-inline-editor { margin: 0 -.15rem .7rem; padding: .75rem .9rem .9rem; border: 1px solid #94b7c7; border-top: 0; border-radius: 0 0 14px 14px; background: linear-gradient(#edf7fa, #f8fbfc); box-shadow: 0 10px 22px rgba(25,67,86,.09); transform-origin: top; animation: portal-editor-drop .2s ease-out; }
.portal-inline-editor[hidden] { display: none; }
.portal-inline-editor-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .65rem; }
.portal-inline-editor h2 { margin: .05rem 0 0; font-size: 1rem; }
.portal-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; }
.portal-form-grid label { min-width: 0; }
.portal-grid-span { grid-column: 1 / -1; }
.portal-form-actions { display: flex; justify-content: flex-end; }

@keyframes portal-editor-drop {
    from { opacity: 0; transform: translateY(-8px) scaleY(.96); }
    to { opacity: 1; transform: translateY(0) scaleY(1); }
}

.legal-accept-page { display: grid; grid-template-rows: auto 1fr auto; }
.legal-accept-card { align-self: center; width: min(680px, 100%); margin: 1rem auto; padding: clamp(1.2rem, 3vw, 2rem); }
.legal-accept-card h1 { margin: .15rem 0 .7rem; font-size: clamp(1.65rem, 3vw, 2.4rem); }
.legal-accept-card > p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.55; }
.legal-accept-form { display: grid; gap: .8rem; margin-top: 1rem; }
.legal-logout-form { margin-top: .45rem; }

.admin-page main { margin-top: .7rem; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.admin-heading h1 { margin: .1rem 0 0; font-size: 1.55rem; }
.admin-heading p:last-child { max-width: 48rem; margin: 0; color: var(--ink-soft); font-size: .72rem; text-align: right; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.admin-stat-card { display: grid; align-content: start; gap: .08rem; min-height: 100px; padding: .7rem; }
.admin-stat-card.is-accent { border-color: rgba(45, 150, 88, .45); background: linear-gradient(145deg, #f2fbf6, #fff); }
.admin-stat-card strong { display: block; color: var(--brand-strong); font-size: 1.55rem; }
.admin-stat-card span { color: var(--ink); font-size: .7rem; font-weight: 700; }
.admin-stat-card small { margin-top: .18rem; color: var(--ink-soft); font-size: .61rem; line-height: 1.35; }
.admin-table-card { margin-top: .65rem; padding: .75rem; overflow: hidden; }
.admin-table-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.admin-table-card h2 { margin: 0; font-size: .95rem; }
.admin-table-heading p { margin: .12rem 0 0; color: var(--ink-soft); font-size: .66rem; }
.admin-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 160px 160px auto; align-items: end; gap: .45rem; margin: .65rem 0; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; background: #f7fafb; }
.admin-toolbar label { display: grid; gap: .18rem; color: var(--ink-soft); font-size: .62rem; }
.admin-toolbar input,
.admin-toolbar select { width: 100%; min-height: 34px; padding: .35rem .5rem; }
.admin-toolbar output { align-self: center; min-width: 110px; color: var(--ink-soft); font-size: .67rem; text-align: right; }
.admin-table-scroll { max-width: 100%; overflow: auto; }
.admin-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: .68rem; }
.admin-table th,
.admin-table td { padding: .48rem .5rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table td > span,
.admin-table td > strong,
.admin-table td > small { display: block; white-space: nowrap; }
.admin-table td > small { margin-top: .16rem; color: var(--ink-soft); font-size: .6rem; line-height: 1.35; }
.admin-table th { color: var(--ink-soft); font-size: .64rem; letter-spacing: .04em; text-transform: uppercase; }
.admin-status { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .4rem; border-radius: 999px; background: #edf1f3; }
.admin-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8496a0; }
.admin-status.is-active { color: #21623d; background: #e3f4e9; }
.admin-status.is-active::before { background: #2d9658; box-shadow: 0 0 0 3px rgba(45,150,88,.14); }
.admin-status.is-disabled { color: #8b2f2f; background: #f8e5e5; }
.admin-status.is-disabled::before { background: #c04c4c; }
.admin-role-chip { display: inline-flex; width: max-content; padding: .2rem .4rem; border-radius: 999px; color: var(--ink-soft); background: #edf1f3; font-size: .61rem; font-weight: 750; }
.admin-role-chip.is-admin { color: #75530e; background: #f8eac2; }
.admin-user-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; max-width: 360px; }
.admin-user-actions .button { min-height: 29px; padding: .25rem .45rem; font-size: .61rem; }
.admin-account-email { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.admin-table tr[hidden] { display: none; }
.admin-privacy-note { margin: .6rem 0 0; color: var(--ink-soft); font-size: .68rem; }

@media (max-width: 1080px) {
    .portal-hero { grid-template-columns: 1fr; min-height: auto; }
    .portal-welcome-hero .portal-hero-copy h1 { max-width: 15ch; }
    .portal-mini-hx { width: min(700px, 100%); margin: 0 auto; transform: none; }
    .portal-public-hx { width: min(760px, 100%); margin: 0 auto; }
    .portal-welcome-hero .portal-public-hx { width: 100%; transform: none; margin-right: 0; }
    .auth-portal-layout { grid-template-columns: 1fr; }
    .auth-portal-intro { padding: 1.5rem; }
    .auth-portal-intro h1 { max-width: none; }
    .portal-project-overview { grid-template-columns: 1fr; }
    .portal-project-context { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .admin-stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
    .portal-welcome-hero .portal-hero-actions { justify-content: flex-start; }
    .portal-welcome-brand h1 { font-size: clamp(2.61rem, 12.6vw, 4.41rem); }
    .portal-hx-reference-image { width: min(100%, 620px); max-height: 66vh; }
    .portal-welcome-hero .portal-public-hx figcaption { margin-top: .3rem; }
}

@media (max-width: 760px) {
    .portal-shell { width: min(1460px, calc(100% - .7rem)); padding-top: .35rem; }
    .portal-header { position: static; align-items: center; flex-wrap: wrap; }
    .portal-header > .portal-brand { flex: 1 1 15rem; }
    .portal-header > .portal-actions { flex: 1 1 100%; width: 100%; }
    .portal-header-compact { flex-wrap: nowrap; }
    .portal-header-compact > .portal-brand { flex: 1 1 auto; }
    .auth-portal-layout { min-height: auto; gap: .65rem; }
    .auth-portal-panel { padding: .35rem; }
    .portal-public-stats,
    .portal-feature-grid,
    .auth-grid-portal { grid-template-columns: 1fr; }
    .portal-access-section .auth-grid-portal { grid-template-columns: 1fr; }
    .auth-grid-portal { gap: .65rem; }
    .auth-grid-portal .auth-card,
    .auth-grid-portal .auth-card > .button { width: 100%; }
    .portal-consent-row { width: 100%; font-size: .76rem; line-height: 1.45; }
    .portal-public-stats > div { justify-content: space-between; }
    .portal-workspace { grid-template-columns: 1fr; }
    .portal-project-sidebar { position: static; max-height: none; }
    .dashboard-project-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
    .portal-project-heading { flex-direction: column; }
    .portal-project-actions { justify-content: flex-start; }
    .portal-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-heading { align-items: flex-start; flex-direction: column; }
    .admin-heading p:last-child { text-align: left; }
    .admin-toolbar { grid-template-columns: 1fr 1fr; }
    .admin-search { grid-column: 1 / -1; }
    .admin-toolbar output { text-align: left; }
    .portal-footer { align-items: center; flex-direction: row; flex-wrap: wrap; }
    .portal-footer nav { margin-left: auto; }
}

@media (max-width: 560px) {
    .portal-header,
    .portal-header-compact { align-items: stretch; flex-direction: column; }
    .portal-header > .portal-brand,
    .portal-header-compact > .portal-brand { width: 100%; flex: 0 1 auto; }
    .portal-header > .button { width: 100%; }
    .portal-actions { width: 100%; }
    .portal-actions .button { flex: 1 1 auto; text-align: center; }
    .auth-portal-intro { padding: 1rem; }
    .auth-portal-intro h1 { font-size: clamp(2rem, 11vw, 3rem); }
    .auth-portal-panel { padding: 0; }
    .auth-grid-portal .auth-card { padding: .85rem; }
    .auth-password-fields,
    .auth-password-rules { grid-template-columns: 1fr; }
    .auth-password-rules li:last-child { grid-column: 1; }
    .auth-password-guidance-heading { align-items: flex-start; flex-direction: column; gap: .12rem; }
    .auth-password-guidance-heading span { text-align: left; }
    .portal-verification-page .portal-header .button { width: 100%; text-align: center; }
    .portal-verification-shell { padding: .65rem 0; }
    .auth-verification-card { gap: .75rem; padding: .9rem; }
    .portal-footer { align-items: flex-start; flex-direction: column; }
    .portal-footer nav { width: 100%; margin-left: 0; justify-content: flex-start; }
}

@media (max-width: 480px) {
    .portal-hero { padding: 1rem; border-radius: 16px; }
    .portal-hero-copy h1 { font-size: 2.35rem; }
    .dashboard-project-list,
    .portal-project-facts,
    .portal-weather-list,
    .portal-form-grid,
    .admin-stat-grid { grid-template-columns: 1fr; }
    .portal-weather-summary,
    .portal-chain-summary,
    .portal-grid-span { grid-column: 1; }
    .portal-actions .button { flex: 1 1 auto; }
    .portal-project-context { grid-template-columns: 1fr; }
    .portal-create-form { grid-template-columns: 1fr 1fr; }
    .portal-create-form label { grid-column: 1 / -1; }
    .admin-toolbar { grid-template-columns: 1fr; }
    .admin-search { grid-column: 1; }
}
