/* Layout & components — load theme.css first in HTML for colors, fonts, and tokens */

/* Mobile-first layout — max width like a phone, centered */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* Login (home): one screen, no page scroll */
html:has(body[data-page='home']) {
  overflow: hidden;
  height: 100%;
}

body[data-page='home'] {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body[data-page='home'] .prototype-shell {
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.prototype-shell {
  max-width: var(--shell-max-width);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--shell-bg);
  box-shadow: var(--shell-shadow);
  position: relative;
}

/* Header toolbar */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--app-header-gap);
  min-height: var(--app-header-min-height);
  padding: var(--app-header-pad-y) var(--app-header-pad-x);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__btn {
  flex: 0 0 auto;
  width: var(--app-header-icon-touch);
  height: var(--app-header-icon-touch);
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--primary);
  font-size: var(--type-header-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}

.app-header__btn:active {
  background: var(--header-btn-active-bg);
}

.app-header__btn .fa {
  font-size: 1.12rem;
  line-height: 1;
  pointer-events: none;
}

.app-header__title {
  flex: 1;
  font-size: var(--type-header-title);
  font-weight: var(--font-weight-medium);
  text-align: center;
  margin: 0;
  padding: 0 4px;
}

.app-header__actions {
  flex: 0 0 40px;
  display: flex;
  justify-content: flex-end;
}

.app-header--sub .app-header__title {
  font-size: var(--type-header-title-sub);
}

body[data-page]:not([data-page='home']) .app-header {
  background: var(--app-header-dashboard-bg);
  border-bottom: var(--app-header-dashboard-border-bottom);
  box-shadow: var(--app-header-dashboard-shadow);
}

body[data-page]:not([data-page='home']) .app-header__btn,
body[data-page]:not([data-page='home']) .app-header__btn:visited {
  color: var(--app-header-dashboard-btn-color);
}

body[data-page]:not([data-page='home']) .app-header__btn:active {
  background: var(--app-header-dashboard-btn-active-bg);
}

body[data-page]:not([data-page='home']) .app-header__btn:focus-visible {
  outline: 2px solid var(--app-header-dashboard-focus-ring);
  outline-offset: 2px;
}

body[data-page]:not([data-page='home']) .app-header__title {
  color: var(--app-header-dashboard-title-color);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Content */
.app-content {
  padding: 16px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.app-content--flush {
  padding-left: 0;
  padding-right: 0;
}

/* Cards & list */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.card--login {
  margin-top: 8px;
  border: var(--login-card-border);
  box-shadow: var(--login-card-shadow);
}

.list-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
}

.list-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.list-card__body {
  padding: 12px 14px;
  font-size: var(--type-list-card-body);
  color: var(--text-muted);
}

.list-card__body--meta {
  padding: 14px 16px;
}

.list-card__meta-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.list-card__meta-row + .list-card__meta-row {
  margin-top: 10px;
}

.list-card__meta-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
  opacity: 0.9;
  text-align: center;
}

i.list-card__meta-icon.fa {
  font-size: 0.9rem;
  line-height: 1;
  width: 1.25em;
}

.list-card__meta-text {
  min-width: 0;
}

.list-card__meta-key {
  font-weight: var(--font-weight-bold);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.list-card__doc-id {
  font-size: var(--type-list-card-body);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
  color: var(--text);
}

.list-card__title-stack {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.list-card__title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.list-card__title-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.list-card__title-sub .list-card__chip {
  margin-left: 0;
}

.list-card__chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary-pressed);
  border: 1px solid rgba(var(--color-primary-rgb), 0.2);
}

.list-card__amount {
  font-size: var(--type-list-card-body);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.list-card__amount.list-card__amount--with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.list-card__amount__icon {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.92;
}

.list-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--color-list-actions-bg);
}

.list-card__actions--tight {
  padding: 12px 12px 14px;
  gap: 8px;
}

.list-card__actions .btn--small {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

body[data-page='quotation-list'] .list-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  margin-bottom: 14px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.055);
  border-color: rgba(0, 0, 0, 0.07);
}

body[data-page='quotation-list'] .list-card__head {
  padding: 14px 16px;
  gap: 12px;
}

body[data-page='quotation-list'] .list-card__actions--tight .list-card__action-convert {
  flex: 1 1 100%;
  margin-top: 4px;
  min-height: 40px;
  justify-content: center;
}

body[data-page='quotation-list'] .list-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

body[data-page='quotation-list'] .list-card__select {
  display: none;
  flex-shrink: 0;
  align-items: flex-start;
  justify-content: center;
  margin: 0;
  padding: 16px 4px 0 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body[data-page='quotation-list'] .prototype-shell.quotation-list--selecting .list-card__select {
  display: flex;
}

body[data-page='quotation-list'] .list-card__check {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

body[data-page='quotation-list'] .list-card__check:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

body[data-page='quotation-list'] .app-content {
  padding-bottom: calc(88px + var(--safe-bottom));
}

body[data-page='quotation-list'] .prototype-shell.quotation-list--selecting .app-content {
  padding-bottom: calc(148px + var(--safe-bottom));
}

body[data-page='quotation-list'] .prototype-shell.quotation-list--selecting .fab {
  visibility: hidden;
  pointer-events: none;
}

.selection-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max-width);
  z-index: 45;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
  padding: 12px 14px calc(12px + var(--safe-bottom));
}

.selection-bar__hint {
  margin: 0 0 10px;
  font-size: var(--type-caption);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}

.selection-bar__hint.is-error {
  color: var(--color-danger);
  font-weight: var(--font-weight-medium);
}

.selection-bar__row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.selection-bar__btn {
  flex: 1;
  width: auto;
  min-width: 0;
}

/* Quotation list — create-invoice confirmation */
.confirm-sheet {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.confirm-sheet:not([hidden]) {
  pointer-events: auto;
}

.confirm-sheet[hidden] {
  display: none !important;
}

.confirm-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay-scrim);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.confirm-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell-max-width);
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: var(--space-md) var(--space-md) calc(var(--space-lg) + var(--safe-bottom));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}

.confirm-sheet__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-bold);
  text-align: center;
  color: var(--text);
}

.confirm-sheet__msg {
  margin: 0 0 var(--space-md);
  font-size: var(--type-caption);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
}

.confirm-sheet__actions {
  display: flex;
  gap: 10px;
}

.confirm-sheet__btn {
  flex: 1;
  width: auto;
  min-width: 0;
}

/* Typography */
.hint {
  font-size: var(--type-hint);
  color: var(--text-muted);
  margin: 0 0 12px;
}

.tagline {
  text-align: center;
  color: var(--color-brand-tagline);
  margin: 4px 0 0;
  font-size: var(--type-tagline);
}

/* Brand block */
.brand-block {
  text-align: center;
  padding: var(--space-brand-block-pad);
}

.brand-block__icon {
  font-size: var(--type-brand-icon);
  line-height: 1;
}

.brand-block__mark {
  width: var(--size-brand-mark);
  height: var(--size-brand-mark);
  margin: 0 auto;
  border-radius: var(--radius-brand-mark);
  background: var(--brand-mark-background);
  color: var(--brand-mark-text);
  font-size: var(--type-brand-mark);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--brand-mark-shadow);
}

.brand-block h1 {
  margin: 8px 0 0;
  font-size: var(--type-brand-heading);
  color: var(--color-brand-heading);
  font-weight: var(--weight-brand-heading);
}

.welcome-title {
  text-align: center;
  font-size: var(--type-welcome);
  margin: 0 0 4px;
  color: var(--color-welcome);
  font-weight: var(--weight-welcome);
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: var(--type-form-label);
  font-weight: var(--font-weight-medium);
  margin-bottom: 6px;
  color: var(--text-muted);
}

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: var(--type-input);
  background: var(--card);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: var(--type-button);
  font-weight: var(--type-button-weight);
  border: none;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.btn--primary {
  background: var(--primary);
  color: var(--color-on-primary);
  box-shadow: var(--btn-primary-shadow);
}

.btn--primary:active {
  background: var(--primary-shade);
  box-shadow: var(--btn-primary-active-shadow);
}

.btn--outline {
  background: var(--btn-outline-bg);
  border: var(--btn-outline-border);
  color: var(--primary);
}

.btn--danger {
  background: var(--danger);
  color: var(--color-on-primary);
}

/* Outline + danger: must win over .btn--danger so Delete stays outline, not solid fill */
.btn--outline.btn--danger {
  background: var(--btn-outline-bg);
  color: var(--btn-danger-outline-color);
  border: var(--btn-outline-border);
  border-color: var(--btn-danger-outline-border);
}

.btn--small {
  width: auto;
  padding: 8px 12px;
  font-size: var(--type-btn-small);
  border-radius: 8px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.links-row {
  text-align: center;
  margin-top: 16px;
  font-size: var(--type-links-row);
}

.links-row a {
  color: var(--primary);
  cursor: pointer;
}

.legal-footer {
  text-align: center;
  font-size: var(--type-legal);
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.6;
}

.legal-footer a {
  color: var(--color-legal-link);
}

.legal-footer a:active {
  color: var(--color-legal-link-pressed);
}

/* Dashboard */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.main-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  min-height: 92px;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-card);
}

.main-tile:active {
  transform: scale(0.98);
}

.main-tile__title {
  font-weight: var(--font-weight-bold);
  font-size: var(--type-main-tile-title);
}

.main-tile__desc {
  font-size: var(--type-main-tile-desc);
  color: var(--text-muted);
  line-height: 1.3;
}

.stats-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stat-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 72px;
}

.stat-pill strong {
  display: block;
  font-size: var(--type-stat-value);
}

.stat-pill span {
  font-size: var(--type-stat-label);
  color: var(--text-muted);
}

/* Toolbar search */
.toolbar-search {
  padding: 12px 12px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.toolbar-search--compact {
  padding: 12px 12px 8px;
}

.toolbar-search--compact .input {
  padding: 10px 12px;
  font-size: 0.9375rem;
}

.toolbar-search .input {
  margin: 0;
}

.toolbar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: var(--type-toolbar-meta);
  color: var(--text-muted);
}

.toolbar-meta--list {
  padding: 10px 12px;
  gap: 12px;
}

body[data-page='quotation-list'] .toolbar-search.toolbar-search--compact {
  padding-left: 16px;
  padding-right: 16px;
}

body[data-page='quotation-list'] .toolbar-meta.toolbar-meta--list {
  padding-left: 16px;
  padding-right: 16px;
}

.toolbar-link-btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: var(--type-toolbar-meta);
  font-weight: var(--font-weight-medium);
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toolbar-link-btn:active {
  opacity: 0.85;
}

.toolbar-meta__summary {
  margin: 0;
  min-width: 0;
}

.toolbar-meta__label {
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
}

.toolbar-meta__summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.toolbar-meta__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}

.toolbar-meta__divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toolbar-icon-btn .fa {
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
}

.toolbar-icon-btn:active {
  background: var(--header-btn-active-bg);
}

.toolbar-text-btn {
  border: none;
  background: none;
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  font-size: var(--type-caption);
  font-weight: var(--font-weight-medium);
  color: var(--primary);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.toolbar-text-btn:active {
  background: var(--header-btn-active-bg);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--type-status-chip);
  font-weight: var(--font-weight-medium);
  padding: 4px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.status-chip--paid {
  background: var(--color-status-paid-bg);
  color: var(--color-status-paid-text);
}

.status-chip--partial {
  background: var(--color-status-partial-bg);
  color: var(--color-status-partial-text);
}

.status-chip--unpaid {
  background: var(--color-status-unpaid-bg);
  color: var(--color-status-unpaid-text);
}

/* FAB — CSS “+” stays truly centered (Font Awesome webfont metrics skew inside circles) */
.fab {
  position: fixed;
  right: max(16px, calc(50% - var(--shell-max-width) / 2 + 16px));
  bottom: calc(24px + var(--safe-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--color-on-primary);
  border: none;
  box-shadow: var(--fab-shadow);
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 0;
  padding: 0;
  box-sizing: border-box;
}

/* No position here — abs ::before/::after use .fab (fixed) as containing block so 50%/50% = circle center */
.fab__draw-plus {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  pointer-events: none;
}

.fab__draw-plus::before,
.fab__draw-plus::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  background: currentColor;
  border-radius: 1px;
  transform: translate(-50%, -50%);
}

.fab__draw-plus::before {
  width: 16px;
  height: 2px;
}

.fab__draw-plus::after {
  width: 2px;
  height: 16px;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs button {
  flex: 1;
  min-width: max-content;
  padding: 12px 10px;
  border: none;
  background: transparent;
  font-size: var(--type-tab);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.tabs button.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
  padding: 16px;
}

.tab-panel.is-active {
  display: block;
}

/* Chart mock */
.chart-mock {
  height: 140px;
  background: var(--chart-mock-gradient);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 16px 12px 8px;
  gap: 8px;
  margin-top: 8px;
}

.chart-bar {
  flex: 1;
  height: var(--chart-bar-height, 20%);
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  opacity: 0.85;
  min-width: 24px;
}

/* Dashboard — Quotations / Invoices (chart + recent list per tab) */
.dash-doc-tabs {
  margin-top: var(--space-sm);
}

.dash-doc-tabs > .tabs--dash-doc {
  margin-bottom: var(--space-sm);
}

.dash-doc-tabs > .tab-panel {
  padding: var(--space-sm) var(--space-0) var(--space-0);
}

.dash-doc-recent-title {
  margin-top: calc(var(--space-xl) * 2 + var(--space-md));
  padding-top: var(--space-sm);
}

.pie-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  box-shadow: var(--shadow-card);
}

.pie-card--dashboard {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-md);
}

.pie-card--dashboard .pie-card__subtitle {
  margin-bottom: var(--space-md);
}

.pie-card--dashboard .pie-card__chart {
  margin-top: var(--space-xxs);
}

.pie-card__header-block {
  margin-bottom: var(--space-md);
}

.pie-card__header-block .pie-card__title {
  text-align: left;
}

.pie-card--dashboard .pie-card__header-block .pie-card__subtitle {
  text-align: left;
  margin-bottom: 0;
}

.pie-card__header-dashboard {
  margin-bottom: var(--space-md);
}

.pie-card__header-split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.pie-card__header-split-main {
  flex: 1;
  min-width: 0;
}

.pie-card__header-split-main .pie-card__title {
  margin-bottom: var(--space-xxs);
  text-align: left;
}

.pie-card__header-split-main .pie-card__subtitle {
  margin: 0;
  text-align: left;
}

.pie-card--dashboard .pie-card__header-split-main .pie-card__subtitle {
  margin-bottom: 0;
}

.pie-card__header-split .dash-chart-period {
  flex-shrink: 0;
  align-self: flex-start;
  margin-left: auto;
}

.pie-card__header-split .dash-chart-period--row {
  justify-content: flex-end;
  gap: var(--space-xs);
}

.pie-card--quote-dash .pie-card__chart,
.pie-card--invoice-dash .pie-card__chart {
  margin-top: 0;
}

.pie-card__title {
  margin: 0 0 var(--space-xxs);
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  color: var(--text);
}

.pie-card--title-center .pie-card__title {
  text-align: center;
}

.pie-card__subtitle {
  margin: 0 0 var(--space-sm);
  font-size: var(--type-caption);
  line-height: 1.3;
}

.pie-card__period-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  margin: 0 0 var(--space-sm);
}

.dash-chart-period {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-left: auto;
}

/* Month (left) and year (right) on one row below chart */
.dash-chart-period--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-md);
  margin-left: 0;
  max-width: none;
}

.dash-chart-period--row .dash-chart-period__field {
  width: auto;
  flex: 0 1 auto;
}

.dash-chart-period--row .dash-chart-period__select {
  width: auto;
  min-width: 5.5rem;
  max-width: 10rem;
}

.dash-chart-period--compact {
  gap: var(--space-xs);
}

.dash-chart-period--compact .dash-chart-period__field {
  gap: 0;
}

.dash-chart-period--compact .dash-chart-period__select {
  min-width: 3.5rem;
  max-width: 5rem;
  padding: 3px 5px;
  font-size: 0.65rem;
  line-height: 1.25;
}

.dash-chart-period__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  min-width: 0;
}

.dash-chart-period__label {
  font-size: 0.7rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-chart-period__select {
  width: auto;
  min-width: 5.5rem;
  max-width: 9.5rem;
  padding: 8px 10px;
  font-size: var(--type-caption);
}

.pie-card__caption {
  margin: var(--space-md) 0 0;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: var(--type-caption);
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pie-card__chart {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
}

.pie-donut-shell {
  flex-shrink: 0;
  padding: var(--pie-surround-pad);
  border-radius: 50%;
  background: var(--pie-surround-bg);
  box-shadow: var(--pie-surround-shadow);
}

.pie-donut {
  width: var(--pie-chart-size);
  height: var(--pie-chart-size);
  border-radius: 50%;
  background: var(--pie-gradient, conic-gradient(var(--color-border) 0% 100%));
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--pie-ring-inset);
}

.pie-donut__hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--pie-donut-hole);
  height: var(--pie-donut-hole);
  border-radius: 50%;
  background: var(--card);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  z-index: 0;
}

.pie-donut__center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: var(--space-xs);
}

.pie-donut__center-line {
  display: block;
  font-size: 0.65rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  line-height: 1.2;
  max-width: 100%;
}

.pie-donut__center-line--month {
  color: var(--text);
  font-size: 0.68rem;
}

.pie-donut__center-line--year {
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.pie-legend {
  list-style: none;
  margin: var(--space-0);
  padding: var(--space-0);
  flex: 1;
  min-width: 0;
  font-size: var(--type-caption);
}

.pie-legend--side {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xs);
}

.pie-legend__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--gap-sm);
  align-items: center;
  min-width: 0;
}

.pie-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.pie-legend__label {
  font-weight: var(--font-weight-medium);
  color: var(--text);
  font-size: var(--type-caption);
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xxs);
  text-align: right;
}

.pie-legend__value {
  font-weight: var(--font-weight-bold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: var(--type-caption);
  line-height: 1;
}

.pie-legend__pct {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pie-legend__stats--count-only {
  flex-direction: row;
  align-items: center;
  gap: var(--space-xxs);
}

.invoice-status-cards {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.invoice-status-cards__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
}

.invoice-status-card {
  background: var(--surface-elevated, var(--bottom-nav-item-active-bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
}

.invoice-status-card__label {
  font-size: var(--type-caption);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.invoice-status-card__value {
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-semibold, var(--font-weight-bold));
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.dash-recent-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap-md);
  padding: var(--space-md);
  margin-bottom: var(--gap-sm);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.dash-recent-row__body {
  flex: 1;
  min-width: 0;
}

.dash-recent-row__doc-id {
  display: block;
  font-weight: var(--font-weight-medium);
  font-size: var(--type-tab);
  color: var(--text);
  line-height: 1.3;
}

.dash-recent-row__amount {
  margin-top: var(--space-xxs);
  font-size: var(--type-caption);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
}

.dash-recent-row__amounts {
  margin-top: var(--space-xxs);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-recent-row__payline {
  font-size: var(--type-caption);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.dash-recent-row__aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.dash-recent-row__payring {
  --pay-deg: 0deg;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(
    from -90deg,
    var(--primary) 0deg var(--pay-deg),
    var(--border) var(--pay-deg) 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.dash-recent-row__payring-inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dash-recent-row__payring-pct {
  font-size: 0.65rem;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.dash-recent-row--invoice {
  align-items: flex-start;
}

.dash-recent-row:last-child {
  margin-bottom: var(--space-0);
}

.dash-recent-row:active {
  background: var(--bottom-nav-item-active-bg);
}

.dash-recent-row__meta {
  font-size: var(--type-caption);
  color: var(--text-muted);
  margin: var(--space-xxs) 0 0;
  line-height: 1.35;
}

.dash-recent-row .status-chip {
  flex-shrink: 0;
  margin-left: var(--space-0);
}

/* Notifications list */
.notification-item {
  padding: var(--space-md);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--gap-sm);
  box-shadow: var(--shadow-card);
}

.notification-item:last-child {
  margin-bottom: var(--space-0);
}

.notification-item--unread {
  border-left: var(--space-xxs) solid var(--color-primary);
  padding-left: calc(var(--space-md) - var(--space-xxs));
}

.notification-item__title {
  margin: 0 0 var(--space-xxs);
  font-size: var(--type-add-sheet-title);
  font-weight: var(--font-weight-medium);
}

.notification-item__msg {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
  line-height: 1.4;
}

.notification-item__meta {
  margin: var(--space-xs) 0 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
}

.update-banner {
  background: var(--color-banner-warn-bg);
  border: 1px solid var(--color-banner-warn-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.update-banner h3 {
  margin: 0 0 6px;
  font-size: var(--type-update-banner-title);
}

.update-banner p {
  margin: 0;
  font-size: var(--type-update-banner-body);
  color: var(--text-muted);
}

.update-banner__meta {
  font-size: var(--type-caption);
  margin-top: var(--space-xs);
  margin-bottom: var(--space-0);
}

/* Settings accordion mock */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--card);
}

.accordion summary {
  padding: 14px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion__body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

/* Create quotation — vertical accordion + professional form layout */
body[data-page='add-quotation'] .app-content--quote-form {
  padding-top: 12px;
  padding-bottom: 12px;
}

.label-req {
  color: var(--color-danger);
  font-weight: var(--font-weight-bold);
}

.quote-field-grid {
  display: grid;
  gap: 12px 14px;
}

.quote-field-grid--2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 360px) {
  .quote-field-grid--2 {
    grid-template-columns: 1fr;
  }
}

/* Add quotation — date row (stable layout for native date inputs) */
.quote-date-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 14px;
  align-items: start;
  margin-bottom: 14px;
}

.quote-date-row__field {
  margin-bottom: 0;
  min-width: 0;
}

.quote-date-input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 400px) {
  .quote-date-row {
    grid-template-columns: 1fr;
  }
}

.quote-customer-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a.quote-customer-trigger:visited {
  color: var(--text);
}

.quote-customer-trigger__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-customer-trigger.is-empty .quote-customer-trigger__text {
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.quote-customer-trigger__icon {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quote-address-field {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.02);
  color: var(--text);
}

.quote-address-field:read-only {
  border-color: var(--border);
  cursor: default;
}

/* Customer picker (add quotation) */
body[data-page='add-quotation'] .customer-picker-sheet .filter-sheet__panel {
  max-height: min(90vh, 620px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body[data-page='add-quotation'] .customer-picker-add-pane:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body[data-page='add-quotation'] .customer-picker-sheet #customer-picker-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

/* `hidden` must win over `display:flex` above, or both panes stay visible */
body[data-page='add-quotation'] .customer-picker-sheet #customer-picker-list-pane[hidden],
body[data-page='add-quotation'] .customer-picker-add-pane[hidden] {
  display: none !important;
}

.customer-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(48vh, 340px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.customer-picker-empty {
  margin: 12px 0;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.customer-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.customer-picker-row:active {
  background: rgba(255, 255, 255, 0.88);
}

.customer-picker-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.customer-picker-row__name {
  font-weight: var(--font-weight-bold);
  font-size: 0.88rem;
  line-height: 1.25;
}

.customer-picker-row__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.customer-picker-row__chev {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.customer-picker-add-btn .fa {
  margin-right: 8px;
}

.customer-picker-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: var(--font-weight-medium);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.customer-picker-back:active {
  opacity: 0.85;
}

.customer-picker-add-pane .filter-sheet__title {
  margin-bottom: 12px;
}

/* Item library — full list + Select per row (same stack level as product editor) */
body[data-page='add-quotation'] .quote-product-library-fullpage.quote-section-fullpage {
  z-index: 61;
}

body[data-page='add-quotation'] .quote-product-library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body[data-page='add-quotation'] .quote-product-library-empty {
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

body[data-page='add-quotation'] .quote-product-library-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

body[data-page='add-quotation'] .quote-product-library-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body[data-page='add-quotation'] .quote-product-library-row__name {
  font-weight: var(--font-weight-bold);
  font-size: 0.88rem;
  line-height: 1.3;
  color: var(--text);
}

body[data-page='add-quotation'] .quote-product-library-row__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

body[data-page='add-quotation'] .quote-product-library-row__select {
  flex-shrink: 0;
  min-height: 40px;
  padding-left: 14px;
  padding-right: 14px;
  font-weight: var(--font-weight-bold);
}

body[data-page='add-quotation'] .quote-product-library-footer .fa-plus {
  margin-right: 8px;
}

body[data-page='add-quotation'] .quote-product-library-fullpage .quote-section-fullpage__search-field {
  flex: 1;
}

/* Add / edit product — full-screen editor above Products list */
body[data-page='add-quotation'] .quote-product-editor-fullpage.quote-section-fullpage {
  z-index: 61;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .quote-product-editor-fields {
  gap: 12px;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field {
  cursor: default;
  padding: 12px 12px 12px 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field:focus-within {
  border-color: rgba(22, 101, 52, 0.45);
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.22);
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field__label {
  color: #0f172a;
  font-weight: var(--font-weight-bold);
  font-size: 0.76rem;
  text-transform: none;
  letter-spacing: 0.01em;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field__icon {
  color: #166534;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field__input,
body[data-page='add-quotation'] .quote-product-editor-fullpage textarea.filter-field__input {
  cursor: text;
  color: #0f172a;
  font-size: 0.94rem;
  font-weight: var(--font-weight-medium);
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field__input--textarea {
  min-height: 4.75rem;
  padding-top: 4px;
}

body[data-page='add-quotation'] .product-form-unit-row,
body[data-page='item-editor'] .product-form-unit-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

body[data-page='add-quotation'] .product-form-unit-input,
body[data-page='item-editor'] .product-form-unit-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px !important;
  border: 1px solid rgba(15, 23, 42, 0.22) !important;
  border-radius: 10px !important;
  background: #f1f5f9 !important;
  box-sizing: border-box;
}

body[data-page='add-quotation'] .product-form-unit-input:focus,
body[data-page='item-editor'] .product-form-unit-input:focus {
  outline: none;
  border-color: #15803d !important;
  background: #fff !important;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.2);
}

body[data-page='add-quotation'] .product-form-unit-custom-btn,
body[data-page='item-editor'] .product-form-unit-custom-btn {
  flex: 0 0 auto;
  align-self: stretch;
  margin: 0;
  padding: 10px 12px;
  max-width: 42%;
  min-width: 7.25rem;
  border: none;
  border-radius: 10px;
  background: #15803d;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.35);
  -webkit-tap-highlight-color: transparent;
}

body[data-page='add-quotation'] .product-form-unit-custom-btn:active,
body[data-page='item-editor'] .product-form-unit-custom-btn:active {
  filter: brightness(0.93);
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .filter-field--product-unit .filter-field__body,
body[data-page='item-editor'] .quote-product-editor-fields .filter-field--product-unit .filter-field__body {
  gap: 6px;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .product-form-unit-hint {
  display: block;
  font-size: 0.72rem;
  font-weight: var(--font-weight-medium);
  color: #475569;
  line-height: 1.4;
  margin-top: 8px;
}

body[data-page='add-quotation'] .quote-product-editor-fullpage .product-form-unit-hint strong {
  color: #0f172a;
  font-weight: var(--font-weight-bold);
}

body[data-page='add-quotation'] .quote-product-editor-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body[data-page='add-quotation'] .quote-product-editor-footer .btn--primary {
  min-height: 48px;
  font-weight: var(--font-weight-bold);
}

.filter-field.filter-field--stack {
  align-items: flex-start;
}

.filter-field.filter-field--stack .filter-field__icon {
  margin-top: 6px;
}

.filter-field__input--textarea {
  display: block;
  width: 100%;
  min-height: 4.25rem;
  resize: vertical;
  line-height: 1.35;
  padding-top: 2px;
}

.quote-form-field-label {
  margin: 4px 0 6px;
  font-size: var(--type-caption);
  font-weight: var(--font-weight-bold);
  color: var(--text);
}

.quote-segmented-hint {
  margin: 0 0 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.quote-segmented {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  gap: 4px;
  font-size: 0.78rem;
}

.quote-segmented__radio {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
  font-size: inherit;
}

.quote-segmented__opt {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.quote-segmented__opt:has(.quote-segmented__radio:checked) {
  background: var(--card);
  color: var(--color-primary-pressed);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quote-segmented__opt:has(.quote-segmented__radio:focus-visible) {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.quote-segmented__icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.quote-segmented__ic {
  position: absolute;
  font-size: 0.85em;
  line-height: 1;
}

.quote-segmented__ic--on {
  display: none;
}

.quote-segmented__ic--off {
  display: block;
}

.quote-segmented__opt:has(.quote-segmented__radio:checked) .quote-segmented__ic--on {
  display: block;
}

.quote-segmented__opt:has(.quote-segmented__radio:checked) .quote-segmented__ic--off {
  display: none;
}

.quote-lines {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  border: none;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(58vh, 580px);
  -webkit-overflow-scrolling: touch;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body[data-page='add-quotation'] .quote-lines {
  gap: 12px;
}

/* Add quotation — product line */
body[data-page='add-quotation'] .quote-line-card {
  list-style: none;
  flex-shrink: 0;
  margin: 0;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.055);
  overflow: hidden;
}

/* Green left bar on header, body, stats, and line total (stacked = continuous strip) */
body[data-page='add-quotation'] .quote-line-card__header,
body[data-page='add-quotation'] .quote-line-card__body,
body[data-page='add-quotation'] .quote-line-card__stats,
body[data-page='add-quotation'] .quote-line-card__line-total {
  box-shadow: inset 4px 0 0 0 var(--color-primary);
}

/* Header: item name */
body[data-page='add-quotation'] .quote-line-card__header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.02);
}

body[data-page='add-quotation'] .quote-line-card__header-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  margin: -2px -4px 0 0;
}

body[data-page='add-quotation'] .quote-line-card__action-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

body[data-page='add-quotation'] .quote-line-card__action-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

body[data-page='add-quotation'] .quote-line-card__action-btn--danger {
  color: var(--color-danger, #c62828);
  border-color: rgba(198, 40, 40, 0.22);
}

body[data-page='add-quotation'] .quote-line-card__action-btn--danger:active {
  background: rgba(198, 40, 40, 0.08);
}

/* Body: description + HSN */
body[data-page='add-quotation'] .quote-line-card__body {
  padding: 10px 12px 8px;
}

body[data-page='add-quotation'] .quote-line-card__name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

body[data-page='add-quotation'] .quote-line-card__desc {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

body[data-page='add-quotation'] .quote-line-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

body[data-page='add-quotation'] .quote-line-card__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-muted);
  background: rgba(var(--color-primary-rgb), 0.09);
  border: 1px solid rgba(var(--color-primary-rgb), 0.14);
}

body[data-page='add-quotation'] .quote-line-card__chip-lbl {
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.62rem;
  color: #64748b;
}

body[data-page='add-quotation'] .quote-line-card__chip-val {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
}

/* Price, qty, unit, GST */
body[data-page='add-quotation'] .quote-line-card__stats {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 8px 8px;
  border-top: 1px solid var(--border);
  background: var(--color-list-actions-bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

body[data-page='add-quotation'] .quote-line-card__stats::-webkit-scrollbar {
  height: 4px;
}

body[data-page='add-quotation'] .quote-line-card__stats::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}

body[data-page='add-quotation'] .quote-line-card__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 8px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-page='add-quotation'] .quote-line-card__stat:first-child {
  border-left: none;
  padding-left: 2px;
}

body[data-page='add-quotation'] .quote-line-card__stat-lbl {
  flex-shrink: 0;
  font-size: 0.55rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1.15;
}

body[data-page='add-quotation'] .quote-line-card__stat-val {
  font-size: 0.9rem;
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  word-break: break-word;
}

body[data-page='add-quotation'] .quote-line-card__stat:first-child .quote-line-card__stat-val {
  color: var(--text);
}

body[data-page='add-quotation'] .quote-line-card__line-total {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
  padding: 10px 10px 12px;
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.14);
  background: linear-gradient(
    180deg,
    rgba(var(--color-primary-rgb), 0.06) 0%,
    rgba(var(--color-primary-rgb), 0.02) 100%
  );
}

body[data-page='add-quotation'] .quote-line-card__line-total-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

body[data-page='add-quotation'] .quote-line-card__gst-line {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  line-height: 1.25;
}

body[data-page='add-quotation'] .quote-line-card__gst-pct {
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

body[data-page='add-quotation'] .quote-line-card__gst-val {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

body[data-page='add-quotation'] .quote-line-card__stat--amount .quote-line-card__stat-val {
  color: var(--color-primary-pressed);
}

body[data-page='add-quotation'] .quote-line-card__line-total-group {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
}

body[data-page='add-quotation'] .quote-line-card__line-total-lbl {
  font-size: 0.68rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

body[data-page='add-quotation'] .quote-line-card__line-total-val {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  flex-shrink: 0;
}

body[data-page='add-quotation'] .quote-line-card__stat-hint {
  display: none;
}

.quote-products-totals {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  background: rgba(var(--color-primary-rgb), 0.07);
}

.quote-products-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.875rem;
}

.quote-products-totals__row + .quote-products-totals__row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(var(--color-primary-rgb), 0.25);
}

.quote-products-totals__label {
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
}

.quote-products-totals__value {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-primary-pressed);
}

/* Full-screen quote sections (Create quotation). Product editor & item library stack at z-index 61 */
body[data-page='add-quotation'] .quote-section-fullpage {
  position: fixed;
  inset: 0;
  z-index: 60;
  flex-direction: column;
  max-width: var(--shell-max-width);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  background: var(--color-bg-page);
  border: none;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body[data-page='add-quotation'] .quote-section-fullpage[hidden] {
  display: none !important;
}

body[data-page='add-quotation'] .quote-section-fullpage:not([hidden]) {
  display: flex;
}

body[data-page='add-quotation'] .quote-section-fullpage__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0)) 12px 10px;
  background: var(--app-header-dashboard-bg);
  border-bottom: var(--app-header-dashboard-border-bottom);
  box-shadow: var(--app-header-dashboard-shadow);
}

body[data-page='add-quotation'] .quote-section-fullpage__icon-btn {
  flex: 0 0 auto;
  width: var(--app-header-icon-touch);
  height: var(--app-header-icon-touch);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--app-header-dashboard-btn-color);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

body[data-page='add-quotation'] .quote-section-fullpage__icon-btn:active {
  background: var(--app-header-dashboard-btn-active-bg);
}

body[data-page='add-quotation'] .quote-section-fullpage__title {
  flex: 1;
  margin: 0;
  font-size: var(--type-header-title-sub);
  font-weight: var(--font-weight-bold);
  text-align: center;
  color: var(--app-header-dashboard-title-color);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  letter-spacing: -0.02em;
}

body[data-page='add-quotation'] .quote-section-fullpage__header-spacer {
  width: var(--app-header-icon-touch);
  flex-shrink: 0;
}

body[data-page='add-quotation'] .quote-section-fullpage__search {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  padding: 12px 16px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

body[data-page='add-quotation'] .quote-section-fullpage__search-field {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--color-input-readonly-bg);
}

body[data-page='add-quotation'] a.quote-section-fullpage__add-btn {
  text-decoration: none;
}

body[data-page='add-quotation'] .quote-section-fullpage__add-btn {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0 14px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.35);
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body[data-page='add-quotation'] .quote-section-fullpage__add-btn:active {
  background: rgba(var(--color-primary-rgb), 0.14);
}

body[data-page='add-quotation'] .quote-section-fullpage__add-btn .fa {
  font-size: 0.85rem;
  opacity: 0.95;
}

@media (max-width: 360px) {
  body[data-page='add-quotation'] .quote-section-fullpage__add-btn-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body[data-page='add-quotation'] .quote-section-fullpage__add-btn {
    padding: 0 12px;
    min-width: 44px;
  }
}

body[data-page='add-quotation'] .quote-section-fullpage__search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

body[data-page='add-quotation'] .quote-section-fullpage__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--type-input);
  color: var(--text);
}

body[data-page='add-quotation'] .quote-section-fullpage__search-input:focus {
  outline: none;
}

body[data-page='add-quotation'] .quote-section-fullpage__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 20px;
}

body[data-page='add-quotation'] .quote-lines--fullpage {
  max-height: none;
  margin-bottom: 12px;
}

body[data-page='add-quotation'] .quote-section-fullpage__footer {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 12px));
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
}

body[data-page='add-quotation'] .quote-products-footer-summary {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 0 2px;
}

body[data-page='add-quotation'] .quote-products-footer-summary__block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

body[data-page='add-quotation'] .quote-products-footer-summary__block--end {
  align-items: flex-end;
  text-align: right;
}

body[data-page='add-quotation'] .quote-products-footer-summary__label {
  font-size: 0.68rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

body[data-page='add-quotation'] .quote-products-footer-summary__value {
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
}

body[data-page='add-quotation'] .quote-products-footer-summary__value--grand {
  font-size: 1.125rem;
  color: var(--color-primary-pressed);
  letter-spacing: -0.02em;
}

body[data-page='add-quotation'] .quote-fullpage-accordion__summary {
  cursor: pointer;
}

body[data-page='add-quotation'] .quote-fullpage-accordion__summary .accordion--quote__chev {
  font-size: 0.78rem;
  opacity: 0.85;
}

body[data-page='add-quotation'] .customer-picker-sheet.filter-sheet {
  z-index: 65;
}

.quote-line-add i {
  margin-right: 8px;
  opacity: 0.9;
}

/* Product list & customer list — list cards aligned with quotation list */
body[data-page='product-list'] .list-card,
body[data-page='customer-list'] .list-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.055);
  border-color: rgba(0, 0, 0, 0.07);
}

body[data-page='product-list'] .list-card__head,
body[data-page='customer-list'] .list-card__head {
  padding: 14px 16px;
  gap: 12px;
}

body[data-page='product-list'] .list-card__main,
body[data-page='customer-list'] .list-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

body[data-page='product-list'] .app-content,
body[data-page='customer-list'] .app-content {
  padding-bottom: calc(88px + var(--safe-bottom));
}

/* Item editor — catalog mode hides qty & unit (stored defaults: qty 1, unit nos.) */
body.item-editor--catalog .ie-quote-only {
  display: none !important;
}

/* Item editor (add / edit — shared screen) */
body[data-page='item-editor'] .quote-product-editor-fields,
body[data-page='add-customer'] .quote-product-editor-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
}

body[data-page='item-editor'] .quote-product-editor-fields .filter-field,
body[data-page='add-customer'] .quote-product-editor-fields .filter-field {
  cursor: default;
  padding: 12px 12px 12px 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border-radius: 14px;
}

body[data-page='item-editor'] .quote-product-editor-fields .filter-field:focus-within,
body[data-page='add-customer'] .quote-product-editor-fields .filter-field:focus-within {
  border-color: rgba(22, 101, 52, 0.45);
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.18);
}

body[data-page='item-editor'] .quote-product-editor-fields .filter-field__label,
body[data-page='add-customer'] .quote-product-editor-fields .filter-field__label {
  color: #0f172a;
  font-weight: var(--font-weight-bold);
  font-size: 0.76rem;
}

body[data-page='item-editor'] .quote-product-editor-fields .filter-field__icon,
body[data-page='add-customer'] .quote-product-editor-fields .filter-field__icon {
  color: #166534;
}

body[data-page='item-editor'] .form-actions-stacked,
body[data-page='add-customer'] .form-actions-stacked {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body[data-page='add-customer'] .app-content--quote-form {
  padding-bottom: calc(24px + var(--safe-bottom));
}

.quote-summary-panel {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(var(--color-primary-rgb), 0.06);
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
}

.quote-summary-panel__title {
  margin: 0 0 12px;
  font-size: 0.7rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.quote-summary-dl {
  margin: 0;
}

.quote-summary-dl__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.875rem;
}

.quote-summary-dl__row dt {
  margin: 0;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
}

.quote-summary-dl__row dd {
  margin: 0;
  font-weight: var(--font-weight-semibold, 600);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.quote-summary-dl__row--grand {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.22);
}

.quote-summary-dl__row--grand dt {
  font-weight: var(--font-weight-bold);
  color: var(--text);
  font-size: 0.9375rem;
}

.quote-summary-dl__row--grand dd {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-pressed);
}

.quote-option-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.35;
}

.quote-option-row__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.quote-option-row__box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quote-option-row__input:checked + .quote-option-row__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}

.quote-option-row__input:focus-visible + .quote-option-row__box {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.quote-option-row__text {
  color: var(--text);
  font-weight: var(--font-weight-medium);
}

.quote-terms-card {
  padding: 12px 14px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
}

.quote-terms-card__label {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.quote-terms-card__list {
  margin-bottom: 0;
}

.btn--full {
  width: 100%;
  justify-content: center;
}

.app-footer-bar--quote {
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
}

.app-footer-bar__hint {
  margin: 0 0 10px;
  font-size: 0.72rem;
  text-align: center;
  color: var(--text-muted);
}

.quote-accordion-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion--quote {
  margin-bottom: 0;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  background: var(--card);
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
  overflow: hidden;
}

body[data-page='add-quotation'] .accordion--quote {
  /* Keeps section title visible below sticky app header when scrollIntoView(block:start) runs */
  scroll-margin-top: calc(var(--app-header-min-height) + var(--app-header-pad-y) * 2 + 6px);
}

.accordion--quote[open] {
  border-color: rgba(var(--color-primary-rgb), 0.28);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(var(--color-primary-rgb), 0.1);
}

.accordion--quote summary {
  padding: 14px 14px 14px 16px;
  font-weight: var(--font-weight-bold);
  font-size: 0.94rem;
  letter-spacing: -0.02em;
  color: var(--text);
  gap: 12px;
  user-select: none;
  align-items: center;
}

.accordion--quote[open] summary {
  color: var(--color-primary-pressed);
  background: linear-gradient(180deg, rgba(var(--color-primary-rgb), 0.08) 0%, rgba(var(--color-primary-rgb), 0.02) 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.accordion--quote__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(var(--color-primary-rgb), 0.11);
  color: var(--color-primary);
  font-size: 1rem;
}

.accordion--quote[open] .accordion--quote__icon {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary-pressed);
}

.accordion--quote__titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
}

.accordion--quote__title {
  font-size: 0.9375rem;
  line-height: 1.25;
}

.accordion--quote__subtitle {
  font-size: 0.7rem;
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
  color: var(--text-muted);
}

.accordion--quote__step-pill {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  letter-spacing: 0.02em;
}

.accordion--quote__step-pill-sep {
  font-weight: var(--font-weight-medium);
  opacity: 0.65;
  padding: 0 1px;
}

.accordion--quote[open] .accordion--quote__step-pill {
  background: rgba(var(--color-primary-rgb), 0.14);
  color: var(--color-primary-pressed);
}

.accordion--quote__chev {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  color: var(--text-muted);
  font-size: 0.72rem;
  transition: transform 0.22s ease;
}

.accordion--quote[open] .accordion--quote__chev {
  transform: rotate(180deg);
  color: var(--color-primary);
}

.accordion--quote .accordion__body {
  padding: 16px 16px 18px;
  border-top: none;
}

.accordion--quote__body .form-group:first-child {
  margin-top: 2px;
}

/* Preview */
.preview-doc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: var(--type-preview-doc);
}

.preview-doc table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: var(--type-preview-table);
}

.preview-doc th,
.preview-doc td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

/* Radio list */
.radio-list label {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--card);
  cursor: pointer;
  align-items: flex-start;
}

.radio-list input {
  margin-top: 4px;
}

.radio-list strong {
  display: block;
}

.radio-list span {
  font-size: var(--type-radio-desc);
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.badge {
  font-size: var(--type-badge);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--success);
  color: var(--color-on-primary);
  margin-left: 6px;
  vertical-align: middle;
}

.printed-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  margin-left: 6px;
}

/* —— Utilities & layout helpers (values from theme.css only) —— */
.u-hidden {
  display: none !important;
}

.u-mt-xs {
  margin-top: var(--space-xs);
}

.u-mt-sm {
  margin-top: var(--space-sm);
}

.u-mt-md {
  margin-top: var(--space-md);
}

.hint--center {
  text-align: center;
}

.hint--tight {
  margin: var(--space-xxs) 0 0;
}

.hint--block-start {
  margin: var(--space-xs) 0 0;
}

.hint--row {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
}

.app-header__title--compact {
  font-size: var(--type-header-title-sub);
}

.app-header__actions--inline {
  flex: 0 0 auto;
  display: flex;
  gap: var(--gap-xs);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-md);
  margin-bottom: var(--space-sm);
}

.flex-between--top {
  align-items: flex-start;
}

.flex-between--middle {
  align-items: center;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-md);
}

.card-row--top {
  align-items: flex-start;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-grid);
}

.section-heading {
  margin: 0;
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-medium);
}

.section-heading--flush {
  margin-top: var(--space-0);
}

.section-heading--spaced {
  margin: var(--space-lg) 0 var(--space-xs);
}

.section-heading--tight-bottom {
  margin-bottom: var(--space-xs);
}

.preview-title {
  margin: 0 0 var(--space-xs);
  font-size: var(--type-preview-title);
  font-weight: var(--font-weight-bold);
}

.preview-total {
  text-align: right;
  margin: var(--space-sm) 0 var(--space-xxs);
}

.preview-total--mid {
  margin: 0 0 var(--space-xxs);
}

.preview-total--final {
  margin: var(--space-0);
}

.stack-top-md {
  margin-top: var(--space-md);
}

.input--readonly {
  background: var(--color-input-readonly-bg);
}

.card--compact {
  padding: var(--space-sm);
}

.card--stack-sm {
  margin-top: var(--space-sm);
}

.card--danger {
  border-color: var(--color-card-danger-border);
  background: var(--color-card-danger-bg);
}

.alert-icon {
  font-size: var(--type-alert-icon);
  text-align: center;
}

.alert-icon .fa {
  font-size: inherit;
  line-height: 1;
  color: var(--color-warning);
}

.delete-account__title {
  margin: 0 0 var(--space-xs);
  font-size: var(--type-preview-title);
  text-align: center;
  font-weight: var(--font-weight-bold);
}

.list-bullets {
  margin: var(--space-0);
  padding-left: var(--list-indent);
  font-size: var(--type-list-card-body);
}

.list-ordered {
  margin: var(--space-0);
  padding-left: var(--list-indent);
  font-size: var(--type-list-card-body);
}

.app-footer-bar {
  padding: var(--app-footer-padding);
  background: var(--card);
  border-top: 1px solid var(--border);
}

/* —— Dashboard: hero, shortcuts, bottom nav, add sheet —— */
.app-content--with-bottom-nav {
  padding-bottom: var(--dash-content-pad-bottom);
}

.app-header__spacer {
  flex: 0 0 var(--app-header-icon-touch);
  width: var(--app-header-icon-touch);
  height: var(--app-header-icon-touch);
}

.dash-hero {
  margin-bottom: var(--space-md);
  text-align: center;
}

.dash-hero__greeting {
  font-size: var(--type-dash-greeting);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-xxs);
  line-height: 1.25;
  text-align: center;
}

.dash-hero__company {
  margin: 0;
  font-size: var(--type-hint);
  color: var(--text-muted);
  text-align: center;
}

.dash-section {
  margin-top: var(--space-lg);
}

.dash-hero + .dash-section {
  margin-top: var(--space-0);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max-width);
  background: var(--bottom-nav-bg);
  border-top: var(--bottom-nav-border-top);
  box-shadow: var(--bottom-nav-shadow);
  z-index: 40;
}

.bottom-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bottom-nav-inner-pad-x);
  min-height: var(--bottom-nav-height);
  padding: var(--space-xxs) var(--space-xxs) var(--safe-bottom);
  max-width: var(--shell-max-width);
  margin: 0 auto;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  min-width: 0;
  padding: var(--gap-xs) var(--space-xxs);
  text-decoration: none;
  color: var(--bottom-nav-item-color);
  font-size: var(--bottom-nav-icon-size);
  line-height: 1;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item:active {
  background: var(--header-btn-active-bg);
}

.bottom-nav__item--active {
  color: var(--bottom-nav-item-active-color);
  background: var(--bottom-nav-item-active-bg);
}

body[data-page='dashboard'] .bottom-nav__item:visited {
  color: var(--bottom-nav-item-color);
}

body[data-page='dashboard'] .bottom-nav__item--active:visited {
  color: var(--bottom-nav-item-active-color);
}

.bottom-nav__label {
  font-size: var(--type-bottom-nav-label);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  text-align: center;
}

.bottom-nav__icon {
  line-height: 1;
}

.bottom-nav__icon--glyph {
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-bold);
}

.bottom-nav__icon .fa {
  font-size: 1.18rem;
  line-height: 1;
  font-weight: 900;
}

.bottom-nav__fab {
  position: relative;
  flex: 0 0 auto;
  width: var(--bottom-nav-fab-size);
  height: var(--bottom-nav-fab-size);
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--bottom-nav-fab-icon-size);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--fab-shadow);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__fab:active {
  background: var(--color-primary-pressed);
}

.bottom-nav__fab .fab__draw-plus {
  transform: scale(0.92);
}

.add-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.add-sheet:not([hidden]) {
  pointer-events: auto;
}

.add-sheet[hidden] {
  display: none !important;
}

.add-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay-scrim);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.add-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell-max-width);
  margin: 0 auto;
  background: var(--add-sheet-panel-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--add-sheet-panel-shadow);
  padding: var(--space-sm) var(--space-md) calc(var(--space-lg) + var(--safe-bottom));
}

.add-sheet__grab {
  width: var(--space-lg);
  height: var(--space-xxs);
  margin: 0 auto var(--space-sm);
  border-radius: var(--radius);
  background: var(--add-sheet-handle-bg);
}

.add-sheet__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--type-section-heading);
  font-weight: var(--font-weight-bold);
  text-align: center;
}

.add-sheet__link {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--space-md);
  margin-bottom: var(--gap-sm);
  background: var(--color-list-actions-bg);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

.add-sheet__link:last-child {
  margin-bottom: var(--space-0);
}

.add-sheet__link:active {
  background: var(--bottom-nav-item-active-bg);
}

.add-sheet__link-plus {
  flex-shrink: 0;
  width: var(--app-header-icon-touch);
  height: var(--app-header-icon-touch);
  border-radius: var(--radius);
  background: rgba(var(--color-primary-rgb), 0.14);
  color: var(--color-primary);
  font-size: var(--type-add-sheet-title);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.add-sheet__link-plus .fa {
  font-size: 1.05rem;
  line-height: 1;
}

.add-sheet__link-body {
  min-width: 0;
  flex: 1;
}

.add-sheet__link-title {
  display: block;
  font-size: var(--type-add-sheet-title);
  font-weight: var(--font-weight-medium);
}

.add-sheet__link-desc {
  display: block;
  font-size: var(--type-add-sheet-desc);
  color: var(--text-muted);
  margin-top: var(--space-xxs);
  line-height: 1.35;
}

/* List pages — bottom sheets: filter & sort (quotations / invoices) */
.filter-sheet,
.sort-sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.filter-sheet:not([hidden]),
.sort-sheet:not([hidden]) {
  pointer-events: auto;
}

.filter-sheet[hidden],
.sort-sheet[hidden] {
  display: none !important;
}

.filter-sheet__backdrop,
.sort-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay-scrim);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.filter-sheet__panel,
.sort-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell-max-width);
  margin: 0 auto;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
  padding: 10px 14px calc(14px + var(--safe-bottom));
  background: linear-gradient(
    168deg,
    #134e2a 0%,
    #166534 38%,
    #15803d 72%,
    #1a7d45 100%
  );
  color: #f7fef9;
  max-height: min(85vh, 560px);
  overflow-y: auto;
}

.filter-sheet__grab,
.sort-sheet__grab {
  width: var(--space-lg);
  height: var(--space-xxs);
  margin: 0 auto 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.filter-sheet__title,
.sort-sheet__title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: var(--font-weight-bold);
  text-align: center;
  color: #f7fef9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  letter-spacing: -0.01em;
}

.sort-sheet__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Wrapper so line-amount sort options can be toggled without breaking list layout */
.product-sort-quote-only {
  display: contents;
}

.sort-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.sort-option:active {
  background: rgba(255, 255, 255, 0.88);
}

.sort-option.is-selected {
  border-color: #166534;
  box-shadow: 0 0 0 1px rgba(22, 101, 52, 0.35);
}

.sort-option__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #166534;
  font-size: 0.95rem;
}

.sort-option__label {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.3;
  color: var(--text);
  font-weight: var(--font-weight-medium);
}

.sort-option.is-selected .sort-option__label {
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}

.sort-option__check {
  flex-shrink: 0;
  width: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--color-primary);
  font-size: 0.95rem;
  opacity: 0;
}

.sort-option.is-selected .sort-option__check {
  opacity: 1;
}

.sort-option:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.filter-sheet__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  min-height: 0;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.filter-field__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #166534;
  font-size: 0.95rem;
}

.filter-field__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.filter-field__label {
  font-size: 0.72rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  line-height: 1.2;
  text-transform: capitalize;
}

.filter-field__input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text);
  padding: 0;
  margin: 0;
  font-family: inherit;
  line-height: 1.25;
  min-height: 0;
}

.filter-field__input::-webkit-datetime-edit {
  padding: 0;
}

.filter-field__input:focus {
  outline: none;
}

.filter-field:focus-within {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.filter-sheet__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.filter-sheet__btn {
  flex: 1;
  width: auto;
  min-width: 0;
}

.filter-sheet .filter-sheet__btn.btn--small {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 0.88rem;
}

.filter-sheet .btn--outline {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: #f7fef9;
}

.filter-sheet .btn--outline:active {
  background: rgba(255, 255, 255, 0.2);
}

.filter-sheet .btn--primary {
  background: #f7fef9;
  color: #134e2a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.filter-sheet .btn--primary:active {
  background: #e8f5eb;
}
