/* Portal surfaces — built on the design tokens declared in style.css */

.site-nav { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.5rem); }
.site-nav form { margin: 0; }
.nav-link { color: var(--blue-deep); text-decoration: none; font: 800 .72rem "Manrope", sans-serif; letter-spacing: .09em; text-transform: uppercase; opacity: .78; transition: opacity .2s ease; }
.nav-link:hover { opacity: 1; }
.header-login { display: inline-flex; align-items: center; gap: .25rem; border: 0; padding: 0; background: none; cursor: pointer; }

/* Shared page shells */
.portal-shell { width: min(calc(100% - 3rem), var(--max)); margin: 0 auto; padding: clamp(3rem, 6vw, 5rem) 0 6rem; }
.portal-shell.narrow { max-width: 46rem; }
.portal-shell > .lead { margin-bottom: 2.5rem; }

.auth-shell { width: min(calc(100% - 3rem), 62rem); margin: 0 auto; padding: clamp(3rem, 7vw, 6rem) 0 7rem; display: grid; grid-template-columns: 1fr minmax(320px, .95fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; min-height: 68vh; }
.auth-shell h1 { font-size: clamp(2.4rem, 4vw, 3.4rem); margin-bottom: 1rem; }
.auth-shell > div > p:last-child { color: var(--muted); max-width: 26rem; margin: 0; }

.auth-form { display: grid; gap: 1.1rem; padding: 1.9rem; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 1.2rem; box-shadow: var(--shadow); }
.auth-form label { display: grid; color: var(--blue-deep); font: 800 .67rem "Manrope", sans-serif; letter-spacing: .09em; text-transform: uppercase; }
.auth-form input { width: 100%; margin-top: .3rem; padding: .7rem 0; border: 0; border-bottom: 1px solid #bedde9; background: transparent; outline: none; color: var(--ink); font: 400 .95rem "DM Sans", sans-serif; letter-spacing: normal; text-transform: none; }
.auth-form input:focus { border-color: var(--blue); }
.auth-form .button { margin-top: .4rem; border: 0; cursor: pointer; }
.auth-form p { margin: 0; color: var(--muted); font-size: .84rem; }
.auth-form p a { color: var(--blue-deep); font-weight: 800; text-decoration: none; }

.field-error { color: #b3392f; font-size: .82rem; font-weight: 600; }
.alert { margin: 0 0 1.5rem; padding: .85rem 1.1rem; border: 1px solid #9ed5eb; border-left-width: 3px; border-radius: .7rem; background: rgba(239,248,252,.9); color: var(--blue-deep); font-size: .88rem; font-weight: 600; }

/* Dashboard */
.dashboard-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2.5rem; }
.dashboard-heading h1 { font-size: clamp(2.4rem, 4vw, 3.4rem); margin: 0; }

.balance-card { position: relative; display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: .5rem 1rem; padding: 1.6rem 1.9rem; border: 1px solid #cfe8f3; border-radius: 1.2rem; background: rgba(255,255,255,.9); box-shadow: var(--shadow); overflow: hidden; }
.balance-card::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 16rem; background: radial-gradient(circle at 80% 30%, rgba(70,186,234,.16), transparent 70%); pointer-events: none; }
.balance-card > span:first-child { grid-column: 1 / -1; color: var(--muted); font: 800 .7rem "Manrope", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.balance-card strong { color: var(--blue); font: 800 clamp(2.6rem, 5vw, 3.6rem)/1 "Manrope", sans-serif; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.balance-card small { color: var(--muted); font: 800 .72rem "Manrope", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.balance-card a { justify-self: end; position: relative; z-index: 1; color: var(--blue-deep); font: 800 .74rem "Manrope", sans-serif; letter-spacing: .05em; text-transform: uppercase; text-decoration: none; }

.jobs-section { margin-top: 3.5rem; }
.jobs-section h2 { font-size: 1.6rem; margin-bottom: 1.2rem; }

.table-wrap { border: 1px solid var(--line); border-radius: 1.1rem; background: rgba(255,255,255,.85); overflow: hidden; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th { padding: .95rem 1.2rem; text-align: left; background: rgba(237,248,253,.8); border-bottom: 1px solid var(--line); color: var(--blue-deep); font: 800 .66rem "Manrope", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.table-wrap td { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .9rem; vertical-align: middle; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tr:hover td { background: rgba(239,248,252,.55); }
.table-wrap td strong { display: block; color: var(--ink); font: 800 .82rem "Manrope", sans-serif; letter-spacing: .07em; }
.table-wrap td small { color: var(--muted); font-size: .78rem; }

.status { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 100vmax; background: #eef6fa; color: var(--blue-deep); font: 800 .67rem "Manrope", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status-processing, .status-queued { background: #fff3da; color: #8a5a10; }
.status-ready { background: #e2f6e8; color: #1f7a42; }
.status-failed { background: #fdeceb; color: #a8352b; }
.status-downloaded { background: #eaeef1; color: #4a5f6c; }

.empty-state { padding: 3rem 1.5rem; border: 1px dashed #b9dcec; border-radius: 1.1rem; background: rgba(255,255,255,.6); text-align: center; color: var(--muted); }
.empty-state a { display: inline-block; margin-left: .4rem; color: var(--blue-deep); font-weight: 800; text-decoration: none; }

.job-actions { text-align: right; white-space: nowrap; }
.job-actions form { display: inline-block; margin: 0 .6rem 0 0; }
.button-small { min-height: 34px; padding: .45rem .85rem; font-size: .68rem; }
.report-link { border: 0; padding: 0; background: none; color: var(--blue-deep); font: 800 .74rem "Manrope", sans-serif; letter-spacing: .04em; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.report-sent { color: #1f7a42; font: 800 .74rem "Manrope", sans-serif; letter-spacing: .04em; }

.report-modal-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1.5rem; background: rgba(9,45,63,.45); backdrop-filter: blur(2px); }
.report-modal { position: relative; width: min(100%, 26rem); padding: 1.75rem; border-radius: 1.2rem; background: #fff; box-shadow: 0 24px 60px rgba(7,57,83,.25); }
.report-modal h3 { margin-bottom: .5rem; }
.report-modal p { margin: 0 0 1rem; color: var(--muted); font-size: .88rem; }
.report-modal textarea { width: 100%; padding: .75rem; border: 1px solid var(--line); border-radius: .7rem; resize: vertical; color: var(--ink); font: 400 .92rem "DM Sans", sans-serif; }
.report-modal textarea:focus { outline: none; border-color: var(--blue); }
.report-modal-close { position: absolute; top: .9rem; right: .9rem; width: 1.8rem; height: 1.8rem; border: 0; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; }
.report-modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: 1rem; }
.button-text { border: 0; padding: 0; background: none; color: var(--muted); font: 800 .74rem "Manrope", sans-serif; letter-spacing: .04em; cursor: pointer; }

/* Contact modal — opened via the #contact-modal anchor, no JS required */
.contact-modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(9,45,63,.5); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.contact-modal-overlay:target { opacity: 1; visibility: visible; }
.contact-modal { position: relative; width: min(100%, 30rem); max-height: 90vh; overflow-y: auto; padding: 2rem; border-radius: 1.3rem; background: #fff; box-shadow: 0 30px 70px rgba(7,57,83,.28); }
.contact-modal h2 { margin-bottom: .6rem; }
.contact-modal-lead { color: var(--muted); margin: 0 0 1.4rem; font-size: .92rem; }
.contact-modal-close { position: absolute; top: 1.1rem; right: 1.1rem; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--soft); color: var(--muted); text-decoration: none; font-size: 1.1rem; line-height: 1; }
.contact-modal-close:hover { color: var(--blue-deep); }
.contact-form { display: grid; gap: 1rem; }
.contact-form label { display: grid; color: var(--blue-deep); font: 800 .67rem "Manrope", sans-serif; letter-spacing: .09em; text-transform: uppercase; }
.contact-form input, .contact-form textarea { width: 100%; margin-top: .3rem; padding: .7rem 0; border: 0; border-bottom: 1px solid #bedde9; background: transparent; outline: none; color: var(--ink); font: 400 .95rem "DM Sans", sans-serif; letter-spacing: normal; text-transform: none; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--blue); }
.contact-form .button { margin-top: .4rem; border: 0; cursor: pointer; }

/* Billing */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.pack { display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem; border: 1px solid #d4eaf3; border-radius: 1.1rem; background: rgba(255,255,255,.88); transition: transform .25s ease, box-shadow .25s ease; }
.pack:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.pack > span:first-child { color: var(--blue); font: 800 .7rem "Manrope", sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.pack strong { color: var(--ink); font: 700 1.5rem/1.1 "Manrope", sans-serif; letter-spacing: -.04em; }
.pack p { flex: 1; margin: 0; color: var(--muted); font-size: .85rem; }
.pack button { min-height: 44px; margin-top: .6rem; padding: .7rem 1.1rem; border: 1px solid transparent; border-radius: 100vmax; background: var(--blue); color: #fff; font: 800 .72rem "Manrope", sans-serif; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background .2s ease; }
.pack button:hover:not(:disabled) { background: var(--blue-deep); }
.pack button:disabled { background: #e6eff4; color: var(--muted); cursor: not-allowed; }

/* New treatment */
.pipeline-form { display: grid; gap: 1rem; margin-top: 2rem; }
.pipeline-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.1rem; padding: 1.4rem 1.6rem; border: 1px solid var(--line); border-radius: 1.1rem; background: rgba(255,255,255,.88); cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.pipeline-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pipeline-card:has(input:checked) { border-color: var(--blue); background: rgba(237,248,253,.92); box-shadow: var(--shadow); }
.pipeline-card input { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }
.pipeline-card span { display: grid; gap: .25rem; }
.pipeline-card b { color: var(--ink); font: 800 1.1rem "Manrope", sans-serif; letter-spacing: -.02em; }
.pipeline-card small { color: var(--muted); font-size: .86rem; }
.pipeline-card em { color: var(--blue-deep); font: 800 .7rem "Manrope", sans-serif; letter-spacing: .07em; text-transform: uppercase; font-style: normal; text-align: right; }
.pipeline-form .button { justify-self: start; margin-top: .8rem; border: 0; cursor: pointer; }

/* Legal pages */
.legal-hero { width: min(calc(100% - 3rem), var(--max)); margin: 0 auto; padding: clamp(3.5rem, 7vw, 6rem) 0 2.5rem; }
.legal-hero h1 { font-size: clamp(2.8rem, 5vw, 4.4rem); margin-bottom: 1rem; }
.legal-hero .legal-meta { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 100vmax; background: rgba(255,255,255,.7); color: var(--muted); font: 800 .68rem "Manrope", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.legal-hero .legal-meta::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--blue); }

.legal-layout { width: min(calc(100% - 3rem), var(--max)); margin: 0 auto; padding-bottom: 7rem; display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }

.legal-toc { position: sticky; top: 6rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 1.1rem; background: rgba(255,255,255,.82); box-shadow: 0 8px 26px rgba(12,102,147,.04); }
.legal-toc p { margin: 0 0 .9rem; color: var(--blue); font: 800 .68rem "Manrope", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.legal-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; display: grid; gap: .1rem; }
.legal-toc li { counter-increment: toc; }
.legal-toc a { display: grid; grid-template-columns: 1.6rem 1fr; gap: .3rem; padding: .35rem .4rem; border-radius: .45rem; color: var(--muted); text-decoration: none; font-size: .82rem; line-height: 1.35; transition: background .2s ease, color .2s ease; }
.legal-toc a::before { content: counter(toc, decimal-leading-zero); color: var(--blue); font: 800 .7rem "Manrope", sans-serif; }
.legal-toc a:hover { background: rgba(237,248,253,.9); color: var(--blue-deep); }

.legal-body { min-width: 0; }
.legal-body section { padding-bottom: 2.6rem; margin-bottom: 2.6rem; border-bottom: 1px solid var(--line); scroll-margin-top: 6rem; }
.legal-body section:last-child { border-bottom: 0; }
.legal-body h2 { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .7rem; font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 1.4rem; }
.legal-body h2 span { color: var(--blue); font-size: .8rem; font-weight: 800; letter-spacing: .08em; }
.legal-body h3 { font-size: 1rem; margin: 1.6rem 0 .8rem; color: var(--blue-deep); }
.clause { margin: 0 0 .85rem; padding-left: 4.2rem; text-indent: -4.2rem; color: var(--muted); font-size: .93rem; line-height: 1.65; }
.clause > b { display: inline-block; width: 3.4rem; margin-right: .8rem; text-indent: 0; color: var(--blue); font: 800 .78rem/1.9 "Manrope", sans-serif; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clause strong { color: var(--ink); }
.clause a { color: var(--blue-deep); font-weight: 700; }
.clause.deep { padding-left: 5.4rem; text-indent: -5.4rem; }
.clause.deep > b { width: 4.6rem; }
.clause.deeper { padding-left: 8rem; text-indent: -8rem; }
.clause.deeper > b { width: 5.6rem; }

.legal-table { margin: 1.4rem 0 .5rem; border: 1px solid var(--line); border-radius: 1.1rem; background: rgba(255,255,255,.85); overflow: hidden; }
.legal-table table { width: 100%; border-collapse: collapse; }
.legal-table th { padding: .9rem 1rem; text-align: left; background: rgba(237,248,253,.85); border-bottom: 1px solid var(--line); color: var(--blue-deep); font: 800 .64rem "Manrope", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.legal-table td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; line-height: 1.55; vertical-align: top; }
.legal-table tr:last-child td { border-bottom: 0; }
.legal-table td:first-child { color: var(--ink); font-weight: 600; }
.legal-table td b { display: block; color: var(--blue); font: 800 .7rem "Manrope", sans-serif; letter-spacing: .05em; margin-bottom: .25rem; }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; min-height: 0; }
    .nav-link { display: none; }
    .legal-layout { grid-template-columns: 1fr; }
    .legal-toc { position: static; }
    .legal-table { overflow-x: auto; }
    .legal-table table { min-width: 34rem; }
}

@media (max-width: 640px) {
    .portal-shell, .auth-shell, .legal-hero, .legal-layout { width: min(calc(100% - 2rem), var(--max)); }
    .clause { padding-left: 3rem; text-indent: -3rem; }
    .clause > b { width: 2.3rem; margin-right: .5rem; }
    .clause.deep { padding-left: 3.8rem; text-indent: -3.8rem; }
    .clause.deep > b { width: 3.1rem; }
    .clause.deeper { padding-left: 4.6rem; text-indent: -4.6rem; }
    .clause.deeper > b { width: 3.9rem; }
    .balance-card { grid-template-columns: 1fr; }
    .balance-card a { justify-self: start; }
    .pipeline-card { grid-template-columns: auto 1fr; }
    .pipeline-card em { grid-column: 2; text-align: left; }
    .table-wrap { overflow-x: auto; }
}
