:root {
    color-scheme: light;
    --bg: #f7f9f8;
    --surface: #ffffff;
    --surface-2: #eef5f3;
    --text: #12201d;
    --muted: #5c6d68;
    --line: #d7e2de;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #2563eb;
    --brand-blue: #5b9bd5;
    --warning: #b45309;
    --shadow: 0 14px 36px rgba(18, 32, 29, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body.portal-body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    letter-spacing: 0;
}

a {
    color: var(--primary-dark);
}

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 60px;
    gap: 10px;
    padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.portal-brand,
.portal-header-link,
.portal-card-link,
.portal-nav-item,
.portal-button,
.portal-menu a,
.portal-notification-link,
.portal-login-button,
.portal-desktop-nav a {
    text-decoration: none;
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    overflow: hidden;
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0;
    text-align: center;
}

.portal-brand span {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-brand-mark {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: contain;
}

.portal-topbar .portal-brand-mark {
    display: none;
}

.portal-desktop-nav {
    display: none;
}

.portal-topbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.portal-login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #6ba9d8;
    border-radius: 4px;
    background: #6ba9d8;
    color: #fff;
    font-weight: 800;
    white-space: nowrap;
}

.portal-login-button:hover,
.portal-login-button:focus-visible {
    background: #4f93c7;
    color: #fff;
}

.portal-menu-button,
.portal-notification-link,
.portal-topbar-spacer {
    width: 44px;
    height: 44px;
}

.portal-menu-button,
.portal-notification-link {
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.portal-menu-button span {
    display: block;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
}

.portal-menu-button {
    gap: 5px;
}

.portal-notification-link {
    position: relative;
}

.portal-notification-link svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.portal-notification-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--primary);
}

.portal-notification-dot[hidden] {
    display: none;
}

.portal-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 38;
    background: rgba(18, 32, 29, 0.28);
}

.portal-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 39;
    display: grid;
    align-content: start;
    gap: 6px;
    width: min(86vw, 320px);
    padding: max(18px, env(safe-area-inset-top)) 16px 20px max(16px, env(safe-area-inset-left));
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.portal-menu[hidden],
.portal-menu-backdrop[hidden] {
    display: none;
}

.portal-menu-is-open {
    overflow: hidden;
}

.portal-login-is-open {
    overflow: hidden;
}

.portal-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    margin-bottom: 8px;
}

.portal-menu-header strong {
    overflow-wrap: anywhere;
}

.portal-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 800;
}

.portal-menu a:hover,
.portal-menu a:focus-visible {
    background: var(--surface-2);
}

.portal-login-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 36;
    background: rgba(18, 32, 29, 0.22);
}

.portal-login-modal {
    position: fixed;
    top: 76px;
    right: 14px;
    z-index: 37;
    display: grid;
    gap: 14px;
    width: min(312px, calc(100vw - 28px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(18, 32, 29, 0.18);
}

.portal-login-modal[hidden],
.portal-login-modal-backdrop[hidden] {
    display: none;
}

.portal-translation-backdrop {
    position: fixed;
    inset: 0;
    z-index: 36;
    background: rgba(18, 32, 29, 0.28);
}

.portal-translation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 37;
    display: grid;
    gap: 14px;
    width: min(720px, calc(100vw - 28px));
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(18, 32, 29, 0.18);
    transform: translate(-50%, -50%);
}

.portal-translation-modal[hidden],
.portal-translation-backdrop[hidden] {
    display: none;
}

.portal-translation-is-open {
    overflow: hidden;
}

.portal-translation-content {
    display: grid;
    gap: 14px;
}

.portal-translation-content h3,
.portal-translation-content h4 {
    margin: 0;
}

.portal-translation-content p {
    margin: 0;
    white-space: pre-wrap;
}

.portal-translation-schedule {
    color: var(--text);
    font-weight: 800;
}

.portal-translation-message {
    display: grid;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.portal-translation-status:empty {
    display: none;
}

.portal-login-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.portal-login-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.portal-login-modal-close {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.portal-header-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: var(--primary-dark);
    font-weight: 700;
}

.portal-shell {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 18px 16px 104px;
}

.portal-body.no-bottom-nav .portal-shell {
    padding-bottom: 28px;
}

.portal-main {
    width: min(100%, 760px);
    margin: 0 auto;
}

.portal-body.is-public .portal-shell {
    padding: 0 0 42px;
}

.portal-body.is-public .portal-main {
    width: 100%;
}

.portal-stack,
.portal-form,
.portal-detail {
    display: grid;
    gap: 18px;
}

.portal-hero {
    display: grid;
    gap: 14px;
    padding: 28px 0 22px;
}

.portal-public-hero {
    position: relative;
    min-height: clamp(360px, 48vw, 540px);
    align-content: center;
    padding: clamp(34px, 6vw, 72px) clamp(20px, 7vw, 82px);
    overflow: hidden;
    background-image:
        linear-gradient(90deg, rgba(13, 24, 31, 0.82) 0%, rgba(13, 24, 31, 0.68) 34%, rgba(13, 24, 31, 0.10) 78%),
        var(--portal-hero-image);
    background-position: center;
    background-size: cover;
    color: #fff;
}

.portal-public-hero > * {
    position: relative;
    max-width: 520px;
}

.portal-public-hero h1 {
    color: #fff;
}

.portal-public-hero.portal-hero p,
.portal-public-hero .portal-kicker {
    color: #fff;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
}

.portal-public-intro {
    white-space: pre-line;
    font-weight: 800;
}

.portal-public-hero .portal-action-grid {
    max-width: 560px;
}

.portal-public-hero .portal-action-card {
    background: rgba(255, 255, 255, 0.96);
}

.portal-body.is-public .portal-panel,
.portal-body.is-public .portal-section-heading,
.portal-body.is-public .portal-card-list {
    width: min(calc(100% - 32px), 1120px);
    margin-right: auto;
    margin-left: auto;
}

.portal-body.is-public .portal-panel {
    margin-top: 32px;
}

.portal-site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    padding: 22px 16px;
    background: #f7f7f7;
    color: #111827;
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: center;
}

.portal-site-footer a {
    color: inherit;
    text-decoration: none;
}

.portal-site-footer > *:not(:last-child)::after {
    content: "·";
    margin-left: 14px;
    color: #64748b;
}

.portal-content-page {
    display: grid;
    gap: 24px;
    width: min(calc(100% - 32px), 1360px);
    margin: 0 auto;
    padding-top: clamp(18px, 3vw, 34px);
}

.portal-content-sidebar {
    display: grid;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.portal-content-sidebar h2 {
    margin: 0;
    font-size: 1.1rem;
}

.portal-content-sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portal-content-sidebar a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
}

.portal-content-sidebar a.is-active,
.portal-content-sidebar a:hover,
.portal-content-sidebar a:focus-visible {
    color: var(--brand-blue);
    text-decoration: underline;
    text-underline-offset: 6px;
}

.portal-content-article {
    min-width: 0;
}

.portal-content-page.has-no-sidebar .portal-content-article {
    max-width: 960px;
}

.portal-content-article header {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.portal-content-article h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
}

.portal-content-image {
    display: block;
    width: min(100%, 400px);
    margin: 0 0 18px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(18, 32, 29, 0.16);
}

.portal-content-body {
    color: var(--text);
    line-height: 1.5;
}

.portal-content-body h2,
.portal-content-body h3 {
    margin: 24px 0 8px;
    font-size: 1.1rem;
}

.portal-content-body p,
.portal-content-body ul,
.portal-content-body ol {
    margin: 0 0 14px;
}

.portal-content-body li {
    margin-bottom: 4px;
}

.portal-hero h1,
.portal-stack h1,
.portal-section-heading h1,
.portal-detail-header h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.08;
}

.portal-hero p,
.portal-stack p,
.portal-panel p,
.portal-empty-card p,
.portal-request-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.portal-kicker {
    margin: 0 0 4px;
    color: var(--warning);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
}

.portal-muted {
    color: var(--muted);
}

.portal-panel .portal-planned-work {
    color: var(--text);
    font-weight: 800;
}

.portal-customer-heading {
    color: var(--primary-dark);
    font-weight: 800;
}

.portal-actions,
.portal-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.portal-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.portal-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 74px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(18, 32, 29, 0.05);
}

.portal-action-card span {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 8px;
    color: var(--primary);
    font-size: 1.35rem;
}

.portal-link-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
}

.portal-link-row a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 800;
}

.portal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.portal-button.primary {
    background: var(--primary);
    color: #fff;
}

.portal-button.secondary {
    background: var(--surface-2);
    color: var(--primary-dark);
    border: 1px solid var(--line);
}

.portal-button.bankid-button {
    gap: 12px;
    min-height: 56px;
    padding: 0 20px;
    background: #183e4f;
    color: #fff;
    border: 1px solid #183e4f;
    box-shadow: 0 8px 18px rgba(24, 62, 79, 0.18);
}

.bankid-button-logo {
    width: 74px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 auto;
}

.portal-button.compact {
    min-width: 56px;
    min-height: 44px;
    background: var(--primary);
    color: #fff;
}

.portal-button.full {
    width: 100%;
}

.portal-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.portal-panel,
.portal-empty-card,
.portal-request-card,
.portal-object-card,
.portal-upload-stub,
.portal-alert {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.portal-panel,
.portal-empty-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 18px;
}

.portal-panel h2,
.portal-empty-card h2,
.portal-empty-card h3,
.portal-request-card h2,
.portal-request-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

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

.portal-section-heading h2 {
    margin: 0;
    font-size: 1.25rem;
}

.portal-section-heading a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--primary-dark);
    font-weight: 900;
}

.portal-section-divider {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.portal-card-list {
    display: grid;
    gap: 12px;
}

.portal-assignee-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.portal-assignee-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
    font-weight: 900;
    white-space: nowrap;
}

.portal-assignee-tab strong {
    display: inline-grid;
    min-width: 24px;
    height: 24px;
    place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.85rem;
}

.portal-assignee-tab.is-active {
    border-color: var(--primary);
    background: #e8f5f2;
    color: var(--primary);
}

.portal-card-link {
    color: inherit;
}

.portal-request-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    min-height: 104px;
    padding: 16px;
    box-shadow: 0 2px 0 rgba(18, 32, 29, 0.03);
}

.portal-notification-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    min-height: 88px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 2px 0 rgba(18, 32, 29, 0.03);
}

.portal-notification-card h2,
.portal-notification-card p {
    margin: 0;
}

.portal-notification-card p {
    color: var(--muted);
    line-height: 1.4;
}

.portal-notification-card time {
    display: inline-flex;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.portal-notification-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--primary);
    font-weight: 900;
}

.portal-object-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    min-height: 132px;
    padding: 16px;
    box-shadow: 0 2px 0 rgba(18, 32, 29, 0.03);
}

.portal-object-card h2,
.portal-object-card h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.portal-object-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.portal-object-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    align-items: center;
    gap: 12px;
}

.portal-object-visual {
    position: relative;
    width: 78px;
    height: 74px;
    justify-self: end;
    border-radius: 8px;
    background:
        linear-gradient(90deg, transparent 0 18px, rgba(15, 118, 110, 0.18) 18px 22px, transparent 22px 40px, rgba(15, 118, 110, 0.18) 40px 44px, transparent 44px),
        linear-gradient(0deg, transparent 0 14px, rgba(15, 118, 110, 0.18) 14px 18px, transparent 18px 34px, rgba(15, 118, 110, 0.18) 34px 38px, transparent 38px),
        #e8f5f2;
    border: 1px solid rgba(15, 118, 110, 0.18);
}

.portal-object-visual::before {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 0;
    width: 34px;
    height: 60px;
    border-radius: 5px 5px 0 0;
    background: var(--primary);
    opacity: 0.88;
}

.portal-object-visual::after {
    content: "";
    position: absolute;
    right: 22px;
    bottom: 0;
    width: 12px;
    height: 18px;
    border-radius: 6px 6px 0 0;
    background: var(--surface);
}

.portal-card-actions {
    display: grid;
    gap: 10px;
}

.portal-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.portal-toggle-row div {
    display: grid;
    gap: 2px;
}

.portal-toggle-row strong {
    font-size: 1rem;
}

.portal-toggle-row span {
    color: var(--muted);
    font-weight: 800;
}

.portal-switch {
    position: relative;
    flex: 0 0 auto;
    width: 76px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease;
}

.portal-switch span {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(18, 32, 29, 0.20);
    transition: transform 0.18s ease;
}

.portal-switch[aria-checked="true"] {
    background: var(--accent);
}

.portal-switch[aria-checked="true"] span {
    transform: translateX(32px);
}

.portal-switch:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
}

.portal-switch:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.portal-filter-form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.portal-filter-form label {
    font-weight: 800;
}

.portal-filter-form select {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.portal-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.portal-meta-grid span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
}

.portal-request-card time,
.portal-detail-header time,
.portal-message time {
    color: var(--muted);
    font-size: 0.9rem;
}

.portal-request-card time strong {
    color: var(--text);
    font-weight: 900;
}

.portal-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 8px;
    padding: 0 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 800;
}

.portal-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portal-status-neutral {
    background: var(--surface-2);
    color: var(--primary-dark);
}

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

.portal-compact-list {
    display: grid;
    gap: 6px;
    margin: 12px 0 0;
}

.portal-compact-list div {
    display: grid;
    grid-template-columns: minmax(96px, 0.72fr) minmax(0, 1fr);
    gap: 10px;
}

.portal-compact-list dt {
    color: var(--muted);
    font-weight: 700;
}

.portal-compact-list dd {
    min-width: 0;
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.portal-line-card {
    display: grid;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.portal-line-card:first-child {
    border-top: 0;
    padding-top: 0;
}

.portal-line-card h3,
.portal-line-card p {
    margin: 0;
}

.portal-line-card p {
    color: var(--muted);
    line-height: 1.4;
}

.portal-line-card strong {
    font-size: 1.05rem;
}

.portal-form {
    padding-bottom: 18px;
}

.portal-field {
    display: grid;
    gap: 8px;
}

.portal-field span,
.portal-choice-group legend {
    color: var(--text);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.portal-field input,
.portal-field textarea,
.portal-field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.portal-field textarea {
    resize: vertical;
}

.portal-checkbox {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: center;
    color: var(--text);
    font-weight: 800;
}

.portal-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.portal-choice-group {
    display: grid;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.portal-choice-card {
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: start;
    gap: 12px;
    min-height: 72px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.portal-choice-card:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.portal-choice-card input {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.portal-choice-card span {
    display: grid;
    gap: 4px;
}

.portal-choice-card small {
    color: var(--muted);
    line-height: 1.35;
}

.portal-consent-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    color: var(--text);
    font-weight: 700;
    line-height: 1.45;
}

.portal-consent-row input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.portal-form-step {
    display: grid;
    gap: 14px;
}

.portal-hidden {
    display: none !important;
}

.portal-profile-edit-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.portal-profile-edit-row > div {
    display: grid;
    gap: 4px;
}

.portal-upload-stub {
    display: grid;
    gap: 4px;
    padding: 16px;
    color: var(--muted);
}

.portal-upload-stub strong {
    color: var(--text);
}

.portal-alert,
.portal-validation {
    padding: 14px 16px;
    color: #7c2d12;
    background: #ffedd5;
    border-color: #fed7aa;
    border-radius: 8px;
}

.portal-detail-header {
    display: grid;
    gap: 8px;
}

.portal-detail-nav {
    display: flex;
    justify-content: flex-start;
}

.portal-message {
    display: grid;
    gap: 6px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.portal-message.is-internal-note {
    padding: 12px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
}

.portal-message:first-of-type {
    border-top: 0;
}

.portal-message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.portal-message-meta strong {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #ffedd5;
    color: #9a3412;
    font-size: 0.78rem;
}

.portal-definition-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.portal-definition-list div,
.portal-diagnostic-row {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.portal-definition-list div:first-child,
.portal-diagnostic-row:first-child {
    border-top: 0;
}

.portal-definition-list dt {
    color: var(--muted);
    font-weight: 700;
}

.portal-definition-list dd {
    margin: 0;
    font-weight: 800;
}

.portal-diagnostic-list {
    display: grid;
}

.portal-diagnostic-row span {
    color: var(--muted);
}

.portal-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 72px;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 30px rgba(18, 32, 29, 0.08);
}

.portal-nav-item {
    display: grid;
    place-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 58px;
    padding: 4px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
    overflow-wrap: anywhere;
}

.portal-nav-item.is-active {
    background: var(--surface-2);
    color: var(--primary-dark);
}

.portal-nav-icon {
    font-size: 1.2rem;
    line-height: 1;
}

[data-access-section][hidden] {
    display: none;
}

@media (min-width: 680px) {
    .portal-shell {
        padding-top: 28px;
    }

    .portal-hero h1,
    .portal-stack h1,
    .portal-section-heading h1,
    .portal-detail-header h1 {
        font-size: 2.4rem;
    }

    .portal-bottom-nav {
        right: 50%;
        left: 50%;
        width: min(760px, calc(100% - 32px));
        transform: translateX(-50%);
        bottom: 16px;
        border: 1px solid var(--line);
        border-radius: 12px;
        box-shadow: var(--shadow);
    }

    .portal-line-card {
        grid-template-columns: 1fr auto;
        align-items: start;
    }
}

@media (min-width: 900px) {
    body.portal-body {
        background: #fff;
    }

    .portal-topbar {
        grid-template-columns: auto minmax(320px, 1fr) auto;
        min-height: 92px;
        padding: 18px clamp(28px, 5vw, 72px);
        gap: clamp(24px, 4vw, 46px);
        background: #fff;
        border-bottom: 1px solid #edf1ef;
        backdrop-filter: none;
    }

    .portal-menu-button {
        display: none;
    }

    .portal-brand {
        gap: 18px;
        width: auto;
        min-width: max-content;
        color: var(--brand-blue);
        font-size: 1.15rem;
        font-weight: 800;
    }

    .portal-brand span {
        flex: 0 1 auto;
    }

    .portal-topbar .portal-brand-mark {
        display: block;
        width: 128px;
        height: 42px;
        border-radius: 0;
    }

    .portal-desktop-nav {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: clamp(18px, 2.4vw, 34px);
        min-width: 0;
    }

    .portal-desktop-nav a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        color: #111827;
        font-size: 0.95rem;
        font-weight: 500;
        white-space: nowrap;
    }

    .portal-desktop-nav a:hover,
    .portal-desktop-nav a:focus-visible,
    .portal-desktop-nav a.is-active {
        color: var(--brand-blue);
    }

    .portal-login-button {
        min-height: 40px;
        padding: 0 22px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .portal-login-modal {
        top: 104px;
        right: clamp(28px, 5vw, 72px);
        width: 340px;
    }

    .portal-body.has-bottom-nav .portal-shell {
        padding-bottom: 120px;
    }

    .portal-shell {
        padding: 32px clamp(28px, 5vw, 72px) 56px;
    }

    .portal-body.is-public .portal-shell {
        padding: 0 0 56px;
    }

    .portal-main {
        width: min(100%, 1120px);
    }

    .portal-body.is-public .portal-main {
        width: 100%;
    }

    .portal-public-hero {
        min-height: clamp(420px, 42vw, 560px);
    }

    .portal-hero h1,
    .portal-stack h1,
    .portal-section-heading h1,
    .portal-detail-header h1 {
        font-size: clamp(2.35rem, 4vw, 3.8rem);
    }

    .portal-card-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-content-page {
        width: min(calc(100% - 64px), 1360px);
    }

    .portal-content-page.has-sidebar {
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 40px;
    }

    .portal-content-sidebar {
        align-content: start;
        padding: 10px 24px 10px 0;
        border-right: 2px solid #72a9df;
        border-bottom: 0;
    }

    .portal-content-sidebar nav {
        display: grid;
        gap: 8px;
    }

    .portal-content-sidebar a {
        justify-content: flex-start;
        padding: 0 14px;
    }

    .portal-content-image {
        float: right;
        width: min(38vw, 400px);
        margin: 0 0 22px 32px;
    }
}

@media (max-width: 420px) {
    .portal-brand {
        font-size: 0.95rem;
    }

    .portal-login-button {
        min-height: 38px;
        padding: 0 12px;
        font-size: 0.86rem;
    }

    .portal-public-hero .portal-action-grid {
        grid-template-columns: 1fr;
    }
}
