/* Quote & Invoice — screens on top of the shared phone shell (shell.css). */

.navbar-leading { position: absolute; left: 4px; bottom: 0; height: var(--nav-h); display: flex; align-items: center; }
.back-btn { height: 44px; display: flex; align-items: center; gap: 0; padding: 0 8px 0 2px; color: var(--accent-text); font-size: 17px; border-radius: 10px; }
.back-btn .i { width: 28px; height: 28px; stroke-width: 2.2; }

/* Pushed editor slides over the tab screens and hides the tab bar */
.screen.pushed { z-index: 35; background: var(--aq-bg); transform: translateX(100%); transition: transform .38s var(--ease-sheet); }
.screen.pushed.on { transform: none; }
.app.editing .tabbar { transform: translateY(100%); transition: transform .3s var(--ease-out); }
.tabbar { transition: transform .3s var(--ease-out); }
.screen.pushed .scroll { padding-bottom: calc(var(--safe-bottom) + 180px); }
.screen.pushed .toolbar { bottom: 0; padding-bottom: calc(var(--safe-bottom) + 8px); }

/* KPIs */
.kpis { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.kpis > div { padding: 16px; }
.kpis > div + div { box-shadow: inset .5px 0 0 var(--aq-border); }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--aq-fg-muted); }
.kpi-value { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-sub { font-size: 13px; color: var(--aq-fg-muted); margin-top: 2px; }

/* Document rows */
.doc-row { width: 100%; min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left; }
.doc-row:active { background: var(--aq-surface-sunken); }
.doc-row .row-text { flex: 1; min-width: 0; }
.doc-trail { display: grid; justify-items: end; gap: 4px; }
.amount { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.chip-initials { width: 44px; height: 44px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 15px; font-weight: 700; letter-spacing: .01em; background: var(--aq-surface-sunken); color: var(--aq-fg-secondary); }
.chip-initials.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; }
.row-link .chip-initials { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.row-link.plain { color: var(--aq-fg); font-weight: 600; min-height: 60px; }
.row-link.plain .chev { color: var(--aq-fg-subtle); }

.status { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 700; letter-spacing: .01em; background: var(--aq-surface-sunken); color: var(--aq-fg-secondary); }
.status.sent { background: color-mix(in srgb, var(--aq-accent) 14%, transparent); color: var(--aq-accent-strong); }
.status.accepted, .status.paid { background: color-mix(in srgb, var(--aq-success) 16%, transparent); color: color-mix(in srgb, var(--aq-success) 70%, var(--aq-fg)); }
.status.overdue { background: color-mix(in srgb, var(--aq-error) 14%, transparent); color: color-mix(in srgb, var(--aq-error) 80%, var(--aq-fg)); }

/* Editor hero */
.doc-hero { padding: 4px 4px 8px; }
.doc-kind { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--aq-fg-muted); }
.doc-total { font-size: 40px; line-height: 48px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.doc-meta { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--aq-fg-muted); margin-top: 4px; }

/* Item rows */
.item-row { width: 100%; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; text-align: left; }
.item-row:active { background: var(--aq-surface-sunken); }
.item-row .row-text { flex: 1; min-width: 0; }
.item-row .chev { width: 18px; height: 18px; color: var(--aq-fg-subtle); }
#ed-items > li + li::before, #client-list > li + li::before, #doc-list > li + li::before, #ci-docs > li + li::before, #client-pick > li + li::before { left: 16px; }
#doc-list > li + li::before, #client-list > li + li::before { left: 72px; }
.add-row { min-height: 52px; font-weight: 600; }
.add-row .i { width: 22px; height: 22px; }

/* Forms as grouped rows */
.form-group { padding: 0; }
.form-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 16px; position: relative; font-size: 17px; }
.form-row + .form-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--aq-border); }
.form-row > span:first-child { flex: none; }
.form-row input, .form-row textarea { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--aq-fg); text-align: right; height: 40px; }
.form-row input[type="date"] { flex: none; text-align: right; color: var(--aq-accent-strong); font-weight: 500; }
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--aq-fg-placeholder); }
.form-row.stack { flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px; }
.form-row.stack > span:first-child { font-size: 13px; font-weight: 600; color: var(--aq-fg-muted); }
.form-row.stack input, .form-row.stack textarea { text-align: left; height: auto; min-height: 28px; resize: none; line-height: 22px; }
.money-in { display: flex; align-items: center; gap: 2px; color: var(--aq-fg-muted); }
.money-in input { width: 120px; flex: none; font-variant-numeric: tabular-nums; }

.stepper { display: flex; align-items: center; background: var(--aq-surface-sunken); border-radius: 10px; }
.stepper button { width: 44px; height: 36px; font-size: 22px; line-height: 1; color: var(--accent-text); border-radius: 10px; }
.stepper button:active { background: var(--aq-grey-200); }
.stepper button:disabled { color: var(--aq-fg-placeholder); }
.stepper output { min-width: 44px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Totals */
.totals { margin-top: 24px; padding: 8px 16px; }
.t-row { display: flex; justify-content: space-between; min-height: 40px; align-items: center; font-size: 17px; color: var(--aq-fg-secondary); font-variant-numeric: tabular-nums; }
.t-total { color: var(--aq-fg); font-weight: 700; font-size: 20px; border-top: .5px solid var(--aq-border); margin-top: 4px; padding-top: 4px; min-height: 52px; }

.line-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0; font-size: 17px; color: var(--aq-fg-secondary); font-variant-numeric: tabular-nums; }
.line-total strong { color: var(--aq-fg); font-size: 22px; letter-spacing: -.02em; }
.field-error { color: var(--danger-text); font-size: 13px; padding: 8px 16px 0; }
.field-error[hidden] { display: none; }
.danger-text { color: var(--danger-text); }
.danger-text:active { background: color-mix(in srgb, var(--aq-error) 10%, transparent); }
.btn-tonal { background: color-mix(in srgb, var(--aq-accent) 12%, transparent); color: var(--aq-accent-strong); }
.sheet-actions.two { grid-template-columns: 1fr 1.6fr; gap: 12px; }
body.aq-dark .sheet .form-group { background: var(--aq-surface-overlay); }

/* Paper preview (always light, like real paper) */
.paper {
  background: #FFFFFF; color: #191F28; border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(15,23,32,.12);
  padding: 24px 20px; font-size: 12px; line-height: 17px;
}
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pp-biz { font-size: 15px; font-weight: 700; }
.pp-muted { color: #6B7684; }
.pp-kind { font-size: 20px; font-weight: 800; letter-spacing: -.02em; text-align: right; }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 16px; }
.pp-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8B95A1; margin-bottom: 2px; }
.pp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pp-table th { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #8B95A1; text-align: left; font-weight: 700; padding: 6px 0; border-bottom: 1px solid #E5E8EB; }
.pp-table td { padding: 8px 0; border-bottom: 1px solid #F2F4F6; vertical-align: top; }
.pp-table .r { text-align: right; }
.pp-totals { margin-left: auto; width: 62%; margin-top: 12px; font-variant-numeric: tabular-nums; }
.pp-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.pp-totals .pp-grand { font-size: 15px; font-weight: 800; border-top: 1.5px solid #191F28; margin-top: 6px; padding-top: 8px; }
.pp-note { margin-top: 20px; color: #4E5968; }
.pp-foot { margin-top: 20px; font-size: 10px; color: #8B95A1; border-top: 1px solid #F2F4F6; padding-top: 10px; }

.print-only { display: none; }
@media print {
  body { background: #fff !important; overflow: visible; }
  .stage { display: none !important; }
  .print-only { display: block; }
  .print-only .paper { box-shadow: none; border-radius: 0; padding: 0; font-size: 12pt; line-height: 1.45; }
  @page { margin: 18mm; }
}
.empty-row { padding: 20px 16px; font-size: 15px; color: var(--aq-fg-muted); text-align: center; }
.toast.over-toolbar { bottom: auto; top: calc(var(--safe-top) + var(--nav-h) + 4px); }
.item-row:disabled { opacity: 1; }
.form-row input:disabled, .form-row textarea:disabled { color: var(--aq-fg-secondary); -webkit-text-fill-color: currentColor; }
.group-label + .list.compact { margin-top: 0; }
#ed-items .add-row .i { margin: 0; }
.form-row input:focus-visible, .form-row textarea:focus-visible { outline: none; }


.date-row { cursor: pointer; }
.date-row input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-val { display: flex; align-items: center; gap: 2px; color: var(--aq-accent-strong); font-weight: 500; font-variant-numeric: tabular-nums; }
.date-val .chev { width: 18px; height: 18px; color: var(--aq-fg-subtle); }
.locked .date-val { color: var(--aq-fg-secondary); }
.locked .date-val .chev { display: none; }
.locked .date-row { cursor: default; }
.locked-val { font-weight: 600; color: var(--aq-fg-secondary); }
.locked-val[hidden], .stepper[hidden], .paid-banner[hidden] { display: none; }
.paid-banner { display: flex; align-items: center; gap: 12px; background: var(--aq-surface); border-radius: 16px; box-shadow: var(--aq-shadow-md); padding: 10px 8px 10px 12px; min-height: 64px; }
.paid-ico { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in srgb, var(--aq-success) 16%, transparent); color: color-mix(in srgb, var(--aq-success) 75%, var(--aq-fg)); flex: none; }
.paid-ico .i { width: 20px; height: 20px; stroke-width: 2.6; }
.paid-copy { flex: 1; display: grid; font-size: 13px; color: var(--aq-fg-muted); }
.paid-copy strong { font-size: 17px; color: var(--aq-fg); font-weight: 600; }
.chev-slot { width: 18px; height: 18px; flex: none; }
.status.draft { background: var(--aq-grey-200); }
body.aq-dark .status.draft { background: var(--aq-surface-strong); color: var(--aq-fg-strong); }
body.aq-dark .seg-thumb { background: var(--aq-grey-300); }
body.aq-dark .segmented button[aria-selected="true"] { color: var(--aq-fg); }
.sheet .sheet-head { padding-top: 0; }
#sheet-preview .paper { max-height: calc(100dvh - 280px); overflow-y: auto; }
@media (min-width: 600px) and (min-height: 700px) { #sheet-preview .paper { max-height: 560px; } }
.empty-docs { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 20px; }
.empty-docs .chip-initials { margin-bottom: 6px; color: var(--aq-accent-strong); background: color-mix(in srgb, var(--aq-accent) 12%, transparent); }
.empty-docs p:first-of-type { font-size: 17px; font-weight: 600; }
.doc-row .chev { width: 18px; height: 18px; color: var(--aq-fg-subtle); flex: none; }
.locked #ed-client .chev { visibility: hidden; }

.paid-banner { margin: 8px 0 0; box-shadow: var(--aq-shadow-sm); }
.status.invoiced { background: color-mix(in srgb, var(--aq-success) 16%, transparent); color: color-mix(in srgb, var(--aq-success) 70%, var(--aq-fg)); }
.amount.muted { color: var(--aq-fg-muted); font-weight: 500; }
#sheet-clientinfo .chip-initials.lg { width: 44px; height: 44px; border-radius: 13px; font-size: 15px; }
#sheet-clientinfo .stats div { text-align: left; padding-left: 16px; }
#client-pick .row-link[aria-pressed="true"] { background: color-mix(in srgb, var(--aq-accent) 7%, transparent); }
#client-pick .row-link:active { background: var(--aq-surface-sunken); }
body.aq-dark .chip-initials { background: var(--aq-surface-strong); color: var(--aq-fg-strong); }
body.aq-dark .status.draft { background: var(--aq-grey-300); color: var(--aq-fg); }
.locked .item-row { padding-right: 16px; }
.form-row[hidden] { display: none; }
.status.flash { animation: pill-pop .5s var(--ease-out); }
@keyframes pill-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.screen.pushed .toolbar { background: var(--aq-bg); box-shadow: 0 -.5px 0 var(--aq-border-strong); }
.money-in { background: var(--aq-surface-sunken); border-radius: 10px; padding: 0 10px; height: 38px; color: var(--aq-fg); font-weight: 500; }
.money-in input { width: 84px; height: 38px; }
.chip-initials { background: color-mix(in srgb, var(--aq-accent) 10%, var(--aq-surface)); color: var(--aq-accent-strong); }
body.aq-dark .chip-initials { background: color-mix(in srgb, var(--aq-accent) 18%, var(--aq-surface)); color: var(--aq-fg-strong); }
.amount.muted { color: var(--aq-fg); font-weight: 600; }
.attention { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--aq-surface); border-radius: var(--aq-radius-card); box-shadow: var(--aq-shadow-sm); padding: 12px 16px; margin-bottom: 16px; min-height: 64px; }
.attention[hidden] { display: none; }
.attention .att-ico { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--aq-error) 14%, transparent); color: color-mix(in srgb, var(--aq-error) 85%, var(--aq-fg)); font-weight: 800; font-size: 17px; }
.attention .att-copy { flex: 1; min-width: 0; }
.attention .att-copy strong { display: block; font-size: 15px; font-weight: 600; }
.attention .att-copy span { font-size: 13px; color: var(--aq-fg-muted); }
.attention .chev { width: 18px; height: 18px; color: var(--aq-fg-subtle); }
.kpi-sub .bad { color: color-mix(in srgb, var(--aq-error) 85%, var(--aq-fg)); font-weight: 600; }
#doc-groups .group-label:first-child { padding-top: 0; }
#doc-groups .group + .group-label { padding-top: 20px; }
.convert-hero { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 12px 0 8px; }
.convert-hero .chip-initials { margin-bottom: 8px; }
.cv-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.cv-sub { font-size: 15px; color: var(--aq-fg-muted); }
.doc-total.flash { animation: total-flash .6s var(--ease-out); }
@keyframes total-flash { 0% { color: var(--accent-text); transform: scale(1.03); transform-origin: left; } 100% { color: inherit; transform: none; } }
body.aq-dark .btn-primary:not(:disabled) { background: #2272EB; color: #FFFFFF; } /* saturated accent keeps white text AA in dark */
body.aq-dark .btn-tonal { background: color-mix(in srgb, var(--aq-accent) 22%, transparent); color: var(--aq-fg); }
body.aq-dark .segmented { background: var(--aq-surface-raised); box-shadow: inset 0 0 0 1px var(--aq-border); }
.item-row { padding-right: 16px; }
.fab { position: absolute; z-index: 25; right: 16px; bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px); height: 52px; padding: 0 20px 0 16px; border-radius: 26px; display: flex; align-items: center; gap: 6px; background: var(--aq-accent); color: var(--on-accent); font-size: 17px; font-weight: 600; box-shadow: 0 8px 20px -6px rgba(34, 114, 235, .55), var(--aq-shadow-md); }
.fab[hidden] { display: none; }
.fab .i { width: 22px; height: 22px; stroke-width: 2.2; }
.fab:active { transform: scale(.96); }
body.aq-dark .fab { background: #2272EB; color: #FFFFFF; }
.toast.over-toolbar { top: auto; bottom: calc(var(--safe-bottom) + 92px); }
.text-btn.quiet { color: var(--aq-fg-muted); font-size: 15px; }
.flash-row { animation: row-flash 1.2s ease-out; }
@keyframes row-flash { 0% { background: color-mix(in srgb, var(--aq-accent) 16%, transparent); } 100% { background: transparent; } }
.screen:not(.pushed) .scroll { padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 96px); }
.doc-trail { flex: none; }
.attention .att-ico .i { width: 22px; height: 22px; stroke-width: 2; }
.skel { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 0 16px; }
.skel i { display: block; border-radius: 8px; background: var(--aq-surface-sunken); animation: shimmer 1.2s ease-in-out infinite; }
.skel .s-av { width: 44px; height: 44px; border-radius: 13px; }
.skel .s-lines { flex: 1; display: grid; gap: 8px; }
@keyframes shimmer { 50% { opacity: .45; } }
.screen.pushed .toolbar { box-shadow: 0 -.5px 0 var(--aq-border-strong), 0 -16px 16px -4px var(--aq-bg); }
.doc-list .add-row { min-height: 52px; }
.sk-bar { display: inline-block; border-radius: 6px; background: var(--aq-surface-sunken); animation: shimmer 1.2s ease-in-out infinite; vertical-align: middle; }
#ed-items > li + li::before { left: 16px; }
#sheet-clientinfo .stats dd { font-size: 19px; }
#client-list .doc-row .chev { margin-left: auto; }
