:root {
    --ink: #172A3A;
    --muted: #64748B;
    --teal: #0F4C5C;
    --mint: #2BB3A3;
    --amber: #F4A261;
    --ivory: #F7F5EF;
    --surface: #FFFFFF;
    --line: #E4E9E7;
    --soft-mint: #E8F7F4;
    --soft-amber: #FFF3E7;
    --danger: #C74646;
    --shadow: 0 18px 50px rgba(23, 42, 58, .08);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
html { background: var(--ivory); }
body { margin: 0; color: var(--ink); background: var(--ivory); font-family: "DM Sans", system-ui, sans-serif; }
img, svg { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }
main, article, section, aside, header, footer, nav, div { min-width: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: "Manrope", "DM Sans", sans-serif; }
/* FocusOnNavigate adds tabindex=-1 and focuses the route heading for assistive technology. */
h1[tabindex="-1"]:focus { outline: none; }

.app-shell { height: 100vh; height: 100svh; min-height: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr); overflow: hidden; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; background: #fff; border-right: 1px solid var(--line); }
.sidebar-inner { height: 100%; display: flex; flex-direction: column; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 2px 6px; }
.brand-lockup { display: block; width: 205px; height: auto; }
.primary-nav { display: flex; flex-direction: column; gap: 7px; margin-top: 42px; }
.primary-nav a { min-height: 46px; display: flex; align-items: center; gap: 13px; padding: 0 14px; color: #536274; text-decoration: none; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .18s ease; }
.primary-nav a:hover { background: #F5F8F7; color: var(--teal); }
.primary-nav a.active { color: var(--teal); background: var(--soft-mint); }
.primary-nav svg, .icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-pill { margin-left: auto; padding: 3px 7px; color: var(--teal); background: #D4F0EB; border-radius: 99px; font-size: 9px; letter-spacing: .05em; }
.sidebar-tip { margin-top: auto; padding: 16px; background: linear-gradient(145deg, #F0FAF8, #FFF9F1); border: 1px solid #D9ECE7; border-radius: 16px; }
.tip-icon { width: 28px; height: 28px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 9px; color: var(--teal); background: #fff; box-shadow: 0 4px 12px rgba(15, 76, 92, .1); }
.sidebar-tip strong { font-size: 13px; }
.sidebar-tip p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 17px 8px 3px; color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px #E4F7F3; }

.main-shell { min-width: 0; min-height: 0; display: grid; grid-template-rows: 76px minmax(0, 1fr); overflow: hidden; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4vw, 58px); background: rgba(247, 245, 239, .88); border-bottom: 1px solid rgba(218, 221, 216, .9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.mobile-brand { display: none; }
.topbar-trip { display: flex; flex-direction: column; gap: 3px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.topbar-trip strong { font-size: 14px; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: 16px; }
.icon-button { width: 39px; height: 39px; display: grid; place-items: center; color: #526170; background: #fff; border: 1px solid var(--line); border-radius: 12px; position: relative; cursor: pointer; }
.notification-dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); border: 1px solid #fff; }
.profile-chip { display: flex; align-items: center; gap: 9px; }
.profile-chip > span, .avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--teal); border-radius: 12px; font-size: 12px; font-weight: 700; }
.profile-chip div { display: flex; flex-direction: column; }
.profile-chip strong { font-size: 12px; }
.profile-chip small { color: var(--muted); font-size: 10px; }
.content-shell { width: min(1240px, 100%); height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; margin: 0 auto; padding: 0 clamp(24px, 4vw, 58px); }
.content-scroll { min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 38px 0 30px; scrollbar-width: none; -ms-overflow-style: none; }
.content-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }
.content-shell > .legal-footer { flex: 0 0 auto; margin: 0; padding: 14px 0 16px; background: var(--ivory); border-top: 1px solid var(--line); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -1.2px; }
.page-heading p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.heading-actions { display: flex; align-items: center; align-self: center; gap: 10px; flex-wrap: wrap; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border-radius: 11px; border: 1px solid transparent; font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); box-shadow: 0 9px 20px rgba(15, 76, 92, .2); }
.button-secondary { color: var(--teal); background: #fff; border-color: #D5DFDD; }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-amber { color: #713C10; background: #FFE4C7; }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.hero-card { display: grid; grid-template-columns: 1.4fr .8fr; gap: 28px; min-height: 225px; padding: 32px; overflow: hidden; position: relative; color: #fff; background: linear-gradient(125deg, #0D4655 0%, #126474 62%, #278F88 100%); border-radius: 22px; box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; width: 260px; height: 260px; right: -65px; top: -82px; border: 42px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero-card .eyebrow { color: #BCE4DF; }
.hero-card h1 { max-width: 620px; margin: 13px 0 10px; font-size: clamp(27px, 3.6vw, 43px); line-height: 1.1; letter-spacing: -1.6px; }
.hero-card p { max-width: 560px; color: #D1E7E5; line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; }
.hero-actions .button-primary { color: var(--teal); background: #fff; box-shadow: none; }
.hero-actions .button-secondary { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.hero-amount { align-self: center; padding: 23px; z-index: 1; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 18px; backdrop-filter: blur(9px); }
.hero-amount span { display: block; color: #C5E6E2; font-size: 12px; }
.hero-amount strong { display: block; margin: 5px 0 17px; font: 800 32px "Manrope"; }
.trip-meta { display: flex; justify-content: space-between; gap: 14px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.18); }
.trip-meta div { display: flex; flex-direction: column; gap: 3px; }
.trip-meta small { color: #B9D8D5; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.trip-meta b { font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.metric-card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 8px 26px rgba(23, 42, 58, .04); }
.metric-card { padding: 19px; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--soft-mint); color: var(--teal); font-size: 13px; }
.metric-card strong { display: block; margin: 11px 0 2px; font: 800 23px "Manrope"; }
.metric-card small { color: var(--muted); font-size: 10px; }
.positive { color: #24715A !important; }
.negative { color: var(--danger) !important; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr); gap: 18px; }
.panel { padding: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.panel-header h2 { margin: 0; font-size: 17px; letter-spacing: -.35px; }
.text-link { color: var(--teal); font-size: 12px; font-weight: 700; text-decoration: none; }
.expense-list, .balance-list, .member-list, .receipt-lines { display: flex; flex-direction: column; }
.expense-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid #EEF1F0; }
.expense-row:last-child { border-bottom: 0; }
.expense-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--teal); background: var(--soft-mint); font-size: 17px; }
.expense-main { min-width: 0; }
.expense-main strong, .expense-amount strong { display: block; font-size: 13px; }
.expense-main small, .expense-amount small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.expense-amount { text-align: right; }
.balance-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 12px 0; }
.balance-row .avatar { width: 36px; height: 36px; border-radius: 11px; }
.balance-row div:nth-child(2) { display: flex; flex-direction: column; }
.balance-row small { color: var(--muted); font-size: 10px; }
.balance-row > strong { font-size: 12px; }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; background: #EDF1F0; border-radius: 99px; }
.progress-fill { height: 100%; background: var(--mint); border-radius: 99px; }
.insight-card { display: grid; grid-template-columns: 32px 1fr; gap: 11px; margin-top: 17px; padding: 14px; background: var(--soft-amber); border-radius: 13px; }
.insight-card .tip-icon { margin: 0; color: #A45D1D; }
.insight-card strong { display: block; font-size: 11px; }
.insight-card p { margin: 4px 0 0; color: #7B614B; font-size: 10px; line-height: 1.45; }

.household-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.household-card { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 24px rgba(23,42,58,.04); }
.household-card-head { display: flex; align-items: center; gap: 11px; padding-bottom: 16px; border-bottom: 1px solid #EDF1F0; }
.household-card-head .avatar { border-radius: 12px; }
.household-card-head div { min-width: 0; }
.household-card-head h3 { margin: 0 0 3px; font-size: 15px; }
.household-card-head small { color: var(--muted); font-size: 10px; }
.weight-total { margin-left: auto; text-align: right; }
.weight-total strong { display: block; color: var(--teal); font-size: 18px; }
.weight-total small { font-size: 9px; }
.member-row { display: grid; grid-template-columns: minmax(0, 1fr) 94px; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #F0F2F1; }
.member-row:last-child { border-bottom: 0; }
.member-row strong { display: block; font-size: 12px; }
.member-row small { color: var(--muted); font-size: 10px; }
.weight-select, .field { width: 100%; padding: 10px 11px; color: var(--ink); background: #FBFCFC; border: 1px solid #DDE4E2; border-radius: 10px; outline: none; }
.weight-select { padding: 7px 8px; font-size: 11px; }
.weight-select:focus, .field:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(43,179,163,.12); }
.explanation-banner { display: flex; gap: 14px; margin-bottom: 20px; padding: 17px 19px; background: #EAF6F5; border: 1px solid #CDE7E2; border-radius: 14px; }
.explanation-banner span { font-size: 21px; }
.explanation-banner strong { font-size: 12px; }
.explanation-banner p { margin: 4px 0 0; color: #506D70; font-size: 11px; }

.table-panel { overflow-x: auto; padding: 0; -webkit-overflow-scrolling: touch; }
.expense-table { width: 100%; border-collapse: collapse; }
.expense-table th { padding: 13px 17px; color: var(--muted); background: #FAFBFB; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.expense-table td { padding: 15px 17px; border-top: 1px solid #EDF1F0; font-size: 12px; }
.expense-table td:last-child, .expense-table th:last-child { text-align: right; }
.category-tag, .mode-tag { display: inline-flex; align-items: center; padding: 5px 8px; color: #486067; background: #EEF4F3; border-radius: 7px; font-size: 10px; font-weight: 600; }
.mode-tag { color: #8B531E; background: #FFF0DF; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: #465867; font-size: 11px; font-weight: 700; }
.field { min-height: 43px; font-size: 12px; }
.modal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.allocation-preview { padding: 18px; background: #F3F8F7; border-radius: 14px; }
.allocation-preview h3 { font-size: 13px; }
.allocation-preview-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 11px; border-bottom: 1px solid #DDEAE7; }
.allocation-preview-row:last-child { border-bottom: 0; }

.scan-grid { display: grid; grid-template-columns: minmax(270px, .65fr) minmax(0, 1.35fr); gap: 18px; }
.receipt-preview { min-height: 570px; padding: 27px; position: relative; overflow: hidden; color: #2D3336; background: #E9E5DA; border-radius: 18px; }
.receipt-paper { width: min(350px, 92%); min-height: 500px; margin: 0 auto; padding: 28px 23px; background: #FFFEF8; box-shadow: 0 18px 35px rgba(49,49,45,.16); transform: rotate(-1deg); font: 11px ui-monospace, monospace; }
.receipt-paper h3 { text-align: center; font: 700 16px ui-monospace, monospace; }
.receipt-paper .receipt-meta { text-align: center; color: #697074; }
.receipt-paper hr { margin: 18px 0; border: 0; border-top: 1px dashed #A8AAA4; }
.receipt-paper .receipt-entry { display: flex; justify-content: space-between; margin: 11px 0; }
.receipt-paper .receipt-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; }
.scan-badge { position: absolute; right: 18px; top: 18px; padding: 7px 10px; color: #fff; background: rgba(15,76,92,.9); border-radius: 9px; font-size: 10px; font-weight: 700; }
.review-panel { padding: 25px; }
.review-summary { display: flex; gap: 12px; margin-bottom: 18px; padding: 13px; background: var(--soft-mint); border-radius: 12px; }
.review-summary span { width: 29px; height: 29px; display: grid; place-items: center; color: #fff; background: var(--mint); border-radius: 50%; }
.review-summary strong { display: block; font-size: 12px; }
.review-summary p { margin: 3px 0 0; color: #54716D; font-size: 10px; }
.receipt-line { display: grid; grid-template-columns: 24px minmax(0, 1fr) 100px 92px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #EDF1F0; }
.receipt-line input[type=checkbox] { accent-color: var(--teal); }
.receipt-line .field { min-height: 37px; padding: 7px 9px; }
.review-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 20px; }
.review-total small { display: block; color: var(--muted); font-size: 10px; }
.review-total strong { font: 800 24px "Manrope"; }
.success-banner { margin-bottom: 16px; padding: 13px 15px; color: #205C4A; background: #E6F6F0; border: 1px solid #BCE1D3; border-radius: 12px; font-size: 12px; }
.error-banner { margin-bottom: 16px; padding: 13px 15px; color: #7A2630; background: #FFF0F0; border: 1px solid #E8B8BC; border-radius: 12px; font-size: 12px; }

.settlement-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.settlement-card { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.settlement-card small { color: var(--muted); font-size: 10px; }
.settlement-card strong { display: block; margin-top: 6px; font: 800 22px "Manrope"; }
.settlement-route { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 15px; align-items: center; padding: 18px 0; border-bottom: 1px solid #EDF1F0; }
.settlement-route:last-child { border-bottom: 0; }
.route-party { display: flex; align-items: center; gap: 10px; }
.route-party div { display: flex; flex-direction: column; }
.route-party small { color: var(--muted); font-size: 9px; }
.route-arrow { color: var(--mint); font-size: 20px; }
.settlement-route > strong { text-align: right; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }
.space-empty-state { padding: 34px 20px; }
.space-empty-state h3 { margin-bottom: 6px; color: var(--ink); }

#blazor-error-ui { display: none; position: fixed; inset: auto 20px 20px 20px; padding: 14px 18px; z-index: 1000; color: #fff; background: var(--danger); border-radius: 12px; box-shadow: var(--shadow); }
#blazor-error-ui .reload { margin-left: 10px; color: #fff; font-weight: 700; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
.brand-loader { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--ink); }
.brand-loader img { width: min(280px, 72vw); height: auto; animation: logo-breathe 1.25s ease-in-out infinite; }
@keyframes logo-breathe { 0%,100% { transform: scale(.96); opacity: .72; } 50% { transform: scale(1.04); opacity: 1; } }

.section-heading { margin-top: 34px; }
.space-hero { grid-template-columns: 1.2fr .8fr; }
.currency-hero p { color: #D1E7E5; font-size: 11px; }
.currency-actions, .fx-controls, .form-actions { display: flex; align-items: center; gap: 10px; }
.currency-actions .field { color: var(--ink); background: #fff; }
.compact { min-height: 43px; white-space: nowrap; }
.create-space-panel, .entity-form { margin-top: 18px; }
.panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.purpose-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.purpose-option, .authority-option { padding: 14px; text-align: left; color: var(--ink); background: #FBFCFC; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.purpose-option span { display: block; color: var(--teal); font-size: 21px; }
.purpose-option strong, .purpose-option small, .authority-option strong, .authority-option small { display: block; }
.purpose-option strong { margin: 9px 0 3px; font-size: 12px; }
.purpose-option small, .authority-option small { color: var(--muted); font-size: 9px; }
.purpose-option.selected, .authority-option.selected { border-color: var(--mint); background: var(--soft-mint); box-shadow: 0 0 0 2px rgba(43,179,163,.12); }
.create-fields { margin-top: 16px; }
.form-field > small { color: var(--muted); font-size: 9px; }
.form-actions { margin-top: 16px; }
.form-message { color: var(--muted); font-size: 11px; }
.space-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.space-card { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 24px rgba(23,42,58,.04); }
.space-card-top { display: flex; align-items: center; justify-content: space-between; }
.space-purpose-icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--teal); background: var(--soft-mint); border-radius: 13px; font-size: 20px; }
.space-card h2 { margin: 18px 0 7px; font-size: 18px; }
.space-card > p { min-height: 38px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.space-stats, .entity-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 17px 0; padding: 14px; background: #F7F9F8; border-radius: 12px; }
.space-stats small, .entity-summary small, .fx-flow small { display: block; color: var(--muted); font-size: 8px; letter-spacing: .06em; }
.space-stats strong, .entity-summary strong { display: block; margin-top: 4px; font-size: 14px; }
.space-card .button { width: 100%; }
.fx-demo { margin-top: 22px; }
.live-pill { padding: 6px 9px; color: #24715A; background: #E5F7EF; border-radius: 99px; font-size: 9px; font-weight: 800; }
.fx-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 14px; align-items: center; padding: 18px; background: linear-gradient(120deg, #F1FAF8, #FFF7ED); border-radius: 14px; }
.fx-flow strong { display: block; margin-top: 5px; font-size: 18px; }
.fx-flow > span { color: var(--mint); font-size: 20px; }
.fx-controls { margin-top: 14px; }
.fx-controls .field { max-width: 150px; }
.fx-controls small { color: var(--muted); }
.authority-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.invite-contact-control { display: grid; grid-template-columns: minmax(130px, .28fr) minmax(0, 1fr); gap: 10px; }
.invite-contact-field > small { color: var(--muted); line-height: 1.45; }
.optional-label { margin-left: 5px; color: var(--muted); font-size: 9px; font-weight: 500; }
.authority-option strong { margin-bottom: 4px; }
.entity-form { margin-bottom: 18px; }
.lock-badge { margin-left: auto; padding: 6px 8px; color: #73511F; background: var(--soft-amber); border-radius: 8px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.entity-card > p { min-height: 32px; color: var(--muted); font-size: 10px; }
.entity-card .button { width: 100%; }
.expense-form-panel { margin-bottom: 18px; }
.receipt-result { margin-top: 18px; overflow: hidden; }
.receipt-history { margin-top: 18px; }
.receipt-history .panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.receipt-history-list { display: grid; gap: 9px; }
.receipt-history-item { width: 100%; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 14px; color: var(--ink); text-align: left; background: #F8FAF9; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.receipt-history-item:hover { border-color: #B9D7D1; background: var(--soft-mint); }
.receipt-history-item > span { display: flex; flex-direction: column; gap: 3px; }
.receipt-history-item > span:last-child { align-items: flex-end; text-align: right; }
.receipt-history-item small { color: var(--muted); font-size: 10px; }
.receipt-result-table { width: 100%; border-collapse: collapse; }
.receipt-result-table th, .receipt-result-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.receipt-result-table th:last-child, .receipt-result-table td:last-child { text-align: right; }
.receipt-capture input[type="file"] { width: 100%; min-width: 0; }

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
    .sidebar { padding-inline: 14px; }
    .brand-lockup { width: 185px; }
    .content-shell { padding-inline: clamp(20px, 3vw, 38px); }
    .hero-card { gap: 20px; padding: 28px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .modal-grid { grid-template-columns: 1fr; }
    .household-grid, .space-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .purpose-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { display: block; height: 100svh; padding-bottom: calc(70px + env(safe-area-inset-bottom)); overflow: hidden; }
    .sidebar { position: fixed; z-index: 50; inset: auto 0 0; width: 100%; height: calc(68px + env(safe-area-inset-bottom)); padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(23,42,58,.07); }
    .sidebar .brand, .sidebar-tip, .sidebar-footer { display: none; }
    .sidebar-inner { display: block; }
    .primary-nav { display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; margin: 0; }
    .primary-nav a { min-width: 0; min-height: 54px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px; font-size: 9px; border-radius: 10px; }
    .primary-nav svg { width: 19px; }
    .ai-pill { display: none; }
    .topbar { height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; background: rgba(255,255,255,.94); }
    .main-shell { height: 100%; grid-template-rows: calc(68px + env(safe-area-inset-top)) minmax(0, 1fr); }
    .mobile-brand { display: block; }
    .mobile-brand .brand-lockup { width: 150px; }
    .topbar-trip { display: none; }
    .profile-chip div { display: none; }
    .topbar-actions { gap: 10px; }
    .content-shell { padding: 0 18px; }
    .content-scroll { padding: 25px 0 24px; scrollbar-gutter: auto; }
    .hero-card { grid-template-columns: 1fr; padding: 25px; }
    .hero-amount { padding: 17px; }
    .dashboard-grid, .scan-grid { grid-template-columns: 1fr; }
    .purpose-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .receipt-preview { min-height: 500px; }
    .legal-footer { row-gap: 10px; }
}

@media (max-width: 640px) {
    .topbar { padding-inline: 12px; }
    .mobile-brand .brand-lockup { width: clamp(118px, 36vw, 145px); }
    .topbar-actions { gap: 7px; }
    .topbar .icon-button, .topbar .profile-chip > span { width: 36px; height: 36px; }
    .signout-button { min-height: 38px; padding-inline: 10px; font-size: 11px; }
    .content-shell { padding: 0 12px; }
    .content-scroll { padding: 20px 0 20px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading > .button, .page-heading > .heading-actions { width: 100%; }
    .page-heading > .button, .heading-actions .button { flex: 1 1 auto; }
    .page-heading h1 { font-size: clamp(25px, 8vw, 32px); }
    .page-heading p { font-size: 13px; line-height: 1.55; }
    .panel, .household-card, .space-card { padding: 17px; border-radius: 15px; }
    .panel-header { align-items: flex-start; }
    .panel-header > div { min-width: 0; }
    .hero-card { min-height: 0; padding: 21px 18px; border-radius: 18px; }
    .hero-card h1 { font-size: clamp(27px, 9vw, 36px); letter-spacing: -1px; }
    .hero-card p { font-size: 13px; }
    .hero-amount strong { font-size: 27px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settlement-summary, .household-grid, .space-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; }
    .hero-actions .button { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field.full { grid-column: auto; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .button { width: 100%; }
    .member-editor-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 39px; gap: 8px; padding: 12px 0; }
    .member-editor-row > :first-child { grid-column: 1 / -1; }
    .member-editor-row .icon-button { width: 39px; height: 39px; }
    .review-footer { align-items: stretch; flex-direction: column; }
    .settlement-route { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
    .settlement-route > strong { grid-column: 1 / -1; padding-top: 9px; text-align: center; border-top: 1px solid #EDF1F0; }
    .route-party { align-items: flex-start; flex-direction: column; gap: 6px; }
    .route-party .avatar { width: 34px; height: 34px; }
    .purpose-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fx-flow { grid-template-columns: 1fr; }
    .fx-flow > span { transform: rotate(90deg); justify-self: center; }
    .fx-controls, .currency-actions { align-items: stretch; flex-direction: column; }
    .fx-controls .field { max-width: none; }
    .authority-options { grid-template-columns: 1fr; }
    .explanation-banner { padding: 14px; }
    .lock-badge { white-space: normal; text-align: right; }
    .allocation-preview-row { align-items: flex-start; gap: 12px; }
    .allocation-preview-row > span { min-width: 0; overflow-wrap: anywhere; }
    .allocation-preview-row > strong { flex: 0 0 auto; text-align: right; }
    .table-panel { overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
    .expense-table, .expense-table tbody, .expense-table tr, .expense-table td { display: block; width: 100%; }
    .expense-table thead { display: none; }
    .expense-table tbody { display: grid; gap: 12px; }
    .expense-table tr { padding: 8px 15px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 24px rgba(23,42,58,.04); }
    .expense-table td { display: grid; grid-template-columns: minmax(92px, .38fr) minmax(0, 1fr); gap: 12px; padding: 10px 0; text-align: right; border-top: 1px solid #EDF1F0; overflow-wrap: anywhere; }
    .expense-table td:first-child { border-top: 0; }
    .expense-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
    .expense-table td:last-child { text-align: right; }
    .receipt-facts { grid-template-columns: 1fr 1fr; }
    .receipt-result-table th, .receipt-result-table td { padding-inline: 8px; }
    .receipt-history-item { align-items: flex-start; flex-direction: column; gap: 8px; }
    .receipt-history-item > span:last-child { align-items: flex-start; text-align: left; }
    .status-row { align-items: flex-start; gap: 12px; }
    .content-shell > .legal-footer { justify-content: center; text-align: center; }
    .content-shell > .legal-footer span { flex-basis: 100%; margin: 0; }
    #blazor-error-ui { right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 10px; }
}

@media (max-width: 380px) {
    .topbar .profile-chip { display: none; }
    .signout-button { padding-inline: 8px; }
    .metric-grid { grid-template-columns: 1fr; }
    .purpose-picker { gap: 8px; }
    .purpose-option { padding: 11px; }
    .receipt-facts { grid-template-columns: 1fr; }
    .expense-table td { grid-template-columns: 82px minmax(0, 1fr); }
}
.auth-layout { width: 100%; height: 100svh; min-height: 100svh; display: grid; grid-template-columns: minmax(430px, .9fr) minmax(520px, 1.1fr); overflow: hidden; background: var(--surface); }
.auth-story { height: 100svh; min-height: 0; display: flex; flex-direction: column; padding: 42px clamp(36px, 5vw, 78px); overflow: hidden; position: relative; color: #fff; background: var(--teal); }
.auth-story::after { content: ""; position: absolute; width: 410px; height: 410px; right: -210px; bottom: -145px; border: 70px solid rgba(255,255,255,.055); border-radius: 50%; }
.auth-story-brand { width: 218px; flex: 0 0 auto; padding: 10px 13px; z-index: 1; background: #fff; border-radius: 13px; }
.auth-story-brand img, .auth-mobile-brand img { display: block; width: 100%; height: auto; }
.auth-story-copy { max-width: 590px; margin-top: clamp(38px, 6vh, 72px); z-index: 1; }
.auth-kicker { display: block; margin-bottom: 13px; color: var(--mint); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.auth-story .auth-kicker { color: #8CE0D5; }
.auth-story h1 { margin-bottom: 20px; color: #fff; font-size: clamp(34px, 4vw, 54px); line-height: 1.08; letter-spacing: -2px; }
.auth-story-copy p { max-width: 560px; color: #D4E6EA; font-size: 15px; line-height: 1.75; }
.auth-portion-visual { width: min(470px, 100%); height: 170px; flex: 0 0 auto; display: grid; grid-template-columns: 1.5fr 1fr .72fr; gap: 12px; align-items: end; margin-top: auto; position: relative; z-index: 1; }
.auth-portion { min-height: 100px; display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; border: 1px solid rgba(255,255,255,.14); border-radius: 22px 22px 8px 8px; }
.auth-portion span { font: 800 30px "Manrope"; }
.auth-portion small { margin-top: 4px; color: rgba(255,255,255,.72); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.auth-portion-family { min-height: 170px; background: #147083; }
.auth-portion-couple { min-height: 128px; background: var(--mint); }
.auth-portion-solo { min-height: 94px; background: var(--amber); }
.auth-portion-visual img { width: 74px; height: 74px; position: absolute; right: 16px; top: -32px; padding: 10px; background: #fff; border-radius: 22px; box-shadow: 0 12px 26px rgba(0,0,0,.2); }
.auth-story-note { margin: 16px 0 0; z-index: 1; color: #BBD5DA; font-size: 11px; }
.auth-form-side { height: 100svh; min-height: 0; display: grid; place-items: center; padding: clamp(14px, 2.5vh, 24px) clamp(28px, 6vw, 92px); overflow: hidden; background: var(--ivory); }
.auth-form-wrap { width: min(560px, 100%); }
.auth-card { padding: 28px 30px; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.auth-mobile-brand { display: none; width: 190px; margin-bottom: 28px; }
.auth-card-header h1 { margin-bottom: 11px; font-size: clamp(27px, 3vw, 35px); letter-spacing: -1px; }
.auth-card-header p { margin-bottom: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.legal-consent { display: flex; gap: .65rem; align-items: flex-start; font-size: .78rem; line-height: 1.55; }
.legal-consent input { width: 16px; height: 16px; flex: 0 0 auto; margin-top: .18rem; accent-color: var(--teal); }
.legal-consent a { color: var(--teal); font-weight: 700; }
.auth-consent { padding: 11px 12px; background: #F5F8F7; border: 1px solid #E1E9E7; border-radius: 11px; }
.google-control { width: 100%; min-height: 44px; }
.google-button-shell { position: relative; width: 100%; height: 44px; overflow: hidden; border-radius: 4px; }
.google-button-host { position: absolute; inset: 0; z-index: 2; width: 100%; height: 44px; display: block; overflow: hidden; opacity: 0; transition: opacity .14s ease-out; }
.google-button-shell.google-button-ready .google-button-host { opacity: 1; }
.google-button-skeleton { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 14px; background: #fff; border: 1px solid #D7DCE0; border-radius: 4px; transition: opacity .14s ease-out; pointer-events: none; }
.google-button-shell.google-button-ready .google-button-skeleton { opacity: 0; }
.google-button-skeleton-icon { width: 18px; height: 18px; border-radius: 50%; background: #E8ECEF; }
.google-button-skeleton-line { width: 132px; height: 10px; border-radius: 999px; background: #E8ECEF; }
.auth-provider-placeholder { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 11px; color: #3C4650; background: #fff; border: 1px solid #D7DCE0; border-radius: 4px; font-size: 14px; font-weight: 600; }
.auth-provider-placeholder:disabled { opacity: .58; cursor: not-allowed; }
.google-mark { color: #4285F4; font: 700 18px Arial, sans-serif; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 15px 0; color: #839099; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: #E3E8E7; }
.auth-divider span { white-space: nowrap; }
.auth-field { display: grid; gap: 7px; margin-bottom: 14px; }
.auth-field label { color: #3D515D; font-size: 11px; font-weight: 700; }
.auth-field input { width: 100%; min-height: 46px; padding: 0 13px; color: var(--ink); background: #FBFCFC; border: 1px solid #D8E1DF; border-radius: 11px; outline: none; }
.auth-field select { width:100%; min-height:46px; padding:0 13px; color:var(--ink); background:#FBFCFC; border:1px solid #D8E1DF; border-radius:11px; }
.auth-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.auth-meta { display:flex; justify-content:flex-end; margin:-5px 0 13px; font-size:11px; color:var(--teal); font-weight:700; }
.password-hint { display:block; margin:-7px 0 13px; color:var(--muted); font-size:10px; line-height:1.4; }
.auth-card-wide { width:min(560px,100%); }
.auth-login-card { width: min(462px, 100%); margin-inline: auto; }
.auth-progress-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; background: rgba(247,245,239,.94); backdrop-filter: blur(5px); }
.auth-progress-panel { width: min(390px, 100%); display: grid; justify-items: center; gap: 11px; padding: 34px 30px; text-align: center; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 70px rgba(7,57,74,.18); }
.auth-progress-panel img { width: min(260px, 78vw); height: auto; margin-bottom: 4px; animation: logo-breathe 1.25s ease-in-out infinite; }
.auth-progress-panel strong { font-size: 16px; }
.auth-progress-panel small { color: var(--muted); font-size: 12px; }
.auth-progress-spinner { width: 28px; height: 28px; border: 3px solid #D7E8E5; border-top-color: var(--mint); border-radius: 50%; animation: auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-field input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(43,179,163,.12); }
.auth-submit { width: 100%; min-height: 46px; }
.registration-card { max-height: calc(100svh - 76px); padding: clamp(20px, 2.6vh, 28px) 30px; }
.registration-header h1 { margin-bottom: 7px; }
.registration-header p { margin-bottom: 14px; }
.registration-progress { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: start; margin: 0 auto 18px; }
.registration-step { min-width: 54px; display: grid; justify-items: center; gap: 5px; color: #8B989D; }
.registration-step span { width: 28px; height: 28px; display: grid; place-items: center; color: #6A797F; background: #EEF2F1; border: 1px solid #D8E1DF; border-radius: 50%; font-size: 11px; font-weight: 800; }
.registration-step small { font-size: 9px; font-weight: 700; }
.registration-step.active { color: var(--teal); }
.registration-step.active span { color: #fff; background: var(--teal); border-color: var(--teal); box-shadow: 0 0 0 4px rgba(43,179,163,.12); }
.registration-progress-line { height: 2px; margin-top: 13px; background: #DDE5E3; }
.registration-progress-line.active { background: var(--mint); }
.registration-back { margin: -4px 0 10px; padding: 0; color: var(--teal); background: transparent; border: 0; font-size: 11px; font-weight: 800; cursor: pointer; }
.registration-consent { margin: 2px 0 18px; }
.registration-consent .validation-message { margin-top: 5px; }
.registration-captcha-row { display: grid; grid-template-columns: minmax(100px, .7fr) auto auto; align-items: stretch; gap: 8px; }
.registration-captcha-row > input { min-width: 0; }
.registration-captcha-image { width: 190px; min-height: 46px; display: grid; place-items: center; overflow: hidden; color: var(--muted); background: var(--ivory); border: 1px solid #D8E1DF; border-radius: 11px; font-size: 10px; }
.registration-captcha-image img { width: 100%; height: 46px; display: block; object-fit: cover; }
.registration-captcha-refresh { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 11px; color: var(--teal); background: #fff; border: 1px solid #BFD6D2; border-radius: 11px; font-size: 11px; font-weight: 800; cursor: pointer; }
.registration-captcha-refresh:disabled { opacity: .55; cursor: wait; }
.registration-captcha > small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.registration-verify-card { max-width: 500px; }
.validation-message { color: #A33A31; font-size: 9px; line-height: 1.35; }
.auth-field > .validation-message { margin-top: -3px; }
.form-field > .validation-message { display: block; margin-top: 5px; font-size: 11px; }
input.invalid, select.invalid, textarea.invalid { border-color: #A33A31 !important; box-shadow: 0 0 0 2px rgba(163, 58, 49, .09); }
.auth-code-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; padding: 12px 13px; background: var(--soft-mint); border-radius: 11px; }
.auth-code-heading strong, .auth-code-heading small { display: block; }
.auth-code-heading strong { font-size: 11px; }
.auth-code-heading small { margin-top: 3px; color: #53716C; font-size: 9px; }
.auth-change-email { padding: 0; border: 0; background: transparent; cursor: pointer; }
.auth-resend { width: 100%; margin-top: 6px; color: var(--teal); background: transparent; }
.auth-message { margin: 16px 0 0; }
.auth-switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.auth-switch a { margin-left: 4px; color: var(--teal); font-weight: 800; text-decoration: none; }
.auth-form-wrap > .legal-footer { justify-content: center; gap: 12px; padding: 14px 0 0; font-size: 10px; }
.auth-form-wrap > .legal-footer span { flex-basis: 100%; margin: 0; text-align: center; }
.auth-form-wrap > .auth-login-card ~ .legal-footer { width: min(462px, 100%); margin-inline: auto; }
.form-message { color: #526875; }
.notification-panel{position:absolute;z-index:50;top:66px;right:150px;width:min(380px,calc(100vw - 28px));max-height:440px;overflow:auto;padding:14px;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}
.notification-item{width:100%;display:grid;gap:4px;padding:12px;text-align:left;background:transparent;border:0;border-top:1px solid var(--line);cursor:pointer}.notification-item span,.notification-item small{color:var(--muted)}
@media(max-width:900px){.notification-panel{position:fixed;top:72px;right:14px}}
.receipt-capture{display:grid;gap:1rem}.status-row{display:flex;justify-content:space-between;align-items:center}.status-pill{background:#e5f7f4;color:#075b58;padding:.35rem .75rem;border-radius:999px}.receipt-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:1rem}.receipt-facts div{padding:1rem;background:#f7faf9;border-radius:12px}.receipt-facts dt{font-size:.8rem;color:#65777f}.receipt-facts dd{font-weight:700;margin:.35rem 0 0}.review-warning{padding:.8rem 1rem;background:#fff3df;border-radius:10px;color:#74430b}
.legal-footer{display:flex;flex-wrap:wrap;gap:1rem;padding:2rem 0 1rem;color:#65777f;font-size:.84rem}.legal-footer span{margin-left:auto}.legal-page{max-width:850px;margin:2rem auto;padding:2rem;background:#fff;border-radius:18px;box-shadow:0 8px 30px rgba(11,70,84,.08)}.legal-page h2{margin-top:1.8rem}.legal-page p{line-height:1.7}.legal-meta{color:#65777f;font-size:.9rem}
.public-legal-shell { min-height: 100svh; padding: 24px clamp(18px, 5vw, 72px); background: var(--ivory); }
.public-legal-header { max-width: 850px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 auto; }
.public-legal-header img { display: block; width: 210px; height: auto; }
.public-legal-content .legal-page { margin-top: 24px; }
.public-legal-shell > .legal-footer { max-width: 850px; margin: 0 auto; }

@media (min-width: 1800px) {
    .auth-layout { grid-template-columns: minmax(0, 1fr) minmax(620px, .82fr); }
    .auth-story-copy { max-width: 680px; }
    .auth-form-side { padding-inline: clamp(70px, 7vw, 130px); }
}

@media (max-width: 1120px) and (min-width: 901px) {
    .auth-layout { grid-template-columns: minmax(360px, .8fr) minmax(500px, 1.2fr); }
    .auth-story { padding-inline: 32px; }
    .auth-story h1 { font-size: clamp(34px, 4vw, 45px); }
    .auth-form-side { padding-inline: clamp(24px, 4vw, 46px); }
    .auth-portion-visual { grid-template-columns: 1.25fr .9fr .7fr; }
}

@media (min-width: 901px) and (max-height: 760px) {
    .auth-story { padding-top: 28px; padding-bottom: 28px; }
    .auth-story-brand { width: 190px; }
    .auth-story-copy { margin-top: 26px; }
    .auth-story h1 { margin-bottom: 14px; font-size: clamp(34px, 3.3vw, 46px); line-height: 1.04; }
    .auth-story-copy p { font-size: 14px; line-height: 1.55; }
    .auth-portion-visual { height: 140px; }
    .auth-portion { min-height: 82px; padding: 16px; }
    .auth-portion-family { min-height: 140px; }
    .auth-portion-couple { min-height: 106px; }
    .auth-portion-visual img { width: 64px; height: 64px; top: -24px; }
    .auth-story-note { margin-top: 16px; }
}

@media (min-width: 901px) and (max-height: 620px) {
    .auth-story { padding-top: 18px; padding-bottom: 18px; }
    .auth-story-brand { width: 165px; padding: 7px 10px; }
    .auth-story-copy { margin-top: 15px; }
    .auth-story h1 { margin-bottom: 9px; font-size: clamp(28px, 3.2vw, 38px); }
    .auth-story-copy p { font-size: 12px; line-height: 1.4; }
    .auth-portion-visual { height: 96px; }
    .auth-portion { min-height: 62px; padding: 10px; }
    .auth-portion-family { min-height: 96px; }
    .auth-portion-couple { min-height: 76px; }
    .auth-portion-solo { min-height: 58px; }
    .auth-portion span { font-size: 22px; }
    .auth-portion-visual img { width: 48px; height: 48px; top: -17px; padding: 7px; border-radius: 15px; }
    .auth-story-note { margin-top: 8px; font-size: 9px; }
    .auth-form-side { padding-block: 8px; overflow-y: auto; }
    .auth-card { padding-block: 18px; }
    .registration-card { max-height: none; }
    .auth-card-header h1 { font-size: 25px; }
    .auth-card-header p { margin-bottom: 11px; }
    .auth-field { gap: 4px; margin-bottom: 9px; }
    .auth-field input, .auth-field select, .auth-submit { min-height: 40px; }
    .registration-progress { margin-bottom: 10px; }
    .auth-form-wrap > .legal-footer { padding-top: 7px; }
}

@media (max-width: 900px) {
    .auth-layout { height: auto; min-height: 100svh; min-height: 100dvh; display: block; overflow: visible; }
    .auth-story { display: none; }
    .auth-form-side { height: auto; min-height: 100svh; min-height: 100dvh; padding: clamp(14px, 3vh, 28px) 18px; overflow: visible; align-items: center; }
    .auth-form-wrap { width: min(560px, 100%); }
    .auth-card { padding: 20px 22px; }
    .auth-grid { grid-template-columns:1fr; gap:0; }
    .auth-mobile-brand { display: block; width: 158px; margin-bottom: 14px; }
    .auth-card-header h1 { margin-bottom: 8px; font-size: 26px; }
    .auth-card-header p { margin-bottom: 14px; line-height: 1.45; }
    .auth-switch { margin-top: 14px; }
    .auth-form-wrap > .legal-footer { padding-top: 10px; }
    .registration-card { max-height: none; padding: 18px 20px; }
    .registration-progress { margin-bottom: 12px; }
}

@media (max-width: 640px) {
    .auth-form-side { padding: 12px; }
    .auth-card { padding: 18px 16px; border-radius: 18px; }
    .auth-login-card { width: 100%; }
    .auth-mobile-brand { width: 146px; margin-bottom: 12px; }
    .auth-card-header h1 { font-size: clamp(24px, 8vw, 28px); letter-spacing: -.7px; }
    .auth-card-header p { font-size: 12px; }
    .auth-kicker { margin-bottom: 9px; font-size: 9px; }
    .auth-field input, .auth-field select { min-height: 44px; }
    .registration-progress { grid-template-columns: auto 1fr auto 1fr auto; }
    .registration-step { min-width: 46px; }
    .registration-step small { font-size: 8px; }
    .legal-consent { font-size: .72rem; }
    .registration-captcha-row { grid-template-columns: minmax(92px, .65fr) minmax(155px, 1fr) 44px; gap: 6px; }
    .registration-captcha-image { width: auto; }
    .registration-captcha-refresh { width: 44px; padding: 0; font-size: 18px; }
    .registration-captcha-refresh span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .auth-code-heading { align-items: flex-start; }
    .auth-form-wrap > .legal-footer { column-gap: 10px; row-gap: 8px; text-align: center; }
    .auth-form-wrap > .legal-footer a { white-space: nowrap; }
    .auth-progress-overlay { padding: 14px; }
    .auth-progress-panel { padding: 26px 18px; }
    .public-legal-shell { padding: 14px; }
    .public-legal-header { align-items: center; gap: 12px; }
    .public-legal-header img { width: clamp(135px, 42vw, 170px); }
    .public-legal-header .button { min-height: 39px; padding: 0 11px; font-size: 11px; white-space: nowrap; }
    .public-legal-content .legal-page { margin-top: 14px; padding: 20px 16px; border-radius: 15px; }
    .legal-page h1 { font-size: clamp(25px, 8vw, 34px); }
    .legal-page h2 { font-size: 19px; }
    .public-legal-shell > .legal-footer { justify-content: center; text-align: center; }
    .public-legal-shell > .legal-footer span { flex-basis: 100%; margin: 0; }
}

@media (max-width: 360px) {
    .auth-form-side { padding-inline: 8px; }
    .auth-card { padding-inline: 13px; }
    .auth-mobile-brand { width: 132px; }
    .registration-step { min-width: 40px; }
    .registration-step span { width: 25px; height: 25px; }
    .registration-progress-line { margin-top: 12px; }
    .registration-captcha-row { grid-template-columns: 1fr 1.55fr 42px; }
    .public-legal-header { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
