:root {
  --primary: #014495;
  --primary-dark: #013776;
  --blue-soft: #eef6fc;
  --ink: #123f70;
  --muted: #315f86;
  --paper: #7bb7de;
  --card: #ffffff;
  --line: #b7d7ef;
  --success: #3f9b61;
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
.auth-pending body { visibility: hidden; }
body { max-width: 100%; margin: 0; overflow-x: hidden; background: radial-gradient(circle at top, rgba(255,255,255,.46), transparent 30%), linear-gradient(180deg,#a8d0ec 0%,var(--paper) 100%); color: var(--ink); font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; -webkit-font-smoothing: antialiased; }
button,input,textarea,select { font: inherit; }
button { color: inherit; }
.shell { width: min(1180px,calc(100% - 32px)); margin: 0 auto; padding-bottom: 104px; }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid rgba(1,68,149,.22); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(1,68,149,.2); font-family: Georgia,serif; font-size: 1.2rem; font-style: italic; }
.brand-logo { width: 40px; height: 40px; display: block; object-fit: contain; }
.status-pill { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid rgba(1,68,149,.28); border-radius: 999px; background: rgba(255,255,255,.38); color: var(--muted); font-size: .77rem; white-space: nowrap; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(63,155,97,.14); }
.status-pill.syncing i { background: #d19b26; box-shadow: 0 0 0 4px rgba(209,155,38,.15); }
.status-pill.sync-error i { background: #bd3636; box-shadow: 0 0 0 4px rgba(189,54,54,.14); }
.archive-link { min-height: 40px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary); color: white; font-size: .77rem; font-weight: 800; text-decoration: none; white-space: nowrap; box-shadow: 0 8px 18px rgba(1,68,149,.16); }
.logout-form { margin: 0; }
.local-mode .logout-form { display: none; }
.local-mode .status-pill { border-color: #d19b26; background: #fff5d9; color: #704d00; }
.local-mode .status-pill i { background: #d19b26; box-shadow: 0 0 0 4px rgba(209,155,38,.15); }
.logout-button { min-height: 40px; padding: 8px 11px; border: 1px solid rgba(1,68,149,.3); border-radius: 10px; background: rgba(255,255,255,.45); color: var(--primary); cursor: pointer; font-size: .72rem; font-weight: 800; }
.status-pill,.archive-link,.logout-button { height: 48px; min-height: 48px; border-radius: 10px; }
.hero { padding: 54px 0 32px; }
.eyebrow,.step { margin: 0 0 9px; color: var(--primary); font-size: .7rem; font-weight: 850; letter-spacing: .16em; }
.hero h1 { margin: 0; color: var(--primary); font-family: Georgia,"Times New Roman",serif; font-size: clamp(3.25rem,7vw,5.75rem); font-weight: 500; letter-spacing: -.055em; line-height: .92; }
.intro { max-width: 680px; margin: 22px 0 0; color: var(--muted); font-size: 1.03rem; line-height: 1.55; }
@media (min-width:901px) { .hero h1,.hero .intro { max-width: none; white-space: nowrap; } }
.builder-layout { min-width: 0; display: grid; grid-template-columns: minmax(0,1.08fr) minmax(390px,.92fr); align-items: start; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 34px rgba(1,68,149,.16); }
.editor { min-width: 0; padding: 30px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.section-heading h2,.document-title h2 { margin: 0; font-family: Georgia,"Times New Roman",serif; font-size: 1.7rem; font-weight: 500; letter-spacing: -.025em; }
.required-note { color: var(--muted); font-size: .72rem; }
.field-grid { display: grid; grid-template-columns: 1fr 110px; gap: 15px 12px; margin-top: 24px; }
.field-wide { grid-column: 1 / -1; }
.field-postcode { grid-column: 1; max-width: 150px; }
.field-city { grid-column: 2; }
.address-grid { grid-template-columns: 150px minmax(0,1fr) 110px; }
.address-grid .field-street { grid-column: 1 / 3; }
.address-grid .field-number { grid-column: 3; }
.address-grid .field-postcode { grid-column: 1; max-width: none; }
.address-grid .field-city { grid-column: 2 / 4; }
.trip-grid { grid-template-columns: 1fr 1fr; }
.trip-grid .field-wide { grid-column: 1 / -1; }
.field { min-width: 0; display: block; }
.field > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 780; letter-spacing: .07em; text-transform: uppercase; }
.field input,.field textarea,.field select { width: 100%; min-width: 0; padding: 13px 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fff; color: var(--ink); transition: border-color .18s,box-shadow .18s; }
.field input[type="date"] { width: 100%; max-width: 100%; min-width: 0; display: block; }
.field input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.field input::placeholder,.field textarea::placeholder { color: #83a1bc; }
.field input:focus,.field textarea:focus,.field select:focus { border-color: #2a6fbe; box-shadow: 0 0 0 3px rgba(1,68,149,.12); }
.mileage-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.mileage-grid input,.mileage-grid select { height: 52px; }
.mileage-grid select { padding-right: 42px; border-radius: 10px; -webkit-appearance: none; appearance: none; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 7 5 5 5-5' fill='none' stroke='%23014495' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 14px 14px; }
.mileage-custom[hidden] { display: none; }
.mileage-result { margin-top: 16px; padding: 14px 15px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--blue-soft); }
.mileage-result span { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.mileage-result strong { color: var(--primary); font-size: 1.05rem; }
.divider { height: 1px; margin: 30px 0; background: var(--line); }
.form-actions { margin-top: 28px; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; }
.form-actions > button { width: 100%; min-width: 0; justify-content: center; }
.form-actions .action-save,.form-actions .action-clear { grid-column: span 3; }
.form-actions #showPdfPreview,.form-actions .action-download,.form-actions .action-print { grid-column: span 2; }
.primary,.secondary { min-height: 48px; padding: 12px 16px; border-radius: 10px; cursor: pointer; font-weight: 800; }
.primary { min-width: 190px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 0; background: linear-gradient(180deg,var(--primary) 0%,var(--primary-dark) 100%); color: white; box-shadow: 0 10px 20px rgba(1,68,149,.24); }
.primary svg,.form-actions button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.secondary { border: 1px solid var(--line); background: var(--blue-soft); color: var(--primary); }
.form-hint { margin: 13px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; text-align: right; }
.section-intro { margin: 15px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.receipt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.upload-button { min-height: 78px; padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--blue-soft); color: var(--primary); cursor: pointer; font-size: .79rem; font-weight: 800; text-align: center; transition: border-color .18s,transform .18s; }
.upload-button:hover { border-color: var(--primary); transform: translateY(-1px); }
.drop-zone { transition: border-color .18s,background-color .18s,box-shadow .18s,transform .18s; }
.drop-zone.drag-over { border-color: var(--primary); background: #dceefe; box-shadow: inset 0 0 0 2px rgba(1,68,149,.14),0 8px 22px rgba(1,68,149,.12); transform: translateY(-2px); }
.drop-hint { display: none; color: var(--muted); font-size: .66rem; font-weight: 650; }
@media (hover:hover) and (pointer:fine) { .drop-hint { display: block; } }
.upload-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.drop-zone { color: white; background: linear-gradient(180deg,var(--primary) 0%,var(--primary-dark) 100%); border-color: var(--primary); box-shadow: 0 10px 20px rgba(1,68,149,.18); }
.drop-zone .drop-hint { color: rgba(255,255,255,.78); }
.privacy-note { margin: 11px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.privacy-note span { color: var(--success); }
.receipt-list { margin-top: 16px; border-top: 1px solid var(--line); }
.receipt-empty { margin: 0; padding: 17px 0 0; color: #7190aa; font-size: .78rem; }
.receipt-item { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.receipt-thumb { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: var(--blue-soft); color: var(--primary); font-size: .66rem; font-weight: 850; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.receipt-info { min-width: 0; }
.receipt-info strong,.receipt-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-info strong { font-size: .79rem; }
.receipt-info span { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.receipt-remove { min-height: 34px; padding: 7px 10px; border: 1px solid #e2aaaa; border-radius: 8px; background: #fff3f3; color: #9a2626; cursor: pointer; font-size: .67rem; font-weight: 800; }
.receipt-remove:disabled { opacity: .45; cursor: wait; }
.expense-editor { min-width: 0; margin-top: 22px; }
.expense-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.expense-heading strong { color: var(--primary); font-size: .84rem; }
.expense-heading span { color: var(--muted); font-size: .68rem; text-align: right; }
.expense-table-wrap { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.expense-table { width: 100%; min-width: 520px; border-collapse: collapse; background: white; }
.expense-table th,.expense-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.expense-table thead th { color: var(--muted); background: var(--blue-soft); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.expense-table tbody th { max-width: 145px; overflow: hidden; color: var(--muted); font-size: .7rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.expense-table input { width: 100%; min-width: 120px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); }
.expense-table input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,68,149,.1); }
.expense-table .amount-input { min-width: 96px; text-align: right; }
.expense-table tfoot th,.expense-table tfoot td { border-bottom: 0; background: #f8fbfe; color: var(--primary); font-size: .78rem; }
.expense-table tfoot th { text-align: right; }
.expense-table tfoot td { font-weight: 850; text-align: right; white-space: nowrap; }
.preview-wrap { position: sticky; top: 18px; }
.preview-label { min-height: 36px; display: flex; justify-content: space-between; align-items: center; padding: 0 5px; color: var(--primary); font-size: .67rem; font-weight: 850; letter-spacing: .14em; }
.preview-label button { display: none; border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: .75rem; font-weight: 750; letter-spacing: 0; }
.document { min-height: 670px; padding: 34px 34px 24px; display: flex; flex-direction: column; border-radius: 14px; color: #17334e; }
.document-main { min-height: 612px; display: flex; flex-direction: column; }
.document-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 22px; border-bottom: 2px solid var(--primary); }
.sender { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; line-height: 1.4; }
.sender.pending { color: #6687a3; }
.sender strong { color: var(--primary); font-size: .86rem; }
.document-logo { width: 46px; height: 46px; flex: 0 0 auto; display: block; object-fit: contain; }
.recipient-address { min-height: 112px; margin-top: 34px; display: flex; flex-direction: column; font-size: .8rem; line-height: 1.55; }
.recipient-address strong { margin-bottom: 4px; color: var(--primary); font-size: .65rem; letter-spacing: .11em; text-transform: uppercase; }
.recipient-address .empty { color: #839bb0; }
.document-title { margin-top: 25px; }
.document-title p { margin: 0 0 5px; color: var(--primary); font-size: .62rem; font-weight: 850; letter-spacing: .15em; }
.document-title h2 { font-size: 2rem; color: var(--primary); }
.document-details { margin: 26px 0 0; border-top: 1px solid var(--line); }
.document-details > div { display: grid; grid-template-columns: 128px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.document-details dt { color: var(--muted); font-size: .7rem; font-weight: 760; text-transform: uppercase; }
.document-details dd { margin: 0; font-size: .82rem; line-height: 1.45; white-space: pre-wrap; }
.document-placeholder { margin-top: 24px; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; background: var(--blue-soft); }
.document-placeholder span { color: var(--primary); font-size: .75rem; font-weight: 800; }
.document-placeholder p { margin: 6px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.document-costs { margin-top: 24px; }
.document-costs table { width: 100%; border-collapse: collapse; }
.document-costs th,.document-costs td { padding: 9px 7px; border-bottom: 1px solid var(--line); font-size: .7rem; text-align: left; }
.document-costs thead th { color: var(--muted); font-size: .59rem; letter-spacing: .09em; text-transform: uppercase; }
.document-costs th:first-child,.document-costs td:first-child { padding-left: 0; }
.document-costs th:last-child,.document-costs td:last-child { padding-right: 0; text-align: right; white-space: nowrap; }
.document-costs tfoot th,.document-costs tfoot td { padding-top: 12px; border-bottom: 0; color: var(--primary); font-weight: 850; }
.document-footer { margin-top: auto; padding-top: 18px; display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; border-top: 2px solid var(--primary); }
.document-footer div { display: flex; flex-direction: column; gap: 3px; }
.document-footer span { color: var(--muted); font-size: .6rem; font-weight: 800; letter-spacing: .12em; }
.document-footer strong { color: var(--primary); font-size: .72rem; letter-spacing: .03em; }
.receipt-document { margin-top: 30px; padding-top: 24px; border-top: 2px solid var(--primary); }
.receipt-document h2 { margin: 0 0 16px; color: var(--primary); font-family: Georgia,"Times New Roman",serif; font-size: 1.7rem; font-weight: 500; }
.receipt-sheet { display: grid; gap: 14px; margin-top: 14px; }
.receipt-sheet:first-of-type { margin-top: 0; }
.receipt-sheet.paired { grid-template-columns: 1fr 1fr; align-items: start; }
.receipt-page { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfe; text-align: center; }
.receipt-sheet .receipt-page { margin-top: 0; }
.receipt-page img { max-width: 100%; max-height: 430px; display: block; margin: 0 auto; object-fit: contain; }
.receipt-page span { display: block; margin-top: 8px; color: var(--muted); font-size: .66rem; }
.site-footer { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; min-height: 68px; padding: 18px 20px max(18px,env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; background: #59a2d1; color: var(--primary); font-size: .92rem; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 700; text-decoration: none; }
.footer-logo { width: auto; height: 18px; display: block; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 88px; max-width: calc(100% - 32px); padding: 12px 18px; transform: translate(-50%,20px); border-radius: 10px; background: #102d49; box-shadow: 0 10px 35px #0004; color: white; font-size: .86rem; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.preview-overlay[hidden] { display: none; }
.preview-overlay { position: fixed; z-index: 100; inset: 0; width: 100%; height: 100vh; height: 100dvh; padding: max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); display: flex; align-items: stretch; overflow: hidden; background: rgba(8,35,62,.74); overscroll-behavior: none; }
.preview-overlay-panel { width: min(100%,820px); min-height: 0; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
.preview-overlay-toolbar { z-index: 2; flex: 0 0 auto; min-height: 58px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 13px 13px 0 0; background: var(--primary); box-shadow: 0 8px 24px rgba(0,0,0,.2); color: white; }
.preview-overlay-toolbar h2 { margin: 0; font-family: Georgia,"Times New Roman",serif; font-size: 1.25rem; font-weight: 500; }
.preview-overlay-toolbar button { min-height: 38px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.55); border-radius: 8px; background: white; color: var(--primary); cursor: pointer; font-size: .75rem; font-weight: 850; }
.preview-overlay-content { min-height: 0; flex: 1 1 auto; padding: 18px 0 36px; display: flex; flex-direction: column; align-items: center; gap: 18px; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.preview-a4-wrap { position: relative; flex: 0 0 auto; }
.preview-a4-page { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; padding: 50px 54px 44px; overflow: hidden; transform-origin: top left; background: white; box-shadow: 0 18px 42px rgba(0,0,0,.3); color: #17334e; }
.preview-a4-page .document-main { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.preview-a4-page .receipt-sheet { width: 100%; height: 100%; margin: 0; align-items: center; justify-items: center; }
.preview-a4-page .receipt-sheet.paired { grid-template-columns: 1fr 1fr; gap: 38px; }
.preview-a4-page .receipt-page { width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; border-radius: 0; background: white; }
.preview-a4-page .receipt-page img { max-width: 100%; max-height: calc(100% - 28px); object-fit: contain; }
.preview-a4-page .receipt-page span { flex: 0 0 auto; margin-top: 9px; }
.preview-page-number { position: absolute; left: 0; width: 100%; color: white; font-size: .7rem; font-weight: 800; text-align: center; }
.preview-overlay-open { overflow: hidden; }
.archive-shell { min-height: 100vh; }
.archive-hero { padding-bottom: 40px; }
.archive-privacy { max-width: 680px; margin: 16px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.archive-privacy span { color: var(--success); }
.local-mode .archive-privacy span { color: #b47c0a; }
.archive-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.archive-card { padding: 25px; }
.archive-card h2,.archive-empty h2 { margin: 0; color: var(--primary); font-family: Georgia,"Times New Roman",serif; font-size: 1.55rem; font-weight: 500; }
.archive-meta { margin: 8px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.archive-purpose { min-height: 44px; margin: 18px 0; font-size: .86rem; line-height: 1.5; }
.archive-summary { padding: 13px 0; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.archive-summary strong { color: var(--primary); font-size: .9rem; }
.archive-open { width: 100%; min-width: 0; margin-top: 10px; text-decoration: none; }
.archive-card-actions { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 9px; margin-top: 10px; }
.archive-card-actions .archive-open { margin-top: 0; }
.archive-delete { min-height: 48px; padding: 10px 13px; border: 1px solid #d98f8f; border-radius: 10px; background: #fff1f1; color: #942828; cursor: pointer; font-size: .72rem; font-weight: 800; }
.archive-delete:disabled { cursor: wait; opacity: .55; }
.archive-duplicate { min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--blue-soft); color: var(--primary); cursor: pointer; font-size: .72rem; font-weight: 800; }
.archive-duplicate:disabled { cursor: wait; opacity: .55; }
.archive-year-card { display: flex; flex-direction: column; text-decoration: none; }
.archive-year-card .archive-summary { margin-top: auto; }
.archive-year-link { margin-top: 12px; color: var(--primary); font-size: .8rem; font-weight: 850; }
.archive-year-back { margin-top: 18px; display: inline-flex; color: var(--primary); font-size: .8rem; font-weight: 800; text-decoration: none; }
.archive-year-back[hidden] { display: none; }
.archive-empty { grid-column: 1 / -1; padding: 34px; }
.archive-empty p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%,460px); }
.login-card { padding: 36px; }
.login-brand { margin-bottom: 38px; display: flex; align-items: center; gap: 11px; color: var(--primary); font-weight: 850; }
.login-brand img { width: 43px; height: 43px; object-fit: contain; }
.login-card h1 { margin: 0; color: var(--primary); font-family: Georgia,"Times New Roman",serif; font-size: 3.3rem; font-weight: 500; letter-spacing: -.045em; }
.login-intro { margin: 14px 0 25px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.login-form { display: grid; gap: 16px; }
.remember-login { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); cursor: pointer; font-size: .76rem; line-height: 1.4; }
.remember-login input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.login-submit { width: 100%; min-width: 0; margin-top: 4px; justify-content: center; }
.login-submit:disabled { cursor: not-allowed; opacity: .45; }
.password-manager-note { margin: 19px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; line-height: 1.5; }
.security-warning,.login-error,.login-success { margin: 0 0 20px; padding: 14px; border-radius: 10px; font-size: .76rem; line-height: 1.45; }
.security-warning { border: 1px solid #d19b26; background: #fff5d9; color: #704d00; }
.security-warning strong,.security-warning span { display: block; }
.security-warning span { margin-top: 4px; }
.login-error { border: 1px solid #dc9292; background: #fff0f0; color: #8a2525; }
.login-success { border: 1px solid #86c49c; background: #eefaf2; color: #246b3d; }
.password-requirements { margin: -5px 0 2px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
:focus-visible { outline: 3px solid rgba(1,68,149,.25); outline-offset: 3px; }
@media (max-width:900px) { .builder-layout { grid-template-columns: 1fr; } .preview-wrap { position: static; } .preview-label { width: min(100%,430px); margin-right: auto; margin-left: auto; } .preview-label button { display: block; } .document { width: min(100%,430px); margin-right: auto; margin-left: auto; display: none; } .document.open { display: flex; } }
@media (max-width:650px) { .shell { width: min(100% - 20px,1180px); } .topbar { min-height: 66px; gap: 10px; } .brand { font-size: .94rem; } .brand-mark,.brand-logo { width: 36px; height: 36px; } .topbar-actions { gap: 6px; } .status-pill { display: none; } .local-mode .status-pill { display: flex; padding: 9px; font-size: 0; } .local-mode .status-pill::after { content: "Nur lokal"; font-size: .66rem; } .archive-link { padding: 8px 9px; font-size: .68rem; } .logout-button { padding: 8px; font-size: .66rem; } .hero { padding: 40px 4px 27px; } .hero h1 { font-size: clamp(3.15rem,16vw,4.7rem); } .intro { font-size: .95rem; } .editor { padding: 23px 18px; } .section-heading h2 { font-size: 1.52rem; } .required-note { display: none; } .field-grid,.trip-grid { width: 100%; max-width: 100%; min-width: 0; grid-template-columns: minmax(0,1fr) 92px; overflow: hidden; } .field-postcode { grid-column: 1; } .field-city { grid-column: 2; } .trip-grid .field { width: 100%; max-width: 100%; min-width: 0; grid-column: 1 / -1; overflow: hidden; contain: inline-size; } .trip-grid input[type="date"] { box-sizing: border-box; inline-size: 100% !important; width: 100% !important; min-inline-size: 0 !important; min-width: 0 !important; max-inline-size: 100% !important; max-width: 100% !important; -webkit-appearance: none; appearance: none; } .receipt-actions { grid-template-columns: 1fr; } .expense-heading { display: block; } .expense-heading span { display: block; margin-top: 4px; text-align: left; } .receipt-sheet.paired { grid-template-columns: 1fr; } .form-actions { grid-template-columns: 1fr; } .form-actions > button { grid-column: 1 !important; } .primary,.secondary { width: 100%; } .form-hint { text-align: left; } .document { min-height: 620px; padding: 24px 20px 20px; } .document-main { min-height: 576px; } .document-details > div { grid-template-columns: 1fr; gap: 5px; } .document-footer { grid-template-columns: 1fr; gap: 10px; } .archive-grid { grid-template-columns: 1fr; } .archive-card { padding: 22px 18px; } .login-page { padding: 12px; } .login-card { padding: 28px 22px; } }
@media (max-width:650px) { .hero h1 span { display: block; } }
@media (max-width:650px) { .drop-zone,.action-download { border: 1px solid var(--line); background: var(--blue-soft); color: var(--primary); box-shadow: none; } .drop-zone .drop-hint { color: var(--muted); } .camera-button { color: white; background: linear-gradient(180deg,var(--primary) 0%,var(--primary-dark) 100%); border-color: var(--primary); box-shadow: 0 10px 20px rgba(1,68,149,.18); } }
@media (max-width:650px) {
  .preview-overlay { display: block; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior-y: contain; }
  .preview-overlay-panel { min-height: 100%; overflow: visible; }
  .preview-overlay-toolbar { position: sticky; top: 0; }
  .preview-overlay-content { min-height: auto; flex: none; overflow: visible; overscroll-behavior: auto; touch-action: auto; }
}
@media (max-width:650px) { .address-grid .field-street { grid-column: 1; } .address-grid .field-number { grid-column: 2; } .address-grid .field-postcode { grid-column: 1; max-width: 150px; } .address-grid .field-city { grid-column: 2; } }
@media (max-width:650px) {
  .form-section,.receipt-list,.expense-editor,.expense-table-wrap { min-width: 0; max-width: 100%; }
  .mileage-grid .field { grid-column: 1 / -1; }
  .privacy-note,.form-hint { overflow-wrap: anywhere; }
  .expense-table-wrap { overflow: hidden; }
  .expense-table { width: 100%; min-width: 0; table-layout: fixed; }
  .expense-table thead { display: none; }
  .expense-table tbody,.expense-table tfoot,.expense-table tbody tr,.expense-table tbody th,.expense-table tbody td { display: block; width: 100%; }
  .expense-table tbody tr { padding: 12px; border-bottom: 1px solid var(--line); }
  .expense-table tbody tr:last-child { border-bottom: 0; }
  .expense-table tbody th { max-width: none; padding: 0 0 9px; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .expense-table tbody td { padding: 5px 0; border: 0; }
  .expense-table tbody td::before { display: block; margin-bottom: 4px; color: var(--muted); font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .expense-table tbody td:nth-of-type(1)::before { content: "Aussteller"; }
  .expense-table tbody td:nth-of-type(2)::before { content: "Endbetrag"; }
  .expense-table input,.expense-table .amount-input { width: 100%; min-width: 0; }
  .expense-table tfoot { display: block; width: 100%; }
  .expense-table tfoot tr { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
  .expense-table tfoot th,.expense-table tfoot td { width: auto; padding: 12px; }
  .archive-card-actions { grid-template-columns: 1fr 1fr; }
  .archive-card-actions .archive-open { grid-column: 1 / -1; }
}
@media (max-width:420px) { .brand span { display: none; } .topbar-actions { min-width: 0; } }
@media print {
  @page { size: A4; margin: 12mm; }
  html,body { overflow: visible; background: white; }
  .shell { width: auto; padding: 0; }
  .topbar,.hero,.editor,.preview-label,.site-footer,.toast,.preview-overlay { display: none !important; }
  .builder-layout { display: block; }
  .preview-wrap { position: static; }
  .document { width: 100%; min-height: 0; padding: 0; display: block !important; border: 0; border-radius: 0; box-shadow: none; }
  .document-main { width: 100%; height: 225mm; min-height: 0; display: flex; flex-direction: column; break-inside: avoid-page; page-break-inside: avoid; }
  .document-header { padding-bottom: 7mm; }
  .recipient-address { margin-top: 12mm; }
  .document-title { margin-top: 11mm; }
  .document-placeholder { display: none; }
  .document-footer { break-inside: avoid; page-break-inside: avoid; }
  .receipt-document { display: block !important; margin: 0; padding: 0; border: 0; }
  .receipt-document h2 { display: none; }
  .receipt-sheet { width: 100%; height: 225mm; margin: 0; padding: 0; overflow: hidden; align-items: center; justify-items: center; break-before: page; page-break-before: always; break-inside: avoid-page; page-break-inside: avoid; }
  .receipt-sheet.paired { grid-template-columns: 1fr 1fr; gap: 10mm; }
  .receipt-page { width: 100%; height: 225mm; max-height: 225mm; margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; border-radius: 0; background: white; break-inside: avoid-page; page-break-inside: avoid; }
  .receipt-sheet.paired .receipt-page img { max-height: 203mm; }
  .receipt-page img { max-width: 100%; max-height: 207mm; display: block; object-fit: contain; break-inside: avoid-page; page-break-inside: avoid; }
  .receipt-page span { flex: 0 0 auto; margin-top: 3mm; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
