:root {
    color-scheme: light;
    --ink: #16332f;
    --muted: #5f7470;
    --brand: #087468;
    --brand-dark: #075a52;
    --brand-soft: #e9f6f3;
    --line: #dce9e6;
    --surface: #ffffff;
    --canvas: #f4f8f7;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% 0, #dff3ee 0, transparent 34rem), var(--canvas); color: var(--ink); }
a { color: inherit; }
.portal-header { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 14px clamp(20px, 5vw, 72px); border-bottom: 1px solid rgba(8, 116, 104, .12); background: rgba(255,255,255,.92); }
.portal-header img { display: block; height: 40px; width: auto; }
.portal-header > span { color: var(--muted); font-size: .88rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.portal-main { width: min(1080px, calc(100% - 32px)); min-height: calc(100vh - 196px); margin: 0 auto; padding: 58px 0 72px; }
.hero { max-width: 680px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.05; letter-spacing: -.035em; }
.hero > p:last-child, .state-card > p, .panel-heading p { color: var(--muted); line-height: 1.65; }
.panel, .document-card, .state-card { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 20px 60px rgba(19, 63, 57, .08); }
.search-panel { padding: clamp(24px, 5vw, 44px); }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.panel-heading h2, .detail-section h2 { margin: 0; font-size: 1.25rem; }
.panel-heading p { margin: 0; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
label { display: grid; gap: 8px; font-size: .91rem; font-weight: 700; }
label small { color: var(--muted); font-size: .78rem; font-weight: 500; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #b9cfca; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(8,116,104,.24); outline-offset: 2px; border-color: var(--brand); }
.money-input { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid #b9cfca; border-radius: 10px; overflow: hidden; }
.money-input > span { padding-left: 14px; color: var(--muted); }
.money-input input { border: 0; }
.primary-action, .secondary-action, .text-action { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 0 20px; border: 1px solid transparent; border-radius: 10px; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.primary-action { margin-top: 30px; background: var(--brand); color: #fff; }
.primary-action:hover { background: var(--brand-dark); }
.primary-action:disabled { cursor: wait; opacity: .72; }
.submit-status { min-height: 1.3em; margin: 10px 0 0; color: var(--muted); font-size: .85rem; }
.secondary-action { border-color: var(--brand); background: #fff; color: var(--brand); }
.text-action { border-color: var(--line); background: #fff; color: var(--ink); }
.privacy-note { margin: 22px 8px 0; color: var(--muted); font-size: .9rem; }
.privacy-note strong { color: var(--ink); }
.privacy-note p { display: inline; margin-left: 6px; }
.document-card { overflow: hidden; }
.document-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: clamp(26px, 5vw, 48px); background: linear-gradient(125deg, #fff, var(--brand-soft)); }
.document-heading h1 { font-size: clamp(1.55rem, 4vw, 2.55rem); }
.document-number { margin: 10px 0 0; color: var(--muted); font-size: 1.25rem; font-weight: 750; letter-spacing: .04em; }
.status-badge { padding: 9px 13px; border-radius: 999px; background: #d7f1e6; color: #116244; font-size: .85rem; font-weight: 800; white-space: nowrap; }
.identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; padding: 14px clamp(26px, 5vw, 48px); }
.identity-grid > div { padding: 20px 0; border-bottom: 1px solid var(--line); }
.identity-grid > div:nth-child(odd):not(.wide) { padding-right: 28px; }
.identity-grid > div:nth-child(even):not(.wide) { padding-left: 28px; border-left: 1px solid var(--line); }
.identity-grid .wide { grid-column: 1 / -1; }
dt { color: var(--muted); font-size: .78rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
dd { margin: 7px 0 0; font-weight: 700; }
dd small { display: block; margin-top: 5px; color: var(--muted); font-weight: 500; }
.detail-section { padding: 30px clamp(26px, 5vw, 48px) 42px; }
.items-table-wrap { overflow-x: auto; margin-top: 20px; }
.items-table { width: 100%; min-width: 620px; border-collapse: collapse; }
.items-table th, .items-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.items-table th { color: var(--muted); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
.items-table th:first-child, .items-table td:first-child { text-align: left; }
.totals { width: min(100%, 360px); margin: 24px 0 0 auto; }
.totals > div { display: flex; justify-content: space-between; padding: 9px 0; }
.totals dd { margin: 0; }
.totals .grand-total { margin-top: 6px; padding-top: 16px; border-top: 2px solid var(--brand); }
.totals .grand-total dt, .totals .grand-total dd { color: var(--brand-dark); font-size: 1.1rem; font-weight: 850; }
.document-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 26px clamp(26px, 5vw, 48px); border-top: 1px solid var(--line); background: #fbfdfc; }
.document-actions .primary-action { margin: 0; }
.state-card { max-width: 680px; margin: 50px auto; padding: clamp(34px, 7vw, 64px); text-align: center; }
.state-card h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
.state-card .primary-action { margin-top: 18px; }
.state-icon { display: inline-grid; width: 54px; height: 54px; margin-bottom: 24px; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 1.5rem; font-weight: 850; }
.portal-footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .8rem; }
.portal-footer p { margin: 0; }
@media (max-width: 700px) {
    .portal-main { padding-top: 36px; }
    .form-grid, .identity-grid { grid-template-columns: 1fr; }
    .panel-heading, .document-heading { align-items: flex-start; flex-direction: column; }
    .identity-grid > div:nth-child(odd):not(.wide), .identity-grid > div:nth-child(even):not(.wide) { padding-right: 0; padding-left: 0; border-left: 0; }
    .privacy-note p { display: block; margin: 5px 0 0; }
    .document-actions > * { width: 100%; }
    .portal-footer { flex-direction: column; }
}
@media print {
    body { background: #fff; }
    .portal-header, .portal-footer, .document-actions { display: none; }
    .portal-main { width: 100%; padding: 0; }
    .document-card { border: 0; box-shadow: none; }
}
