/* MySmartInvoice 2 – area 'sales' styles (tokens only, see css/lumen.css). */

/* sub navigation inside "Verkauf" (Alle Belege · Artikel · Serienrechnungen) */
.sub-links { display: flex; gap: 4px; margin: -8px 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.sub-link { padding: 10px 12px; color: var(--text-3); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.sub-link:hover { color: var(--text); text-decoration: none; }
.sub-link.active { color: var(--text); border-bottom-color: var(--text); }

/* overdue hint */
.overdue-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius-lg); background: var(--err-bg); border: 1px solid color-mix(in srgb, var(--err) 22%, transparent); margin-bottom: 18px; flex-wrap: wrap; }
.overdue-bar .ob-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--err); flex: none; }
.overdue-bar .grow { min-width: 180px; } .overdue-bar b { display: block; } .overdue-bar span { color: var(--text-2); font-size: 14px; }

/* filter bar: search + status chips on one line; the kind filter is a tab row on the list card (two different questions, two looks) */
.sales-bar { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.sales-search { flex: 1 1 260px; max-width: 420px; }
.sales-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sales-status .sb-label { font-size: 13px; color: var(--text-3); font-weight: 500; }
.chip-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.type-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab { flex: none; padding: 13px 10px 11px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font: 600 14px/1.2 var(--font);
  color: var(--text-3); cursor: pointer; white-space: nowrap; }
.type-tab:hover { color: var(--text); }
.type-tab.on { color: var(--accent-text, var(--accent)); border-bottom-color: var(--accent); }
.sales-new { flex-wrap: wrap; }
.sales-status { min-width: 0; max-width: 100%; }
.sales-status .chips { min-width: 0; }
@media (max-width: 700px) { .sales-search { max-width: none; flex-basis: 100%; } .sales-status { flex: 1 1 100%; flex-wrap: nowrap; }
  .sales-status .chips { flex: 1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .sales-status .chips::-webkit-scrollbar { display: none; } }

/* list rows with type icon */
.sales-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
.r-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.r-ico .ico { width: 18px; height: 18px; }
.r-ico.t-invoice { background: var(--accent-50); color: var(--accent-text); }
.r-ico.t-offer { background: var(--violet-bg); color: var(--violet); }
.r-ico.t-dunning, .r-ico.t-cancellation { background: var(--err-bg); color: var(--err); }
.rowx .r-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.od-days { color: var(--err); }
.list-more { text-align: center; } .list-more .btn { margin: 10px; }
@media (max-width: 700px) { .sales-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px 14px; gap: 4px 10px; } .r-ico { width: 36px; height: 36px; } }

/* ---------- document editor ---------- */
.doc-page { display: flex; flex-direction: column; gap: 18px; }
.doc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc-head h1 { font-size: 26px; font-weight: 700; }
.doc-head .saved { margin-left: auto; color: var(--text-3); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 700px) { .doc-head h1 { font-size: 21px; } }
.cust-box { display: flex; align-items: center; gap: 12px; }
.cust-box .avatar { width: 40px; height: 40px; font-size: 14px; }
.cust-box .cb-txt { flex: 1; min-width: 0; } .cust-box .cb-txt b { display: block; } .cust-box .cb-txt span { color: var(--text-3); font-size: 14px; }
.combo-list .combo-new { color: var(--accent-text); font-weight: 600; }
.combo-list .combo-sub { color: var(--text-3); font-size: 13px; }
.combo-list button { flex-wrap: wrap; }

/* lines */
.line-head { display: grid; grid-template-columns: minmax(0, 1fr) 76px 108px 104px 84px 100px 36px; gap: 8px; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 0 2px 6px; }
.line-head span:nth-child(n+4) { text-align: right; }
.dline { display: grid; grid-template-columns: minmax(0, 1fr) 76px 108px 104px 84px 100px 36px; gap: 8px; align-items: start; padding: 14px 0; border-top: 1px solid var(--border); }
.dline:first-child { border-top: 0; }
.dline .lt { font-weight: 700; text-align: right; padding-top: 11px; font-variant-numeric: tabular-nums; }
.dline input.num-in { text-align: right; }
.dline select { padding: 0 6px; }
.dline .l-desc { grid-column: 1 / -1; }
.dline .add-desc { font-size: 13px; color: var(--accent-text); background: none; border: 0; padding: 4px 0 0; cursor: pointer; font-weight: 600; }
.dline .l-x { padding-top: 4px; }
.lab-m { display: none; }
@media (max-width: 760px) {
  .line-head { display: none; }
  .dline { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .dline > .l-name { grid-column: 1 / -1; }
  .dline .l-desc { grid-column: 1 / -1; }
  .dline .lt { grid-column: 1 / 3; text-align: left; padding-top: 4px; }
  .dline .l-x { grid-column: 3; justify-self: end; padding-top: 0; }
  .lab-m { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
}
.add-line { margin-top: 8px; }
.totals-box { display: flex; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 6px; }
.totals .muted-row { color: var(--text-3); font-size: 14px; }
.hints { display: flex; flex-direction: column; gap: 8px; }
.hint-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--text); font-size: 14px; }
.hint-row .ico { color: var(--warn); flex: none; margin-top: 1px; }
.hint-row.err { background: var(--err-bg); } .hint-row.err .ico { color: var(--err); }
.sticky-actions .saved-txt { margin-right: auto; color: var(--text-3); font-size: 13px; align-self: center; }

/* finalised view */
.doc-view-top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.doc-amount { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.doc-amount-sub { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.doc-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 20px; }
.doc-facts div span { display: block; color: var(--text-3); font-size: 13px; } .doc-facts div b { font-weight: 600; }
.view-lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.view-lines td { padding: 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.view-lines tr:last-child td { border-bottom: 0; }
.view-lines td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
.view-lines .ld { color: var(--text-3); font-size: 13px; white-space: pre-line; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.next-step .ns-txt span.xs { display: block; }
.next-step .ns-txt .small { display: block; }
.ok-step { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.ok-step .tile-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ok); }
.mini-chain { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.mini-chain a, .mini-chain span.cur { padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.mini-chain span.cur { background: var(--text); color: var(--surface); }
.mini-chain .sep { color: var(--text-3); }

/* signature */
.sig-pad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }
.sig-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sig-preview img { height: 64px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }

/* reminders */
.remind-rows { border: 1px solid var(--border); border-radius: var(--radius); max-height: 50vh; overflow-y: auto; }
.remind-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.remind-row:last-child { border-bottom: 0; }
.remind-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.remind-row .r-main b { display: block; } .remind-row .r-main span { color: var(--text-3); font-size: 13px; }
.remind-row .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* deal page */
.deal-sums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .deal-sums { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.timeline .tl-body a { color: var(--text); font-weight: 600; }
.timeline .tl-amt { float: right; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 10px; }

/* recurring */
.rec-form .form-grid { margin-bottom: 4px; }

/* action sheet ("Mehr") */
.action-list { display: flex; flex-direction: column; margin: -8px -4px; }
.action-item { display: flex; align-items: center; gap: 12px; padding: 13px 10px; border: 0; background: none; font: 500 15px/1.3 var(--font); color: var(--text); text-align: left; cursor: pointer; border-radius: var(--radius); }
.action-item:hover { background: var(--surface-3); }
.action-item .ico { color: var(--text-3); }
.action-item.danger { color: var(--err); } .action-item.danger .ico { color: var(--err); }
@media (max-width: 700px) { .sales-row .r-main span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } }
.sec-card > .sc-body > details.more:first-child { border-top: 0; margin-top: 0; }
.doc-amount-box { text-align: right; }
@media (max-width: 700px) {
  .doc-amount-box { text-align: left; width: 100%; }
  .doc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-actions .btn { flex: 1 1 auto; }
  .next-step .row { width: 100%; } .next-step .row .btn { flex: 1 1 auto; }
}

/* ---------- v2 sales, round 2: inline address, e-invoice, final invoice deductions, reminders ---------- */
@media (min-width: 901px) { .sub-links { display: none; } }   /* the sidebar shows the same sub-pages on desktop */
.cust-addr { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cust-addr > p { margin: 0 0 10px; }
.addr-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, 1.8fr); gap: 10px 12px; }
@media (max-width: 900px) { .addr-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } .addr-grid > :first-child, .addr-grid > :last-child { grid-column: 1 / -1; } }
.ef-badge { display: inline-flex !important; align-items: center; gap: 4px; margin-top: 4px; color: var(--accent-text) !important; }
.ef-badge .ico { width: 14px; height: 14px; }
.ef-ok { display: inline-flex; align-items: center; gap: 4px; } .ef-ok .ico { width: 16px; height: 16px; color: var(--ok); }
.totals .sub-grand { font-size: 15px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.totals .ded-row span:first-child { display: flex; flex-direction: column; }
.totals .ded-row small { font-size: 12px; color: var(--text-3); }
.law-list { margin: 0; padding-left: 18px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.remind-row .r-main span { display: block; }
.sk-check { padding: 10px 12px; border-radius: var(--radius); background: var(--ok-bg); }
.seg-wrap { flex-wrap: wrap; height: auto; }
.seg-wrap button { white-space: normal; text-align: center; }
.rec-sum { margin: -6px 0 14px; }
.ef-ok { white-space: nowrap; }

/* flow indicator on the document page: chain (Angebot → Rechnung → Bezahlt) + status of this document */
.doc-flow { display: grid; gap: 10px; padding: 14px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.flow-bar { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; }
.fl-cap { font-size: 13px; color: var(--text-3); }
.fl-track { display: flex; align-items: center; gap: 0; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.fl-track::-webkit-scrollbar { display: none; }
.fl-step { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--text-3); font-size: 13.5px; text-decoration: none; padding: 3px 4px; border-radius: 999px; }
a.fl-step:hover { color: var(--accent-text, var(--accent)); }
.fl-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); flex: none; }
.fl-dot svg { width: 14px; height: 14px; }
.fl-lbl { display: inline-flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.fl-lbl small { font-size: 11.5px; color: var(--text-3); }
.fl-line { flex: 1 0 18px; min-width: 18px; max-width: 64px; height: 2px; margin: 0 6px; background: var(--border); border-radius: 2px; }
.fl-step.is-done { color: var(--text-2); } .fl-step.is-done .fl-dot { background: var(--ok-bg); color: var(--ok); }
.fl-step.is-cur { color: var(--text); font-weight: 600; } .fl-step.is-cur .fl-dot { background: var(--accent); color: var(--accent-contrast); box-shadow: 0 0 0 4px var(--accent-50); }
.fl-step.is-skip { opacity: .55; } .fl-step.is-skip .fl-dot { background: transparent; border: 1.5px dashed var(--border-strong, var(--border)); } .fl-step.is-todo .fl-dot { background: transparent; border: 1.5px dashed var(--border-strong, var(--border)); }
.fl-step.is-cur.tone-ok .fl-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.fl-step.is-cur.tone-bad { color: var(--err); } .fl-step.is-cur.tone-bad .fl-dot { background: var(--err); color: #fff; box-shadow: 0 0 0 4px var(--err-bg); }
.fl-step.is-cur.tone-warn { color: var(--warn); } .fl-step.is-cur.tone-warn .fl-dot { background: var(--warning-fill, var(--warn)); color: #fff; box-shadow: 0 0 0 4px var(--warn-bg); }
.fl-step.is-cur.tone-muted .fl-dot { background: var(--text-3); box-shadow: none; }
.fl-step.is-done + .fl-line { background: var(--ok); opacity: .5; }
.doc-head .saved.is-ok { color: var(--ok); } .doc-head .saved.is-busy { color: var(--text-3); } .doc-head .saved.is-dirty { color: var(--text-3); }
.doc-head .num-link { font-size: 13px; }
@media (max-width: 700px) {
  .doc-flow { padding: 12px 14px; }
  .flow-bar { grid-template-columns: 1fr; gap: 6px; }
  .fl-track { flex-wrap: wrap; row-gap: 8px; }
  .fl-line { flex: 0 0 12px; min-width: 12px; margin: 0 4px; }
  .fl-step { font-size: 13px; }
}
.next-step .ns-btns { flex-wrap: wrap; } .next-step .ns-txt { min-width: 260px; }

/* ---------- review round 1 (27.10.2026): status card, progress panel, customer picker/form, lines, error summary ---------- */
/* page grid: content left, "Fortschritt" panel right (sticky); stacked below 1000px of page width */
.doc-page { container: docpage / inline-size; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.dg-top, .dg-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dg-top { margin-bottom: 18px; }
.doc-side { min-width: 0; margin-bottom: 18px; }
@container docpage (min-width: 1000px) {
  .doc-grid { grid-template-columns: minmax(0, 1fr) 288px; grid-template-areas: "top side" "main side"; grid-template-rows: auto 1fr; column-gap: 24px; }
  .dg-top { grid-area: top; } .dg-main { grid-area: main; }
  .doc-side { grid-area: side; align-self: start; position: sticky; top: 84px; margin-bottom: 0; }
}

/* top status card: business case chain + next step in one calm card (point 1) */
.doc-flow { gap: 0; padding: 0; overflow: hidden; }
.doc-flow > .flow-bar { padding: 14px 20px; }
.doc-flow .flow-bar { grid-template-columns: auto minmax(0, 1fr); gap: 16px; }
.doc-flow .fl-cap { font-size: 13px; font-weight: 600; color: var(--text-2); }
.doc-flow .fl-step.is-cur .fl-dot { box-shadow: 0 0 0 3px var(--accent-50); }
.df-next { border-top: 1px solid var(--border); }
.doc-flow > .df-next:first-child { border-top: 0; }
.df-next .next-step { background: transparent; border: 0; border-radius: 0; padding: 16px 20px; gap: 12px 18px; }
.df-next .next-step .ns-txt .xs { font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.df-next .next-step .ns-txt b { font-size: 16px; margin: 2px 0; }
.df-next .ok-step { background: var(--ok-bg); }
.df-next .ok-step .tile-ico { width: 32px; height: 32px; flex: none; }
.doc-page .alert { border-radius: var(--radius-lg); padding: 12px 16px; align-items: flex-start; line-height: 1.45; }
.doc-page .alert > .ico { flex: none; margin-top: 1px; }
.doc-page > .next-step, .rec-page > .next-step { background: var(--surface); border-color: var(--border); }
.doc-page > .next-step .ns-txt .xs, .rec-top .next-step .ns-txt .xs { font-weight: 600; color: var(--accent-text); }
@media (max-width: 700px) {
  .doc-flow > .flow-bar { padding: 12px 14px; }
  .doc-flow .flow-bar { grid-template-columns: 1fr; gap: 6px; }
  .df-next .next-step { padding: 14px; }
  .next-step .ns-txt { min-width: 0; flex-basis: 100%; }
}

/* progress panel ("Fortschritt", point 11) */
.pg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.pg-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pg-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-50); color: var(--accent-text); flex: none; }
.pg-ico .ico { width: 17px; height: 17px; }
.pg-type { font-weight: 600; font-size: 14px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-head .stx { margin-left: auto; }
.pg-num { font-size: 21px; font-weight: 700; margin-top: 12px; overflow-wrap: anywhere; }
.pg-num.is-draft { font-size: 16px; font-weight: 600; color: var(--text-2); }
.pg-note { margin: 0; font-size: 12.5px; color: var(--text-3); }
.pg-cap { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.pg-cap span:first-child { font-weight: 600; color: var(--text-2); }
.pg-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pg-step { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.pg-step:last-child { padding-bottom: 0; }
.pg-step:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--border); }
.pg-step.is-done:not(:last-child)::before { background: color-mix(in srgb, var(--ok) 45%, transparent); }
.pg-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--border-strong, var(--border)); color: var(--text-3); position: relative; z-index: 1; }
.pg-dot svg { width: 14px; height: 14px; stroke-width: 2.4; }
.pg-txt { display: flex; flex-direction: column; min-width: 0; padding-top: 3px; }
.pg-txt b { font-size: 14px; font-weight: 500; color: var(--text-3); line-height: 1.3; }
.pg-txt b a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong, var(--border)); text-underline-offset: 3px; }
.pg-txt small { font-size: 12.5px; color: var(--text-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.pg-step.is-done .pg-dot { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.pg-step.is-done .pg-txt b { color: var(--text-2); }
.pg-step.is-cur .pg-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast, #fff); box-shadow: 0 0 0 4px var(--accent-50); }
.pg-step.is-cur .pg-dot:empty::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pg-step.is-cur .pg-txt b { color: var(--text); font-weight: 650; }
.pg-step.is-cur.tone-ok .pg-dot { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); color: #fff; }
.pg-step.is-cur.tone-bad .pg-dot { background: var(--err); border-color: var(--err); box-shadow: 0 0 0 4px var(--err-bg); color: #fff; }
.pg-step.is-cur.tone-bad .pg-txt b { color: var(--err); }
.pg-step.is-cur.tone-warn .pg-dot { background: var(--warning-fill, var(--warn)); border-color: transparent; box-shadow: 0 0 0 4px var(--warn-bg); color: #fff; }
.pg-step.is-cur.tone-muted .pg-dot { background: var(--text-3); border-color: var(--text-3); box-shadow: none; color: var(--surface); }
.pg-step.is-skip { opacity: .6; } .pg-step.is-skip .pg-dot { border-style: dashed; }
.pg-step.is-todo .pg-dot { border-style: dashed; }
[data-pg-extra]:empty { display: none; }
[data-pg-extra] { margin-top: 14px; }
.pg-miss { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--err) 25%, transparent); background: var(--err-bg); color: var(--err); font: 600 13.5px/1.3 var(--font); cursor: pointer; text-align: left; }
.pg-miss span { flex: 1; } .pg-miss .ico { width: 16px; height: 16px; flex: none; }
.pg-miss:hover { border-color: var(--err); }
.pg-ready { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); font-size: 13px; }
.pg-ready .ico { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--ok); }
/* stacked (tablet / phone): the panel sits between the status card and the content, steps run horizontally */
@container docpage (max-width: 999px) {
  .pg-card { padding: 14px 16px; }
  .pg-head { flex-wrap: wrap; row-gap: 4px; }
  .pg-num { margin-top: 6px; font-size: 18px; }
  .pg-cap { margin: 12px 0 10px; padding-top: 12px; }
  .pg-steps { flex-direction: row; }
  .pg-step { flex: 1 1 0; grid-template-columns: 1fr; align-content: start; justify-items: center; text-align: center; gap: 6px; padding: 0 4px; }
  .pg-step:not(:last-child)::before { left: calc(50% + 17px); right: calc(-50% + 17px); top: 12px; bottom: auto; width: auto; height: 2px; }
  .pg-txt { align-items: center; padding-top: 0; }
  .pg-txt b { font-size: 13px; }
  .pg-txt small { font-size: 11.5px; }
  [data-pg-extra] { margin-top: 12px; }
}
@container docpage (max-width: 520px) {
  /* phone: keep the panel compact so the form starts on the first screen – steps stay in one row, dates/notes hidden */
  .pg-card { padding: 12px 14px; }
  .pg-num { margin-top: 4px; font-size: 16px; }
  .pg-note, .pg-ready, .pg-txt small { display: none; }
  .pg-cap { margin: 10px 0 8px; padding-top: 10px; }
  .pg-step { padding: 0 2px; gap: 4px; }
  .pg-step:not(:last-child)::before { left: calc(50% + 14px); right: calc(-50% + 14px); top: 11px; }
  .pg-dot { width: 22px; height: 22px; }
  .pg-dot svg { width: 12px; height: 12px; }
  .pg-step:not(.is-cur) .pg-txt { visibility: hidden; }   /* only the current step is named; the others are dots (no broken words at 390 px) */
  .pg-step.is-cur .pg-txt { overflow: visible; } .pg-step.is-cur .pg-txt b { font-size: 12px; line-height: 1.25; white-space: nowrap; }
  [data-pg-extra] { margin-top: 10px; }
}

/* autosave indicator: one quiet pill (editor keeps autosave – decision 20.10.) */
.doc-head .saved, .sticky-actions .saved-txt { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.doc-head .saved:not(:empty) { padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.sv-dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); }
.sv-dot svg { width: 11px; height: 11px; stroke-width: 2.6; }
.is-ok .sv-dot { background: var(--ok-bg); color: var(--ok); }
.saved.is-ok, .saved-txt.is-ok { color: var(--text-2); }
.is-dirty .sv-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.is-busy .sv-dot { border: 2px solid var(--accent-100); border-top-color: var(--accent); background: none; animation: sv-spin .8s linear infinite; }
@keyframes sv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-busy .sv-dot { animation: none; } }
@media (max-width: 700px) { .doc-head .saved { margin-left: 0; } .sticky-actions .saved-txt { display: none; } }

/* customer box + picker (point 5) */
.cust-box { align-items: flex-start; }
.cust-box .cb-txt > span { display: block; }
.cust-box .cb-txt .cb-meta { font-size: 13px; margin-top: 2px; }
.cb-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cust-pick .combo-list { max-height: min(380px, 55vh); overscroll-behavior: contain; }
.cp-cap { position: sticky; top: 0; z-index: 1; padding: 8px 12px; font-size: 12px; color: var(--text-3); background: var(--surface); border-bottom: 1px solid var(--border); }
.combo-list .cp-row { flex-wrap: nowrap; gap: 12px; padding: 9px 12px; }
.cp-row .avatar { width: 32px; height: 32px; font-size: 12px; flex: none; }
.cp-txt { display: flex; flex-direction: column; min-width: 0; }
.cp-txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-txt span { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-list .cp-new { border-top: 1px solid var(--border); flex-wrap: nowrap; }
.combo-list .cp-new + .cp-new { border-top: 0; }
.cp-empty { display: flex; align-items: center; gap: 10px; padding: 14px 12px; color: var(--text-3); font-size: 14px; }
.cp-empty .ico { width: 18px; height: 18px; flex: none; }
.cust-form .cf-sec { font-size: 13px; font-weight: 600; color: var(--text-2); padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 14px; }
.cust-form .cf-zip { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.cust-form [data-only] { display: flex; flex-direction: column; gap: 14px; }
.cust-form [data-only][hidden] { display: none; }
@media (max-width: 700px) { .cust-box { flex-wrap: wrap; } .cb-btns { width: 100%; justify-content: flex-start; padding-left: 52px; } }

/* lines: name first, description over the full width below (point 9) */
.dline .l-desc { display: flex; align-items: flex-start; gap: 10px; }
.dline .l-desc textarea { flex: 1; min-height: 38px; height: 38px; resize: none; overflow: hidden; font-size: 14px; line-height: 1.45; padding: 8px 12px; color: var(--text-2); background: var(--surface-2, var(--bg)); border-color: transparent; }
.dline .l-desc textarea:hover { border-color: var(--border); }
.dline .l-desc textarea:focus { background: var(--surface); color: var(--text); border-color: var(--accent); }
.dline .l-disc { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 13px; color: var(--text-3); height: 38px; }
.dline .l-disc input { width: 64px; height: 34px; }
.dline .l-link { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 38px; padding: 0 8px; border: 0; background: none; color: var(--text-3); font: 500 13px/1 var(--font); cursor: pointer; border-radius: var(--radius); }
.dline .l-link:hover { color: var(--accent-text); background: var(--surface-3); }
.dline .l-link .ico { width: 15px; height: 15px; }
@media (max-width: 760px) { .dline .l-desc { flex-wrap: wrap; } .dline .l-desc textarea { flex-basis: 100%; } }

/* finished view: positions as a table, description in its own full-width row */
.view-lines th { font-size: 12px; font-weight: 600; color: var(--text-3); text-align: left; padding: 0 0 8px; border-bottom: 1px solid var(--border); }
.view-lines th.num { text-align: right; padding-left: 12px; }
.view-lines tbody.vl-row td { border-bottom: 0; }
.view-lines tbody.vl-row { border-bottom: 1px solid var(--border); }
.view-lines tbody.vl-row:last-of-type { border-bottom: 0; }
.view-lines tr.vl-desc td { padding: 0 0 12px; color: var(--text-2); font-size: 14px; white-space: pre-line; line-height: 1.5; }
.view-lines .vl-m { display: none; }
.view-lines td.c-q { color: var(--text-2); }
@media (max-width: 700px) { .view-lines .c-q { display: none; } .view-lines .vl-m { display: block; } }

/* error summary (point 10): every item jumps to its field */
.err-sum { background: var(--surface); border: 1px solid color-mix(in srgb, var(--err) 30%, var(--border)); border-radius: var(--radius-lg); overflow: hidden; }
.err-sum.is-warn { border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.es-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; background: var(--err-bg); }
.is-warn .es-head { background: var(--warn-bg); }
.es-head b { display: block; font-size: 15px; }
.es-head span:not(.es-ico) { font-size: 13px; color: var(--text-2); }
.es-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--err); flex: none; }
.is-warn .es-ico { color: var(--warn); }
.es-ico .ico { width: 17px; height: 17px; }
.es-list { list-style: none; margin: 0; padding: 4px 0; }
.es-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 18px; border: 0; background: none; font: 400 14px/1.45 var(--font); color: var(--text); text-align: left; cursor: pointer; }
.es-list li + li .es-item { border-top: 1px solid var(--border); }
.es-item > .ico { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--err); }
.is-warn .es-item > .ico { color: var(--warn); }
.es-txt { flex: 1; min-width: 0; }
.es-go { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 12.5px; font-weight: 600; color: var(--accent-text); white-space: nowrap; margin-top: 1px; }
.es-go .ico { width: 15px; height: 15px; }
.es-item:hover, .es-item:focus-visible { background: var(--surface-3); outline: none; }
.es-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 700px) { .es-item { flex-wrap: wrap; padding: 11px 14px; } .es-go { margin-left: 26px; } .es-head { padding: 12px 14px; } }
/* fields that are still wrong + the short highlight after a jump */
.dline .f-err, [data-opts] .f-err, input.f-err { border-color: var(--err) !important; box-shadow: 0 0 0 3px var(--err-bg); }
.is-flagged { animation: flag-pulse 2.2s var(--ease, ease) 1; border-radius: var(--radius); }
.dline.is-flagged { border-radius: var(--radius); }
@keyframes flag-pulse { 0%, 55% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px var(--accent-50); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .is-flagged { animation: none; outline: 3px solid var(--accent); outline-offset: 3px; } }
.rec-form-main { display: flex; flex-direction: column; gap: 18px; }
.rec-top .next-step { background: var(--surface); border-color: var(--border); }
/* medium width (tablet, or desktop next to the panel when space is short): name gets its own full row */
.lines-body { container: lines / inline-size; }
@container lines (min-width: 540px) and (max-width: 740px) {
  .line-head { display: none; }
  .dline { grid-template-columns: 84px minmax(0, 1.2fr) minmax(0, 1fr) 96px minmax(0, 1fr) 36px; row-gap: 8px; }
  .dline > .l-name { grid-column: 1 / -1; }
  .dline .lab-m { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
  .dline .lt { padding-top: 32px; }
  .dline .l-x { padding-top: 26px; }
  .dline > span:empty { display: none; }
}
