@font-face { font-family: "Outfit"; src: url("assets/fonts/outfit-variable-v1.ttf") format("truetype"); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("assets/fonts/fraunces-italic-variable-v1.ttf") format("truetype"); font-style: italic; font-weight: 100 900; font-display: swap; }
/* Morning Haze: sky #8fb8e0, cloud #bfd6ec, mist #e8eef3, ivory #f7efe2. */
:root[data-theme-transition="ripple"]::view-transition-old(root),
:root[data-theme-transition="ripple"]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-theme-transition="ripple"]::view-transition-old(root) { z-index: 1; }
:root[data-theme-transition="ripple"]::view-transition-new(root) { z-index: 2; }
:root[data-theme-transition="ripple"]::view-transition-image-pair(root) { isolation: isolate; }
:root[data-theme-transition="ripple"] *,
:root[data-theme-transition="ripple"] *::before,
:root[data-theme-transition="ripple"] *::after { transition: none !important; }
:root {
  --page-gutter: 32px;
  --font-body: "Outfit", sans-serif;
  --font-display: "Fraunces", serif;
  font-family: var(--font-body);
  color-scheme: light;
  font-synthesis: none;
  --haze-mist: #e8eef3; --haze-cloud: #bfd6ec; --haze-sky: #8fb8e0; --brand: #315b80; --brand-deep: #244763;
  --page: #8fb8e0; --page-tint: #f7efe2; --surface: #f7f9fbed; --surface-alt: #e8eef3; --field: #f8fafc;
  --ink: #1c2e40; --muted: #4c6073; --label: #304b63; --placeholder: #536a80;
  --line: #b4c6d6; --line-strong: #748b9f; --accent: #315b80; --accent-ink: #244763; --accent-soft: #d4e2ef; --accent-hover: #244763;
  --secondary: #e1ebf4; --secondary-hover: #cbddec; --header: #e8eef3ed; --nav-surface: #e8eef3; --tab-active: #244763; --tab-ink: #e8eef3;
  --ambient-a: #8fb8e070; --ambient-b: #bfd6ecc0; --focus: #244763; --success: #405f67; --backdrop: #1c2e4073; --shadow: 0 10px 30px #315b800c;
  background: var(--page); color: var(--ink);
}
:root[data-color-mode="dark"] {
  color-scheme: dark;
  --page: #15212d; --page-tint: #1c2b3a; --surface: #1e2e3ef0; --surface-alt: #26394c; --field: #152432;
  --ink: #e8eef3; --muted: #b5c8da; --label: #d5e1ec; --placeholder: #a8bdd0;
  --line: #41576c; --line-strong: #8098af; --accent: #a3c9ee; --accent-ink: #bfd6ec; --accent-soft: #2d465e; --accent-hover: #bfd6ec;
  --secondary: #273b4e; --secondary-hover: #344f68; --header: #15212df0; --nav-surface: #1e2e3e; --tab-active: #bfd6ec; --tab-ink: #15212d;
  --ambient-a: #315b801c; --ambient-b: #8fb8e00c; --focus: #bfd6ec; --success: #bfd6d7; --backdrop: #0c1520b8; --shadow: 0 10px 30px #00000020;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.55; background: linear-gradient(180deg, #8fb8e0 0%, #bfd6ec 33%, #e8eef3 67%, #f7efe2 100%); background-attachment: fixed; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-color: transparent; }
h1, h2, p { margin: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app-header { display: flex; align-items: center; gap: 28px; min-height: 88px; padding: 14px max(32px, calc((100vw - 1296px) / 2)); position: relative; border-bottom: 1px solid var(--line); border-radius: 2px; background: var(--header); backdrop-filter: blur(16px); }
.app-header::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: linear-gradient(90deg, var(--haze-cloud), var(--haze-sky) 52%, var(--brand)); }
.brand { display: flex; flex-shrink: 0; }
.brand img { display: block; width: 144px; height: 52px; object-fit: contain; }
.brand .brand-dark, .icon-button .sun-icon { display: none; }
:root[data-color-mode="dark"] .brand .brand-light, :root[data-color-mode="dark"] .icon-button .moon-icon { display: none; }
:root[data-color-mode="dark"] .brand .brand-dark, :root[data-color-mode="dark"] .icon-button .sun-icon { display: block; }
.app-name { padding-left: 28px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 14px; font-weight: 500; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 46px; height: 46px; padding: 0; border: 1px solid var(--line); border-radius: 2px; color: var(--accent-ink); background: var(--secondary); transition: background .16s, border-color .16s; }
.icon-button svg { width: 21px; height: 21px; }
.icon-button:hover { background: var(--secondary-hover); border-color: var(--line-strong); }
.new-button, .new-button:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.new-button:hover { background: #244763; border-color: #244763; }
.icon-button::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 10px); right: 0; z-index: 10; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface); color: var(--ink); white-space: nowrap; font-size: 14px; box-shadow: var(--shadow); pointer-events: none; opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s; }
.icon-button:focus-visible::after { opacity: 1; transform: none; }
@media(hover:hover) { .icon-button:hover::after { opacity: 1; transform: none; } }
main { max-width: 1360px; margin: auto; padding: 0 32px 24px; }
.page-heading { display: grid; align-items: center; justify-content: center; justify-items: center; gap: 16px; padding: 18px 0 20px; text-align: center; }
h1 { font-size: clamp(24px, 2.2vw, 30px); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; }
.quote-heading { display: grid; justify-items: center; gap: 3px; width: fit-content; font-weight: 400; letter-spacing: normal; }
.heading-lead { color: var(--accent-ink); font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: .16em; text-transform: uppercase; }
.heading-main { display: flex; align-items: center; gap: 16px; }
.heading-word { position: relative; display: inline-block; padding: 0 3px 4px 0; color: var(--brand-deep); background: linear-gradient(110deg, var(--brand), var(--brand-deep) 75%, var(--ink)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-family: var(--font-display); font-style: italic; font-size: 44px; font-weight: 400; line-height: 1.05; letter-spacing: -.035em; }
.heading-word::after { content: ""; position: absolute; left: 1px; bottom: 0; width: 74%; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--haze-sky), transparent); }
.heading-dot { -webkit-text-fill-color: var(--accent); }
.heading-spark { width: 27px; height: 27px; margin-top: -3px; color: var(--accent); stroke-width: 1.25; }
:root[data-color-mode="dark"] .heading-word { color: #e8eef3; background-image: linear-gradient(110deg, #e8eef3, #bfd6ec 70%, #a3c9ee); }
.save-state { max-width: 360px; color: var(--accent-ink); font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); align-items: start; gap: 32px; }
.editor { display: grid; gap: 16px; min-width: 0; }
.panel { padding: 18px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); box-shadow: var(--shadow); }
.panel,.share-panel { backdrop-filter: blur(14px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.section-title h2 { font-size: 16px; }
h2 { font-size: 18px; font-weight: 650; line-height: 1.4; letter-spacing: -.02em; }
.section-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); }
.section-icon svg { width: 16px; height: 16px; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 12px; }
.fields label { font-size: 12px; line-height: 18px; }
label { display: block; min-width: 0; font-size: 14px; font-weight: 600; color: var(--label); }
.wide { grid-column: 1 / -1; }
.optional { font-weight: 400; color: var(--muted); }
input, textarea, select { display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: 5px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 2px; background-color: var(--field); color: var(--ink); font-size: 16px; font-weight: 400; line-height: 1.35; transition: border-color .15s; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input[type=date] { width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 72px; height: 72px; }
#number { min-height: 44px; height: 44px; resize: none; font-family: var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: .025em; font-size: 14px; line-height: 1.45; }
.field-help { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 16px; }
.fields input[readonly], .fields textarea[readonly] { background: var(--surface-alt); color: var(--muted); }
select { appearance: none; padding-right: 39px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%234c6073' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
:root[data-color-mode="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23b5c8da' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); }
.help { margin: -2px 0 12px; max-width: 55ch; color: var(--muted); font-size: 12px; line-height: 1.5; }
.item-count { flex-shrink: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 2px; color: var(--accent-ink); background: var(--surface-alt); font-size: 12px; white-space: nowrap; }
.item-row { margin-bottom: 12px; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-alt); }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px -4px 2px 0; }
.item-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.item-title label { color: var(--ink); font-size: 14px; }
.item-index { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 5px; border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.remove-item { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 12px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); }
.remove-item svg { width: 18px; height: 18px; }
.remove-item:hover { background: var(--secondary-hover); }
.item-row textarea { min-height: 64px; height: 64px; margin-top: 0; padding: 10px; line-height: 1.35; }
.item-numbers { display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.3fr); align-items: start; gap: 10px; margin-top: 12px; }
.item-numbers label, .item-total>span { display: block; color: var(--label); font-size: 12px; font-weight: 600; line-height: 18px; }
.item-numbers input, .item-numbers select { min-height: 44px; height: 44px; margin-top: 4px; padding: 10px; }
.item-numbers select { padding-right: 28px; background-position: right 7px center; }
.item-total { min-width: 0; }
.item-total output { display: flex; align-items: center; justify-content: flex-end; min-height: 44px; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); font-size: 18px; font-weight: 650; line-height: 24px; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 13px 18px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--secondary); color: var(--accent-ink); font-size: 15px; font-weight: 600; line-height: 1.4; text-align: center; transition: background .16s, border-color .16s; }
.button svg { width: 20px; height: 20px; }
.button:hover { background: var(--secondary-hover); }
.button.primary { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 12px #315b8012; }
.button.primary:hover { background: #244763; border-color: #244763; }
.button.add { width: 100%; background: var(--accent-soft); color: var(--accent-ink); border-color: var(--line-strong); }
.button.add:hover { background: var(--secondary-hover); }
.editor .button { min-height: 44px; padding: 10px 12px; font-size: 14px; }
#items>.item-row:last-child { margin-bottom: 0; }
.add-row-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding-block: 4px; }
.add-row-action .button.add { width: auto; min-width: min(100%, 240px); max-width: 100%; padding-inline: 20px; background: transparent; border-style: dashed; }
.add-row-action .button.add:hover { background: var(--accent-soft); border-color: var(--accent); }
.add-row-action .button.add[aria-disabled=true] { opacity: .55; }
.row-error { margin: 0; color: var(--accent-ink); font-size: 14px; line-height: 1.4; }
.text-button { min-height: 40px; padding: 6px 0; border: 0; border-radius: 2px; color: var(--accent-ink); background: transparent; font-size: 14px; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
.preview-area { min-width: 0; position: sticky; top: 24px; }
.quote-paper { color-scheme: inherit; color: var(--preview-ink); min-height: 570px; padding: 28px; border: 1px solid var(--preview-line-strong); border-top: 3px solid var(--preview-brand); border-radius: 2px; background: var(--preview-background); box-shadow: 0 16px 36px #315b800a; overflow-wrap: anywhere; }
.paper-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--preview-line); }
.paper-header img { width: 142px; height: auto; }
.paper-title { min-width: 0; text-align: right; }
.paper-title h3 { margin: 0; color: var(--preview-accent); font-family: var(--font-display); font-style: italic; font-size: 31px; font-weight: 400; line-height: 1.15; letter-spacing: -.04em; }
.paper-title p { margin-top: 7px; color: var(--preview-muted); font-family: var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: .025em; font-size: 12px; font-weight: 400; line-height: 1.6; overflow-wrap: anywhere; }
.paper-client { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .75fr); align-items: start; gap: 16px; padding: 16px 0; }
.paper-label { margin-bottom: 7px; color: var(--preview-muted); font-size: 12px; font-weight: 600; }
.paper-client .paper-label { margin-bottom: 4px; font-size: 11px; }
.paper-client h4 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.paper-client p:not(.paper-label) { margin-top: 4px; color: var(--preview-muted); font-size: 13px; line-height: 1.4; }
.paper-date { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--preview-line); border-radius: 2px; background: var(--preview-panel); }
.paper-date>div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.paper-date dt { color: var(--preview-muted); font-size: 11px; line-height: 16px; }
.paper-date dd { margin: 0; color: var(--preview-accent); font-size: 13px; font-weight: 550; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 1.5; }
.paper-table th { width: 23%; padding: 12px 7px; background: var(--preview-table); color: var(--preview-accent); font-size: 12px; font-weight: 600; text-align: right; }
.paper-table th:first-child { width: 41%; padding-left: 12px; border-radius: 2px; text-align: left; }
.paper-table th:nth-child(2) { width: 13%; }
.paper-table th:last-child { padding-right: 12px; border-radius: 2px; }
.paper-table td { padding: 16px 7px; border-bottom: 1px solid var(--preview-line); text-align: right; vertical-align: top; font-variant-numeric: tabular-nums; }
.paper-table td:first-child { padding-left: 12px; font-weight: 550; text-align: left; }
.paper-table td:last-child { padding-right: 12px; font-weight: 600; }
.paper-unit { display: block; margin-top: 4px; color: var(--preview-muted); font-size: 12px; }
.paper-tax-note { margin-top: 13px; color: var(--preview-muted); font-size: 12px; }
.paper-summary { width: min(100%, 310px); margin: 25px 0 26px auto; }
.summary-line { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; margin: 11px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.summary-line span { color: var(--preview-muted); }
.summary-line strong { font-weight: 600; }
.summary-line.total { margin-top: 18px; padding: 18px; border-radius: 2px; background: var(--preview-total); color: var(--preview-total-ink); font-size: 22px; }
.summary-line.total span { color: var(--preview-total-ink); font-size: 15px; }
.paper-notes { border-top: 1px solid var(--preview-line); margin-top: 16px; padding-top: 20px; color: var(--preview-muted); font-size: 14px; white-space: pre-wrap; }
.paper-bottom { border-top: 1px solid var(--preview-line); margin-top: 20px; padding-top: 14px; color: var(--preview-muted); font-size: 12px; line-height: 1.45; }
.paper-contact-links { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; margin-top: 0px; }
.paper-contact-links a { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--preview-line); border-radius: 2px; background: var(--preview-panel); color: var(--preview-accent); text-decoration: none; }
.paper-contact-links a:hover { background: var(--preview-hover); border-color: var(--preview-line-strong); }
.paper-contact-links a:focus-visible { outline-color: var(--preview-brand); outline-offset: 2px; }
.paper-contact-links svg { width: 16px; height: 16px; }
.paper-link-text { flex: 1; min-width: 0; }
.paper-link-text small { display: block; color: var(--preview-muted); font-size: 11px; line-height: 16px; }
.paper-link-text strong { display: block; color: var(--preview-accent); font-size: 13px; font-weight: 600; line-height: 18px; }
.paper-website strong { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.paper-contact-links .contact-arrow { width: 14px; height: 14px; }
.share-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.share-panel .button { min-height: 44px; padding: 10px; font-size: 13px; gap: 7px; }
.share-panel .button svg { width: 18px; height: 18px; }
.share-panel>.primary { width: 100%; font-size: 14px; }
.export-format { border: 0; padding: 0; margin: 0 0 10px; text-align: left; min-width: 0; }
.export-format legend { padding: 0; margin-bottom: 7px; color: var(--label); font-size: 12px; font-weight: 600; }
.format-options { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 2px; background: var(--field); }
.format-options label { position: relative; cursor: pointer; }
.format-options input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; margin: 0; }
.format-options span { display: flex; align-items: center; justify-content: center; position: relative; gap: 7px; min-height: 44px; padding: 8px 10px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.format-options svg { width: 17px; height: 17px; }
.format-options input:checked+span { border-color: var(--line-strong); background: var(--accent-soft); color: var(--accent-ink); }
.format-options input:checked+span::after { content: ""; position: absolute; bottom: -1px; left: 12px; right: 12px; height: 2px; background: var(--accent); }
.format-options input:focus-visible+span { outline: 2px solid var(--focus); outline-offset: 3px; }
.format-options input:disabled+span { opacity: .5; cursor: default; }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.secondary-actions .button { background: var(--field); border-color: var(--line); }
.secondary-actions .button:hover { background: var(--secondary-hover); border-color: var(--line-strong); }
.share-help { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.action-status { margin-top: 8px; color: var(--success); font-size: 12px; line-height: 1.5; }
.action-status:empty { display: none; }
.error { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; text-align: left; }
.mobile-views { display: none; }
.connection-note { margin-top: 20px; padding: 14px 18px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
:root[data-color-mode="dark"] .quote-paper { box-shadow: 0 16px 36px #0002; }
:root[data-color-mode="dark"] .button.primary { border-color: #809fbc; }
:root[data-color-mode="dark"] .button.primary:hover,
:root[data-color-mode="dark"] .new-button:hover { background: #244763; border-color: #a3c9ee; }
dialog { width: calc(100% - 36px); max-width: 460px; padding: 28px; border: 1px solid var(--line-strong); border-top: 3px solid var(--brand); border-radius: 2px; background: var(--nav-surface); color: var(--ink); box-shadow: 0 25px 90px #1c2e4038; }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(6px); }
dialog h2 { font-size: 22px; }
dialog p { margin-top: 16px; color: var(--muted); font-size: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }
:root:has(#update-dialog[open]) { overflow: hidden; }
.app-update-dialog { width: calc(100% - 32px); max-width: 400px; max-height: calc(100dvh - 32px); padding: 24px; margin: auto; overflow-y: auto; }
.app-update-dialog[open] { animation: update-enter .22s ease-out; }
.app-update-dialog::backdrop { animation: update-backdrop .22s ease-out; }
.app-update-dialog[aria-busy=true] .update-icon svg { animation: update-spin 1.4s linear infinite; }
@keyframes update-enter { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes update-backdrop { from { opacity: 0; } to { opacity: 1; } }
@keyframes update-spin { to { transform: rotate(360deg); } }
.update-heading { display: flex; align-items: center; gap: 12px; }
.update-icon { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); }
.update-icon svg { width: 26px; height: 26px; }
.app-update-dialog h2 { font-size: 21px; line-height: 1.2; }
.app-update-dialog>p { font-size: 14px; line-height: 1.5; }
.app-update-dialog>.button { width: 100%; min-height: 46px; margin-top: 18px; padding: 11px 14px; font-size: 14px; }
.app-update-dialog .update-status { margin-top: 12px; color: var(--accent-ink); font-size: 12px; }
.noscript { position: fixed; bottom: 0; width: 100%; padding: 20px; background: var(--accent-soft); color: var(--accent-ink); text-align: center; }
@media(max-width:1200px) {
  .workspace { gap: 24px; }
  .quote-paper { padding: 22px; }
  .item-numbers { grid-template-columns: 1fr 1fr; }
}
@media(max-width:1020px) {
  html { scroll-padding-top: 72px; }
  .app-header { border-bottom: 0; }
  .app-header::after { display: none; }
  main:has(.workspace[data-view=preview]) .quote-heading { display: none; }
  main:has(.workspace[data-view=preview]) .page-heading { padding: 0; gap: 0; }
  main:has(.workspace[data-view=preview]) .save-state:not([hidden]) { margin-block: 14px; }
  main:has(.workspace[data-view=preview]) .mobile-views { margin-bottom: 18px; }
  .workspace { display: block; }
  .preview-area { position: static; }
  .mobile-views { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; position: sticky; top: 0; z-index: 20; margin: 0 calc(-1 * var(--page-gutter)); padding: 4px var(--page-gutter) 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 2px; background: var(--nav-surface); box-shadow: none; }
  .editor input,.editor textarea,.editor select,.preview-area { scroll-margin-top: 72px; }
  .mobile-views button { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.4; transition: background .15s, color .15s, border-color .15s; }
  .mobile-views button svg { width: 18px; height: 18px; }
  .mobile-views button.active { border-color: transparent; background: var(--surface-alt); color: var(--accent-ink); }
  .mobile-views button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--accent); }
  .mobile-views button:focus-visible { outline-offset: 1px; z-index: 1; }
  @media(hover:hover) { .mobile-views button:not(.active):hover { background: var(--secondary); color: var(--ink); } }
  .workspace[data-view=edit] .preview-area, .workspace[data-view=preview] .editor { display: none; }
  .quote-paper, .share-panel { max-width: 720px; margin-left: auto; margin-right: auto; }
  .item-numbers { grid-template-columns: minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.3fr); }
}
@media(max-width:700px) {
  :root { --page-gutter: 18px; }
  .app-header { min-height: 78px; padding: 12px 18px; gap: 18px; }
  .brand img { width: 128px; height: 46px; }
  .app-name { display: none; }
  .header-actions { gap: 8px; }
  .icon-button { width: 44px; height: 44px; }
  main { padding: 0 18px 20px; }
  .page-heading { display: grid; gap: 6px; padding: 14px 0 16px; }
  .heading-word { font-size: 38px; }
  .heading-main { gap: 12px; }
  .heading-spark { width: 24px; height: 24px; }
  h1 { font-size: 24px; }
  #number { min-height: 64px; height: 64px; }
  .panel { padding: 16px; }
  .item-count { padding: 4px 7px; font-size: 12px; }
  .item-numbers { grid-template-columns: 1fr 1fr; }
  .quote-paper { padding: 24px; }
  .paper-header img { width: 122px; }
  .paper-title h3 { font-size: 28px; }
  .paper-client { grid-template-columns: 1fr; gap: 12px; }
  .paper-date { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .paper-date>div { display: block; }
  .paper-date>div+div { padding-left: 12px; border-left: 1px solid var(--preview-line); }
  .paper-date dt { margin-bottom: 3px; }
  .paper-table, .paper-table tbody { display: block; }
  .paper-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .paper-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border: 1px solid var(--preview-line); border-radius: 2px; background: var(--preview-panel); padding: 17px; margin-bottom: 12px; }
  .paper-table td, .paper-table td:first-child, .paper-table td:last-child { border: 0; padding: 0; font-size: 15px; font-weight: 400; text-align: left; }
  .paper-table td:first-child { grid-column: 1 / -1; font-size: 16px; font-weight: 600; line-height: 1.45; }
  .paper-table td:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--preview-muted); font-size: 12px; font-weight: 400; }
  .paper-table td:last-child { display: flex; align-items: baseline; justify-content: space-between; grid-column: 1 / -1; gap: 14px; border-top: 1px solid var(--preview-line); padding-top: 12px; color: var(--preview-accent); font-size: 17px; font-weight: 650; }
  .paper-table td:last-child::before { font-size: 13px; }
  .paper-unit { display: inline; margin-left: 4px; font-size: 14px; }
  .paper-tax-note { font-size: 13px; }
  .paper-summary { width: 100%; }
  .summary-line { font-size: 15px; }
  .summary-line.total { font-size: 23px; }
  .paper-contact-links { grid-template-columns: 1fr; }
}
@media(max-width:400px) {
  :root { --page-gutter: 14px; }
  h1 { font-size: 22px; }
  .app-header { padding-inline: 14px; gap: 10px; }
  .brand img { width: 106px; }
  .header-actions { gap: 6px; }
  main { padding-inline: 14px; }
  .panel { padding: 14px; }
  .section-title h2 { font-size: 15px; }
  .section-heading { flex-wrap: wrap; }
  .item-count { margin-left: auto; padding: 3px 5px; font-size: 11px; }
  .item-row { padding: 10px 12px 12px; }
  .item-total output { font-size: 16px; }
  .quote-paper { padding: 20px 16px; }
  .paper-header { gap: 10px; }
  .paper-header img { width: 104px; }
  .paper-title h3 { font-size: 26px; }
  .paper-title p { font-size: 13px; }
  .summary-line.total { padding: 17px 14px; font-size: 21px; }
  .dialog-actions { flex-wrap: wrap; }
}
@media(max-width:350px) {
  .brand img { width: 96px; }
  .app-header { padding-inline: 12px; }
  .fields .emission-date, .fields label:has(#location) { grid-column: 1 / -1; }
  .paper-website strong { font-size: 12px; }
  .item-numbers label:has([data-field=price]), .item-total { grid-column: 1 / -1; }
  .item-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 6px 9px; border-radius: 2px; background: var(--accent-soft); }
  .item-total output { display: block; min-height: 0; margin-top: 0; padding: 0; border: 0; background: transparent; }
  .mobile-views button { padding-inline: 7px; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } .app-update-dialog, .app-update-dialog::backdrop, .app-update-dialog .update-icon svg { animation: none !important; } }

/* Center all quotation UI text, including wrapped validation messages. */
body,button,input,textarea,select,output { text-align: center; }
.app-header { justify-content: center; }
.header-actions { margin-left: 0; }
.section-heading { flex-direction: column; justify-content: center; }
.section-title { justify-content: center; }
.item-count { margin-inline: 0; }
.item-top { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; margin-inline: 0; gap: 0; }
.item-title { grid-column: 2; justify-content: center; }
.remove-item { grid-column: 3; }
.help { margin-inline: auto; }
select,.item-numbers select { padding-inline: 28px; text-align-last: center; }
.item-total output { justify-content: center; text-align: center; }
.export-format,.error { text-align: center; }
.export-format legend { margin-inline: auto; }
.dialog-actions { justify-content: center; }
.remove-dialog { max-width: 420px; max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow-y: auto; }
:root:has(#remove-dialog[open]) { overflow: hidden; }
.remove-dialog-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 16px; border: 1px solid var(--line); border-radius: 2px; background: var(--accent-soft); color: var(--accent-ink); }
.remove-dialog-icon svg { width: 24px; height: 24px; }
.remove-dialog h2 { font-size: 22px; line-height: 1.25; }
.remove-dialog p { margin-top: 8px; font-size: 14px; line-height: 1.5; }
.remove-row-summary { display: grid; gap: 6px; min-width: 0; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-alt); overflow-wrap: anywhere; }
.remove-row-summary span { color: var(--muted); font-size: 12px; }
.remove-row-summary strong { max-height: 100px; overflow-y: auto; white-space: pre-wrap; font-size: 15px; font-weight: 550; line-height: 1.45; }
.remove-dialog .dialog-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 10px; margin-top: 22px; }
.remove-dialog .button { min-height: 44px; padding: 11px 8px; font-size: 14px; }
.remove-dialog .remove-cancel { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.remove-dialog .remove-cancel:hover { background: var(--secondary-hover); }
.update-heading { flex-direction: column; justify-content: center; }
.paper-header { flex-direction: column; justify-content: center; }
.paper-title { text-align: center; }
.paper-header { gap: 0; padding-bottom: 16px; }
.paper-title { width: 100%; }
.paper-title .heading-main { justify-content: center; gap: 12px; }
.paper-title .paper-heading .heading-word {
  font-size: clamp(2rem, 4vw, 2.75rem); color: var(--preview-accent);
  background-image: linear-gradient(110deg, var(--preview-brand), var(--preview-accent) 65%, var(--preview-ink));
}
.paper-title .heading-word::after { left: 13%; }
.paper-title .heading-dot { -webkit-text-fill-color: var(--preview-brand); }
.paper-title .heading-spark { width: 24px; height: 24px; color: var(--preview-brand); }
.paper-date>div { flex-direction: column; align-items: center; justify-content: center; }
.paper-table th,.paper-table td,.paper-table th:first-child,.paper-table th:last-child,
.paper-table td:first-child,.paper-table td:last-child { text-align: center; padding-inline: 7px; }
.paper-summary { margin-inline: auto; }
.summary-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.paper-contact-links a { display: grid; grid-template-columns: 16px minmax(0, 1fr) 16px; justify-content: center; }
.paper-link-text { grid-column: 2; }
.paper-contact-links .contact-arrow { grid-column: 3; }
@media(max-width:700px) {
  .paper-table td,.paper-table td:first-child,.paper-table td:last-child { padding-inline: 0; }
  .paper-table td:last-child { flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
}
@media(max-width:350px) {
  .item-total { flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
}

/* The app preview follows its theme; downloaded PNG/PDF use their own white canvas. */
.quote-paper {
 --preview-background:#f8fafc;--preview-ink:#1c2e40;--preview-muted:#4c6073;
 --preview-accent:#244763;--preview-brand:#315b80;--preview-line:#bfcfdd;
 --preview-line-strong:#9fb4c7;--preview-panel:#e8eef3;--preview-table:#e1ebf4;
 --preview-hover:#d4e2ef;--preview-total:#315b80;--preview-total-ink:#fff;
}
:root[data-color-mode="dark"] .quote-paper {
 --preview-background:var(--nav-surface);--preview-ink:var(--ink);--preview-muted:var(--muted);
 --preview-accent:var(--accent-ink);--preview-brand:var(--accent);--preview-line:var(--line);
 --preview-line-strong:var(--line-strong);--preview-panel:var(--surface-alt);--preview-table:var(--accent-soft);
 --preview-hover:var(--secondary-hover);--preview-total:#315b80;--preview-total-ink:#e8eef3;
}

/* Row amounts stay quiet so the final total has the strongest emphasis. */
@media(max-width:700px) {
  .paper-table tbody tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0;
    padding: 0; margin-bottom: 12px; overflow: hidden;
    border-color: var(--preview-line-strong); background: var(--preview-background);
  }
  .paper-table tbody tr:last-child { margin-bottom: 0; }
  .paper-table td:first-child {
    padding: 12px 14px; border-bottom: 1px solid var(--preview-line);
    background: var(--preview-panel); font-size: 16px; font-weight: 600; line-height: 1.4;
  }
  .paper-table td:nth-child(2),.paper-table td:nth-child(3) {
    min-width: 0; padding: 10px 8px 12px;
    color: var(--preview-ink); font-size: 16px; font-weight: 550; line-height: 1.4;
  }
  .paper-table td:nth-child(2) { border-right: 1px solid var(--preview-line); }
  .paper-table td:not(:first-child)::before {
    margin-bottom: 4px; font-size: 12px; font-weight: 400; line-height: 1.3;
  }
  .paper-table .paper-unit { font-size: 13px; font-weight: 400; }
  .paper-table td:last-child {
    padding: 10px 14px 12px; border: 0; border-top: 1px solid var(--preview-line); gap: 2px;
    background: var(--preview-panel); color: var(--preview-ink);
    font-size: 18px; font-weight: 600; line-height: 1.3;
  }
  .paper-table td:last-child::before {
    margin: 0; color: var(--preview-muted); font-size: 12px; font-weight: 400;
  }
}

:root[data-color-mode="dark"] body { background: linear-gradient(180deg, #15212d 0%, #1c2b3a 33%, #233548 67%, #293b4b 100%); }
