:root {
  color-scheme: light;
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #10203a;
  --muted: #526071;
  --line: #dbe6f5;
  --blue: #2563eb;
  --green: #2563eb;
  --green-soft: #eff6ff;
  --yellow-soft: #dbeafe;
  --yellow-ink: #1d4ed8;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --sidebar: #ffffff;
  --sidebar-ink: #10203a;
  --sidebar-muted: #64748b;
  --shadow: 0 1px 2px rgba(37, 99, 235, 0.05), 0 14px 36px rgba(37, 99, 235, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.pairing-panel,
.connected-panel {
  background: var(--surface);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pairing-panel {
  overflow: hidden;
  padding: 0;
}

.brand-row,
.hero-grid,
.session-meta,
.actions,
.connected-panel {
  display: flex;
}

.brand-row {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 20px 34px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  font-size: 1.05rem;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.status-pill {
  min-width: 128px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--yellow-soft);
  color: var(--yellow-ink);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
}

.status-pill.ready {
  background: var(--green-soft);
  color: #1d4ed8;
}

.status-pill.expired {
  background: var(--red-soft);
  color: #991b1b;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 392px);
  align-items: stretch;
  gap: 0;
}

.intro {
  min-width: 0;
  padding: 34px;
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.session-meta {
  width: min(520px, 100%);
  align-items: stretch;
  gap: 10px;
  margin-bottom: 22px;
}

.start-guide {
  display: grid;
  gap: 10px;
  width: min(620px, 100%);
  margin: 0 0 24px;
}

.guide-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px 12px;
}

.guide-row p {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}

.guide-step {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 24px;
  text-align: center;
}

.session-meta > div {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px 14px;
}

.meta-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.session-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.08rem;
}

.actions {
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-action {
  background: var(--green);
  color: #fff;
}

.secondary-action {
  background: #eff6ff;
  color: #1d4ed8;
}

.ghost-action {
  background: #f1f5f9;
  color: #334155;
}

.danger-action {
  background: var(--red);
  color: #fff;
}

.status-copy {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.qr-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  min-height: 100%;
  border-left: 1px solid var(--line);
  background: #eff6ff;
  padding: 28px;
}

.qr-instruction {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  text-align: center;
}

.qr-frame {
  width: min(300px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.qr-frame svg {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.10);
}

.expired-box {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 850;
}

.pairing-code {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.work-card {
  min-height: 154px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 18px;
}

.work-card h2 {
  margin-bottom: 10px;
  font-size: 1.16rem;
  line-height: 1.2;
}

.work-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.is-connected .pairing-panel,
.is-connected .workspace-preview {
  display: none;
}

.shell[data-connected="true"] {
  width: 100%;
  padding: 0;
}

.workbench-app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f8fbff;
  box-shadow: none;
}

.workbench-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 9px;
  background: #f8fbff;
}

.sidebar-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand strong {
  font-size: 1rem;
}

.sidebar-brand span {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.sidebar-language {
  display: grid;
  gap: 6px;
  color: var(--sidebar-muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sidebar-language select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: none;
  padding: 0 10px;
}

.workbench-nav {
  display: grid;
  gap: 6px;
}

.workbench-nav p {
  margin: 14px 8px 5px;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workbench-nav p:first-child {
  margin-top: 0;
}

.workbench-nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
}

.workbench-nav-item:hover,
.workbench-nav-item:focus-visible {
  background: #f8fbff;
  color: var(--ink);
}

.workbench-nav-item.active {
  border-color: transparent;
  background: #eff6ff;
  color: var(--ink);
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border: 1px solid #dbe6f5;
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.sidebar-note span {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.sidebar-note strong {
  font-size: 0.92rem;
}

.workbench-content {
  min-width: 0;
  overflow: auto;
  background: #f8fbff;
  padding: 0;
}

.connected-panel {
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 0;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0 28px;
  box-shadow: none;
}

.connected-panel h2 {
  margin-bottom: 6px;
}

.connected-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.business-panel {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 24px 30px 60px;
}

.business-header,
.snapshot-stats,
.snapshot-card-header,
.compact-row,
.tax-row {
  display: flex;
}

.business-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.business-header h2 {
  margin-bottom: 6px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.business-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.snapshot-scope {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.entry-panel,
.client-panel,
.catalog-panel,
.invoice-panel,
.estimate-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.entry-form,
.company-profile-form,
.client-form,
.product-form,
.service-template-form,
.invoice-form,
.estimate-form {
  display: grid;
  gap: 8px;
  align-items: end;
}

.entry-form {
  grid-template-columns: 132px 146px 132px 116px minmax(180px, 1fr);
}

.client-form {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(180px, 1fr) 140px;
}

.company-profile-form {
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) 90px 120px;
  margin-top: 12px;
}

.product-form {
  grid-template-columns: minmax(180px, 1.2fr) 140px minmax(220px, 1fr);
}

.service-template-form {
  grid-template-columns: minmax(180px, 1.2fr) 112px 132px minmax(180px, 1fr) 86px;
}

.invoice-form,
.estimate-form {
  grid-template-columns: minmax(180px, 1.3fr) 140px 140px minmax(180px, 1fr);
}

.entry-form label,
.company-profile-form label,
.client-form label,
.product-form label,
.service-template-form label,
.invoice-form label,
.estimate-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.entry-form input,
.entry-form select,
.company-profile-form input,
.company-profile-form select,
.client-form input,
.client-form select,
.product-form input,
.product-form select,
.service-template-form input,
.service-template-form select,
.invoice-form input,
.invoice-form select,
.estimate-form input,
.estimate-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
  padding: 0 10px;
}

.invoice-taxable-field input,
.estimate-taxable-field input,
.template-taxable-field input {
  width: 24px;
  min-height: 24px;
  justify-self: start;
}

.entry-description-field {
  grid-column: span 2;
}

.entry-notes-field {
  grid-column: span 2;
}

.entry-actions {
  grid-column: span 2;
}

.client-name-field,
.client-company-field,
.client-address-field,
.client-notes-field {
  grid-column: span 2;
}

.company-name-field,
.company-address-field {
  grid-column: span 2;
}

.client-actions {
  grid-column: span 2;
}

.company-actions {
  grid-column: span 2;
}

.product-name-field,
.product-description-field {
  grid-column: span 1;
}

.product-actions {
  grid-column: span 1;
}

.template-name-field,
.template-description-field {
  grid-column: span 2;
}

.template-actions {
  grid-column: span 2;
}

.invoice-client-field,
.invoice-project-field,
.invoice-notes-field,
.estimate-client-field,
.estimate-project-field,
.estimate-notes-field {
  grid-column: span 2;
}

.invoice-lines-field,
.estimate-lines-field {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.invoice-actions,
.estimate-actions {
  grid-column: span 2;
}

.document-lines {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}

.catalog-picker-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.catalog-picker-row select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  padding: 0 10px;
}

.catalog-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.client-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.catalog-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}

.catalog-row-main {
  min-width: 0;
}

.catalog-row-name {
  overflow-wrap: anywhere;
  font-weight: 850;
}

.catalog-row-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.catalog-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.catalog-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.invoice-settlement {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}

.invoice-pdf-panel,
.estimate-pdf-panel,
.report-export-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}

.invoice-settlement[hidden],
.invoice-pdf-panel[hidden],
.estimate-pdf-panel[hidden],
.report-export-panel[hidden] {
  display: none;
}

.invoice-settlement-summary {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.invoice-settlement-form {
  display: grid;
  grid-template-columns: 118px 140px 132px minmax(180px, 1fr);
  gap: 8px;
  align-items: end;
}

.invoice-settlement-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.invoice-settlement-form input,
.invoice-settlement-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
  padding: 0 10px;
}

.invoice-settlement[data-mode="payment"] .writeoff-only-field,
.invoice-settlement[data-mode="writeoff"] .payment-only-field {
  display: none;
}

.invoice-payment-reference-field,
.invoice-writeoff-reason-field {
  grid-column: span 2;
}

.invoice-pdf-message,
.estimate-pdf-message,
.report-export-message {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.invoice-pdf-frame,
.estimate-pdf-frame,
.report-export-frame {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.invoice-pdf-frame object,
.estimate-pdf-frame object,
.report-export-frame object {
  width: 100%;
  height: min(720px, 72vh);
  min-height: 420px;
  border: 0;
}

.invoice-pdf-download,
.estimate-pdf-download,
.report-export-download {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  text-decoration: none;
  font-weight: 850;
}

.report-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-lines-header,
.document-line-row {
  display: grid;
  gap: 8px;
}

.document-lines-header {
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.document-line-row {
  grid-template-columns: minmax(180px, 1fr) 78px 92px 118px 78px 38px;
  align-items: end;
  margin-top: 8px;
}

.document-line-taxable {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.document-line-taxable input {
  width: 22px;
  min-height: 22px;
}

.icon-action {
  display: grid;
  min-height: 38px;
  padding: 0;
  place-items: center;
}

.compact-action {
  min-height: 34px;
  padding: 0 10px;
}

.actionable-row {
  gap: 10px;
}

.document-row-side {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.compact-muted {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.entry-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.entry-status.error {
  color: var(--red);
}

.entry-status.success {
  color: #1d4ed8;
}

.inline-status {
  margin: 0;
  text-align: right;
}

.snapshot-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.snapshot-stats > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.snapshot-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.2;
}

.snapshot-stats strong.positive {
  color: #1d4ed8;
}

.snapshot-stats strong.negative {
  color: var(--red);
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.snapshot-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 14px;
}

.snapshot-card.wide {
  grid-column: span 2;
}

.snapshot-card-header {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.snapshot-card-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.snapshot-card-header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.compact-list,
.tax-lines {
  display: grid;
  gap: 8px;
}

.compact-row,
.tax-row {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border-top: 1px solid rgba(37, 99, 235, 0.10);
  padding-top: 8px;
}

.compact-row:first-child,
.tax-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.compact-main {
  min-width: 0;
}

.compact-title {
  overflow-wrap: anywhere;
  font-weight: 850;
}

.compact-meta,
.tax-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.compact-amount,
.tax-value {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
  text-align: right;
}

.tax-label {
  flex: 0 0 auto;
}

.tax-value {
  min-width: 0;
  max-width: 62%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.compact-amount.negative,
.tax-value.negative {
  color: var(--red);
}

.compact-empty {
  color: var(--muted);
  font-weight: 750;
}

.review-queue-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.review-queue-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.review-queue-stats > div {
  min-width: 0;
  border: 1px solid rgba(37, 99, 235, 0.10);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.review-queue-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.2;
}

.review-queue-toolbar,
.review-group-row,
.review-item-top,
.review-suggestion-line,
.review-item-actions {
  display: flex;
}

.review-queue-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}

.review-group-list,
.review-item-list {
  display: grid;
  gap: 8px;
}

.review-group-row,
.review-item-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
}

.review-group-row {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.review-group-copy {
  min-width: 0;
}

.review-group-copy strong,
.review-group-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-group-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.review-item-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
}

.review-select {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.review-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.review-item-main {
  min-width: 0;
}

.review-item-top {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-item-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-item-top span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.review-item-main p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.review-suggestion-line {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.review-suggestion-line span {
  min-height: 26px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 26px;
  padding: 0 9px;
}

.review-explanation {
  overflow-wrap: anywhere;
}

.review-item-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 142px;
}

.trend-column {
  display: grid;
  align-content: end;
  gap: 6px;
  min-width: 0;
  height: 142px;
}

.trend-stack {
  display: grid;
  align-content: end;
  gap: 3px;
  height: 96px;
}

.trend-income,
.trend-expense {
  min-height: 4px;
  border-radius: 5px 5px 0 0;
}

.trend-income {
  background: var(--green);
}

.trend-expense {
  background: #f97316;
}

.trend-label,
.trend-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monthly-summary-table {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.monthly-summary-row {
  display: grid;
  grid-template-columns: 78px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(37, 99, 235, 0.10);
  padding-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.monthly-summary-row strong {
  color: var(--ink);
  text-align: right;
}

.monthly-summary-row strong.positive {
  color: #1d4ed8;
}

.monthly-summary-row strong.negative {
  color: var(--red);
}

.category-share {
  display: grid;
  gap: 6px;
  width: 100%;
}

.category-share-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-share-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.category-share-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.category-detail-row {
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.category-detail-row:hover,
.category-detail-row:focus-visible {
  background: #f8fbff;
}

.company-profile-grid,
.import-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.category-management-grid {
  display: block;
}

.profile-field,
.management-tile,
.import-tile {
  min-width: 0;
  border: 1px solid rgba(37, 99, 235, 0.10);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.profile-field span,
.management-tile span,
.import-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-field strong,
.management-tile strong,
.import-tile strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.category-manager {
  display: grid;
  gap: 12px;
}

.category-add-panel {
  display: grid;
  grid-template-columns: 132px 132px minmax(180px, 1fr) minmax(190px, 1fr) auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.category-add-panel label,
.category-manager-row label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.category-add-panel input,
.category-add-panel select,
.category-manager-row input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
  padding: 0 10px;
}

.category-help {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.category-slice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.category-manager-slice {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.category-manager-slice h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.category-manager-slice h4 span {
  color: var(--muted);
  font-weight: 800;
}

.category-manager-group {
  border-top: 1px solid var(--line);
  padding: 8px 0;
}

.category-manager-group:first-of-type {
  border-top: 0;
}

.category-manager-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 850;
}

.category-manager-group summary strong {
  color: var(--muted);
  font-size: 0.86rem;
}

.category-manager-row {
  display: grid;
  grid-template-columns: 64px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0 0;
}

.category-source {
  min-height: 24px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.category-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.import-action-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff6ff;
  padding: 14px;
}

.import-action-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.import-action-panel strong {
  display: block;
  margin-top: 4px;
  font-weight: 900;
}

.import-action-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.import-action-panel .category-help {
  grid-column: 1 / -1;
}

.receipt-panel {
  margin-top: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  padding: 24px 30px 60px;
}

.receipt-header,
.receipt-stats,
.receipt-row-top,
.receipt-meta {
  display: flex;
}

.receipt-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.receipt-header h2 {
  margin-bottom: 6px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.receipt-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.receipt-stats {
  gap: 10px;
  margin-bottom: 14px;
}

.receipt-stats > div {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.receipt-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
}

.receipt-list {
  display: grid;
  gap: 8px;
}

.receipt-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px 14px;
}

.receipt-row-top {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.receipt-main {
  flex: 1 1 auto;
  min-width: 0;
}

.receipt-title {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.receipt-meta {
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.receipt-amount {
  font-weight: 850;
  text-align: right;
}

.receipt-side {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.match-action,
.attach-action,
.preview-action,
.save-action,
.create-action,
.archive-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.receipt-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.receipt-edit-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.receipt-edit-grid input,
.receipt-edit-grid select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
  padding: 0 10px;
}

.receipt-notes-field {
  grid-column: span 2;
}

.receipt-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.receipt-match-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
  color: var(--muted);
  font-weight: 750;
}

.receipt-match-panel.error {
  background: #fee2e2;
  color: #991b1b;
}

.receipt-match-panel.success {
  background: var(--green-soft);
  color: #1d4ed8;
}

.receipt-preview-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
  color: var(--muted);
  font-weight: 750;
}

.receipt-preview-panel.error {
  background: #fee2e2;
  color: #991b1b;
}

.receipt-preview-image,
.receipt-preview-pdf {
  width: 100%;
  max-height: min(620px, 72vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.receipt-preview-image {
  display: block;
  object-fit: contain;
}

.receipt-preview-pdf {
  min-height: 520px;
}

.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.match-copy {
  min-width: 0;
}

.match-copy strong,
.match-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-copy strong {
  color: var(--ink);
}

.match-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.receipt-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .connected-panel,
  .business-header,
  .receipt-header {
    flex-direction: column;
  }

  .qr-card {
    width: 100%;
    min-height: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .workbench-app {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .workbench-sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: block;
    padding: 14px;
  }

  .sidebar-brand {
    margin-bottom: 12px;
  }

  .workbench-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .workbench-nav p,
  .sidebar-note {
    display: none;
  }

  .workbench-nav-item {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .workbench-content {
    padding: 14px;
  }

  .workspace-preview {
    grid-template-columns: 1fr;
  }

  .receipt-stats {
    flex-direction: column;
  }

  .snapshot-stats {
    grid-template-columns: 1fr;
  }

  .snapshot-grid {
    grid-template-columns: 1fr;
  }

  .category-add-panel,
  .category-slice-grid,
  .import-action-panel {
    grid-template-columns: 1fr;
  }

  .category-manager-row {
    grid-template-columns: 1fr;
  }

  .category-row-actions {
    flex-wrap: wrap;
  }

  .review-item-row {
    grid-template-columns: 1fr;
  }

  .review-group-row,
  .review-item-top {
    align-items: stretch;
    flex-direction: column;
  }

  .review-item-actions {
    justify-content: flex-start;
  }

  .entry-form,
  .company-profile-form,
  .client-form,
  .product-form,
  .service-template-form,
  .invoice-form,
  .estimate-form,
  .invoice-settlement-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-category-field,
  .entry-description-field,
  .entry-notes-field,
  .entry-actions,
  .company-name-field,
  .company-address-field,
  .company-actions,
  .client-name-field,
  .client-company-field,
  .client-address-field,
  .client-notes-field,
  .client-actions,
  .product-name-field,
  .product-description-field,
  .template-name-field,
  .template-description-field,
  .template-actions,
  .product-actions,
  .invoice-client-field,
  .invoice-project-field,
  .invoice-notes-field,
  .invoice-payment-reference-field,
  .invoice-writeoff-reason-field,
  .estimate-client-field,
  .estimate-project-field,
  .estimate-notes-field {
    grid-column: span 2;
  }

  .document-line-row {
    grid-template-columns: minmax(160px, 1fr) 78px 92px 118px 74px 38px;
  }

  .snapshot-card.wide {
    grid-column: span 1;
  }

  .trend-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .receipt-row-top,
  .compact-row,
  .tax-row,
  .catalog-row,
  .match-row {
    align-items: stretch;
    flex-direction: column;
  }

  .tax-value {
    max-width: 100%;
    text-align: left;
  }

  .monthly-summary-row {
    grid-template-columns: 1fr;
  }

  .monthly-summary-row strong {
    text-align: left;
  }

  .receipt-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .receipt-notes-field {
    grid-column: span 2;
  }

  .receipt-side {
    justify-items: stretch;
  }

  .receipt-amount {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1360px);
    padding: 14px 0 24px;
  }

  .pairing-panel {
    padding: 0;
  }

  .brand-row,
  .intro,
  .qr-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .brand-row,
  .session-meta,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill,
  button {
    width: 100%;
  }

  .review-queue-toolbar,
  .review-item-actions {
    flex-direction: column;
  }

  .workbench-nav-item {
    width: auto;
  }

  .receipt-edit-grid {
    grid-template-columns: 1fr;
  }

  .entry-form,
  .company-profile-form,
  .client-form,
  .product-form,
  .service-template-form,
  .invoice-form,
  .estimate-form,
  .entry-category-field,
  .entry-description-field,
  .entry-notes-field,
  .entry-actions,
  .company-name-field,
  .company-address-field,
  .company-actions,
  .client-name-field,
  .client-company-field,
  .client-address-field,
  .client-notes-field,
  .client-actions,
  .product-name-field,
  .product-description-field,
  .product-actions,
  .invoice-client-field,
  .invoice-project-field,
  .invoice-notes-field,
  .estimate-client-field,
  .estimate-project-field,
  .estimate-notes-field {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .document-lines-header,
  .document-line-row {
    grid-template-columns: 1fr;
  }

  .document-line-row {
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .receipt-notes-field {
    grid-column: auto;
  }

  h1 {
    font-size: 2.42rem;
  }
}
