:root { color-scheme: light; }
.portal-auth-page { min-height: 100vh; display: grid; place-items: center; background: #f4f5f6; color: #17191c; }
.portal-auth { width: min(100% - 2rem, 28rem); padding: 2rem; border: 1px solid #d9dde2; background: #fff; }
.portal-brand { display: inline-flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; font-weight: 700; }
.portal-brand img { width: 2rem; height: 2rem; }
.portal-auth form { display: grid; gap: .75rem; }
.portal-auth input { min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid #aeb5bd; font: inherit; }
.portal-auth button, .portal-page button { min-height: 2.75rem; border: 0; padding: 0 1rem; background: #1e5a46; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.portal-auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .75rem; }
.portal-auth .portal-auth-action { min-height: 3rem; border: 1px solid transparent; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; padding: .75rem 1rem; font: inherit; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.portal-auth .portal-auth-action.primary { background: #1e5a46; color: #fff; box-shadow: 0 4px 12px rgba(30, 90, 70, .22); }
.portal-auth .portal-auth-action.primary:hover { background: #174936; color: #fff; box-shadow: 0 6px 16px rgba(30, 90, 70, .28); transform: translateY(-1px); }
.portal-auth .portal-auth-action.secondary { border-color: #aeb5bd; background: #fff; color: #252a30; }
.portal-auth .portal-auth-action.secondary:hover { border-color: #59616b; background: #f4f5f6; color: #17191c; transform: translateY(-1px); }
.portal-auth .portal-auth-action.standalone { width: 100%; margin-top: 1rem; }
.portal-auth .portal-auth-action:focus-visible { outline: 3px solid rgba(46, 143, 166, .3); outline-offset: 2px; }
.portal-auth .portal-auth-action:active { box-shadow: none; transform: translateY(0); }
.form-error { border-left: .25rem solid #a52b2b; padding: .75rem; background: #fff1f1; }
.form-success { border-left: .25rem solid #1e5a46; padding: .75rem; background: #eef8f3; }
.portal-page { width: min(100% - 2rem, 72rem); margin: 3rem auto; }
.client-list { display: grid; border-top: 1px solid #d9dde2; }
.client-list form { margin: 0; border-bottom: 1px solid #d9dde2; }
.client-list button { width: 100%; min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; border: 0; padding: 1rem; background: #fff; color: #17191c; text-align: left; }
.client-list button:hover { background: #eef8f3; }
.client-list button span { color: #59616b; font-weight: 400; }
.oauth-actions { display: grid; gap: .5rem; margin: 1rem 0; }
.oauth-actions a { padding: .75rem; border: 1px solid #aeb5bd; color: #17191c; text-align: center; text-decoration: none; }
.invitation { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #d9dde2; }
.invitation div { display: grid; gap: .25rem; }
.invitation form { display: flex; gap: .5rem; }
.portal-page button.secondary { background: #59616b; }
.portal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem max(1rem, calc((100% - 72rem) / 2)); border-bottom: 1px solid #d9dde2; }
.portal-header nav, .portal-header form { display: flex; align-items: center; gap: .375rem; margin: 0; }
.portal-nav-link, .portal-sign-out { min-height: 2.5rem; display: inline-flex; align-items: center; border: 1px solid transparent; border-radius: 5px; padding: 0 .875rem; color: #252a30; background: transparent; font: inherit; font-weight: 600; text-decoration: none; }
.portal-nav-link:hover, .portal-nav-link.active { background: #eef1f3; color: #17191c; }
.portal-sign-out { border-color: #c8cdd3; background: #fff; color: #252a30; }
.portal-sign-out:hover { border-color: #59616b; background: #f4f5f6; }
.dashboard { display: grid; gap: 2rem; }
.dashboard-heading h1 { margin: .25rem 0 0; }
.dashboard-eyebrow { margin: 0; color: #1e5a46; font-size: .8125rem; font-weight: 700; text-transform: uppercase; }
.dashboard-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #d9dde2; background: #fff; }
.dashboard-summary div { display: grid; gap: .5rem; padding: 1.25rem; border-right: 1px solid #d9dde2; }
.dashboard-summary div:last-child { border-right: 0; }
.dashboard-summary span, .section-heading p { color: #59616b; }
.dashboard-summary strong { font-size: 1.5rem; }
.dashboard-section { padding-top: 1.25rem; border-top: 1px solid #d9dde2; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1rem; }
.section-heading h2, .section-heading p { margin: 0; }
.message-list { display: grid; }
.message-item { padding: 1rem 0; border-bottom: 1px solid #d9dde2; }
.message-item header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.message-item h3, .message-item p { margin: 0; }
.message-item p { margin-top: .5rem; white-space: pre-wrap; }
.message-item time, .empty-state { color: #59616b; }
.organization-picker { max-width: 42rem; }
.archive-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.archive-heading h1 { margin: 0; }
.archive-heading form { display: flex; align-items: end; gap: .5rem; margin: 0; }
.archive-heading label { display: grid; gap: .25rem; color: #59616b; font-size: .8125rem; }
.archive-heading input { width: 7rem; min-height: 2.5rem; border: 1px solid #aeb5bd; padding: .5rem; font: inherit; }
.archive-heading a { min-height: 2.5rem; display: inline-flex; align-items: center; padding: 0 .75rem; color: #252a30; }
.invoice-table { display: grid; }
.invoice-row { display: grid; grid-template-columns: 8rem 8rem 1fr 10rem 10rem; gap: 1rem; padding: .75rem; border-bottom: 1px solid #d9dde2; color: inherit; text-decoration: none; }
.invoice-row span:nth-last-child(-n+2) { text-align: right; }
.invoice-heading { background: #252a30; color: #fff; font-weight: 700; }
.access-form { display: grid; grid-template-columns: minmax(16rem, 1fr) 12rem auto; gap: 1rem; align-items: end; }
.access-form label { display: grid; gap: .375rem; }
.access-form input, .access-form select { min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid #aeb5bd; background: #fff; font: inherit; }
.access-list { border-top: 1px solid #d9dde2; }
.access-row { display: grid; grid-template-columns: minmax(14rem, 1fr) 8rem 8rem auto; gap: 1rem; align-items: center; min-height: 3.75rem; border-bottom: 1px solid #d9dde2; }
.access-form { margin-bottom: 2.5rem; }
.dashboard-section + .dashboard-section { margin-top: 2.5rem; }
@media (max-width: 720px) { .portal-header { align-items: flex-start; gap: 1rem; } .portal-header nav { flex-wrap: wrap; justify-content: flex-end; } .dashboard-summary { grid-template-columns: 1fr; } .dashboard-summary div { border-right: 0; border-bottom: 1px solid #d9dde2; } .dashboard-summary div:last-child { border-bottom: 0; } .invoice-heading { display: none; } .invoice-row { grid-template-columns: 1fr 1fr; } .invoice-row span:nth-last-child(-n+2) { text-align: left; } }
@media (max-width: 420px) { .portal-auth-actions { grid-template-columns: 1fr; } }

/* Authenticated portal */
body:has(.portal-header) { min-height: 100vh; background: #f5f8f9; color: var(--ink); }
.portal-header { position: sticky; top: 0; z-index: 10; min-height: 4.5rem; border-bottom-color: #e2e9ec; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.portal-header .portal-brand { font-family: var(--font-display); font-size: 1.1rem; }
.portal-header .portal-brand img { width: 2.25rem; height: 2.25rem; }
.portal-header nav { gap: .25rem; }
.portal-nav-link,.portal-sign-out { border-radius: 6px; font-size: .875rem; }
.portal-nav-link:hover { background: #edf4f5; color: #176f83; }
.portal-nav-link.active { background: #e1f1f4; color: #176f83; }
.portal-sign-out { margin-left: .35rem; border-color: #d5dfe2; }
.portal-page { width: min(100% - 3rem,76rem); margin: 3.5rem auto 5rem; }
.dashboard { gap: 2.75rem; }
.dashboard-heading h1,.archive-heading h1 { margin: .35rem 0 0; font-family: var(--font-display); font-size: clamp(2rem,4vw,3.2rem); line-height: 1.05; letter-spacing: 0; }
.dashboard-eyebrow { color: #23849a; font-family: var(--font-mono); letter-spacing: 0; }
.dashboard-summary { grid-template-columns: 1.5fr 1fr 1fr; overflow: hidden; border-color: #dce6e8; border-radius: 8px; box-shadow: 0 12px 30px rgba(26,33,36,.06); }
.dashboard-summary div { min-height: 7rem; align-items: center; justify-content: center; border-right-color: #dce6e8; padding: 1.4rem 1.5rem; text-align: center; }
.dashboard-summary .summary-primary { border-top: 3px solid #2e8fa6; }
.dashboard-summary span { font-size: .85rem; font-weight: 500; }
.dashboard-summary strong { font-family: var(--font-display); font-size: 1.75rem; letter-spacing: 0; }
.dashboard-section { padding-top: 0; border-top: 0; }
.upcoming-meeting { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.25rem 1.5rem; border-left: 3px solid #2e8fa6; background: #fff; box-shadow: 0 8px 24px rgba(26,33,36,.06); }
.upcoming-meeting h2 { margin: .15rem 0 .35rem; }
.upcoming-meeting time { color: #59616b; }
.portal-command { min-height: 2.75rem; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; border: 1px solid #267f94; border-radius: 5px; padding: 0 1rem; background: #2e8fa6; color: #fff; font-weight: 600; text-decoration: none; }
.portal-command:hover { background: #267f94; }
.section-heading { align-items: end; padding-bottom: .9rem; border-bottom: 1px solid #dce6e8; }
.section-heading h2 { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0; }
.section-heading p { margin-top: .2rem; font-size: .875rem; }
.text-link { font-size: .875rem; font-weight: 600; }
.message-list { gap: .65rem; }
.message-item { border: 1px solid #e0e8ea; border-radius: 7px; padding: 1.1rem 1.25rem; background: #fff; }
.message-item header { align-items: center; }.message-item h2,.message-item h3 { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0; }.message-item time { flex: none; font-size: .8rem; }.message-item p { color: #495053; line-height: 1.6; }
.invoice-table { overflow: hidden; border: 1px solid #dce6e8; border-radius: 7px; background: #fff; }
.invoice-row { min-height: 3.75rem; align-items: center; border-bottom-color: #e7edef; padding: .8rem 1rem; }
.invoice-row:last-child { border-bottom: 0; }.invoice-row:not(.invoice-heading):hover { background: #f2f8f9; }
.invoice-heading { min-height: 2.75rem; background: #20292c; font-size: .75rem; text-transform: uppercase; }
.invoice-number { color: #237f94; font-family: var(--font-mono); font-weight: 500; }.balance-amount { font-weight: 600; }
.status-badge { display: inline-flex; align-items: center; min-height: 1.65rem; border-radius: 999px; padding: .15rem .6rem; background: #edf0f1; color: #465156; font-size: .75rem; font-weight: 600; }
.status-paid { background: #e3f3ea; color: #17613b; }.status-issued { background: #fff0d7; color: #80550a; }.status-void { background: #f4e7e7; color: #852f2f; }
.archive-heading { align-items: end; margin: .5rem 0 1.75rem; }
.archive-heading form { display: grid; grid-template-columns: auto 13rem; align-items: center; gap: .65rem; }
.archive-heading label { color: #5b666b; font-family: var(--font-mono); font-size: .75rem; font-weight: 500; text-transform: uppercase; }
.archive-heading select { min-height: 2.6rem; border: 1px solid #cbd7da; border-radius: 5px; padding: 0 2.25rem 0 .75rem; background: #fff; color: #22282b; font: inherit; }
.archive-messages { margin-top: .5rem; }
.empty-state { border: 1px dashed #cad6d9; border-radius: 7px; padding: 2rem; background: #fff; text-align: center; }
@media (max-width:800px) { .portal-header { position: static; display: grid; }.portal-header nav { overflow-x: auto; justify-content: start; padding-bottom: .25rem; }.portal-nav-link,.portal-sign-out { white-space: nowrap; }.portal-page { width: min(100% - 2rem,76rem); margin-top: 2rem; }.dashboard-summary { grid-template-columns: 1fr; }.dashboard-summary div { min-height: 5.5rem; }.upcoming-meeting { align-items: stretch; flex-direction: column; gap: 1rem; }.archive-heading { align-items: stretch; flex-direction: column; }.archive-heading form { grid-template-columns: 1fr; }.archive-heading select { width: 100%; }.invoice-row { grid-template-columns: 1fr 1fr; gap: .45rem 1rem; }.invoice-row>span:nth-child(3) { grid-column: 1/-1; }.invoice-row>span:nth-child(4)::before { content: attr(data-label); }.message-item header { align-items: start; flex-direction: column; gap: .25rem; } }
