:root {
  --bg: #f4efe7;
  --bg-strong: linear-gradient(180deg, #f5ecdc 0%, #f7f3ec 42%, #f0f5f6 100%);
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: #ffffff;
  --ink: #1f2933;
  --muted: #5c6b73;
  --accent: #0f766e;
  --accent-deep: #134e4a;
  --accent-soft: #d2ede9;
  --line: rgba(31, 41, 51, 0.12);
  --shadow: 0 24px 60px rgba(26, 40, 53, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

@font-face {
  font-family: "LedgerSeer MICR";
  src:
    url("/static/backoffice/fonts/micrenc.ttf") format("truetype"),
    url("/static/backoffice/fonts/micr-e13b.woff2") format("woff2"),
    url("/static/backoffice/fonts/micr-e13b.woff") format("woff");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-strong);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  padding: 36px 28px;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 32%),
    linear-gradient(180deg, #16333f 0%, #132832 100%);
  color: #f7f8f9;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #f2cf91, #e59e66);
  color: #14303b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.rail h1,
.hero h2,
.company-card h3,
.table-toolbar h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

.rail-copy,
.hero-copy {
  color: rgba(247, 248, 249, 0.78);
  line-height: 1.6;
}

.rail-user {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
}

.rail-user p {
  margin: 0 0 8px;
}

.rail-user .detail-label {
  color: rgba(247, 248, 249, 0.62);
}

.rail-user .detail-copy,
.rail-user p {
  color: #f7f8f9;
}

.rail-user .button-subtle {
  width: 100%;
  justify-content: flex-start;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #f5fffe;
}

.rail-user .button-subtle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.rail-user .button-subtle.is-active {
  background: rgba(15, 118, 110, 0.34);
  border-color: rgba(210, 237, 233, 0.34);
  color: #f6fffd;
}

.rail-user form {
  margin: 0;
}

.rail-nav {
  display: grid;
  gap: 10px;
}

.rail-nav a,
.rail-group__links a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(247, 248, 249, 0.86);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.rail-nav a:hover,
.rail-group__links a:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.rail-nav a.is-active,
.rail-group__links a.is-active {
  background: rgba(15, 118, 110, 0.22);
  border-color: rgba(210, 237, 233, 0.3);
  color: #f6fffd;
}

.rail-nav-accordion {
  gap: 12px;
}

.rail-group {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.rail-group summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 248, 249, 0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.rail-group summary::after {
  content: "+";
  font-size: 1rem;
  color: rgba(247, 248, 249, 0.56);
}

.rail-group[open] summary::after {
  content: "−";
}

.rail-group__links {
  padding: 0 10px 10px;
  display: grid;
  gap: 8px;
}

.rail-group__links a {
  font-size: 0.95rem;
}

.main-panel {
  padding: 40px clamp(20px, 4vw, 48px);
}

.command-bar {
  margin-bottom: 18px;
}

.command-search {
  position: relative;
  max-width: 780px;
}

.command-search__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.command-search__controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.command-search__input {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 16px 32px rgba(26, 40, 53, 0.08);
  font-size: 1rem;
}

.command-search__input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.3);
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.14);
}

.command-search__clear {
  flex: 0 0 auto;
}

.command-search__panel {
  position: absolute;
  inset: calc(100% + 10px) 0 auto;
  z-index: 30;
  width: min(720px, 100%);
  max-height: min(70vh, 760px);
  overflow: auto;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(31, 41, 51, 0.09);
  box-shadow: 0 34px 60px rgba(26, 40, 53, 0.18);
  backdrop-filter: blur(8px);
}

.command-menu {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.command-menu--empty {
  gap: 8px;
}

.command-menu code {
  font-family: "SFMono-Regular", Menlo, monospace;
}

.command-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.command-menu__header strong,
.command-result__body strong,
.command-action span,
.command-search__resume {
  font-size: 1rem;
}

.command-menu__header span,
.command-result__body span,
.command-result__body small,
.command-action small,
.command-search__resume span {
  color: var(--muted);
}

.command-menu__list,
.command-menu__hint-grid {
  display: grid;
  gap: 10px;
}

.command-result,
.command-action,
.command-menu__hint,
.command-search__resume {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(31, 41, 51, 0.08);
  background: rgba(244, 239, 231, 0.45);
  display: grid;
  gap: 6px;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.command-result:hover,
.command-action:hover,
.command-menu__hint:hover,
.command-search__resume:hover,
.command-result.is-active,
.command-action.is-active {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(210, 237, 233, 0.6);
}

.command-result__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.command-result__type,
.command-result__exact {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.command-result__type {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-deep);
}

.command-result__exact {
  background: rgba(19, 78, 74, 0.12);
  color: var(--accent-deep);
}

.command-result__body,
.command-action {
  display: grid;
  gap: 4px;
}

.command-menu__hint-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.command-menu__hint strong,
.command-search__resume {
  font-family: "SFMono-Regular", Menlo, monospace;
}

.command-menu__back {
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-deep);
  cursor: pointer;
}

.module-switch-bar {
  margin-bottom: 22px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 41, 51, 0.08);
}

.module-switch-bar h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.module-switch-control {
  display: grid;
  gap: 8px;
  min-width: min(340px, 100%);
}

.module-switch-control span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.module-switch-control select {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.hero,
.form-card,
.table-card,
.company-card,
.empty-state {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-compact {
  margin-bottom: 20px;
}

.hero-actions,
.company-card__actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-actions form,
.table-toolbar form {
  margin: 0;
}

.inline-upload-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-upload-form input[type="file"] {
  max-width: 260px;
}

.form-fieldset-reset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.button-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.92rem;
}

.document-preview-shell {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(255, 255, 255, 0.78);
  min-height: 520px;
}

.document-preview-image {
  width: 100%;
  min-height: 520px;
  border: 0;
  display: block;
}

.document-preview-image {
  object-fit: contain;
  background: #eef3f4;
}

.document-preview-shell-compact {
  min-height: 420px;
}

.document-preview-shell-workbench {
  min-height: 360px;
  max-height: 640px;
  overflow: auto;
}

.document-preview-image-workbench {
  min-height: 360px;
  transition: transform 140ms ease;
}

.document-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.document-thumbnail-grid-dense {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.document-thumbnail-grid-inline {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

.document-thumbnail-card {
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  display: grid;
  gap: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.document-thumbnail-card.is-active {
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.document-thumbnail-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 10px;
}

.document-thumbnail-image {
  width: 100%;
  aspect-ratio: 8.5 / 11;
  object-fit: contain;
  background: #eef3f4;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 51, 0.1);
}

.document-thumbnail-label {
  font-weight: 700;
  color: var(--ink);
}

.document-thumbnail-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.document-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.document-queue-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

.document-queue-preview {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: #eef3f4;
  border: 1px solid rgba(31, 41, 51, 0.12);
}

.document-queue-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 8.5 / 11;
  object-fit: contain;
  background: #eef3f4;
}

.document-queue-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-queue-title {
  margin: 0;
  font-weight: 700;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.planner-callout {
  margin-bottom: 16px;
}

.segment-plan-list {
  display: grid;
  gap: 14px;
}

.segment-plan-card {
  padding: 16px 18px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
}

.segment-plan-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.segment-plan-header h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
}

.table-card-flat {
  box-shadow: none;
  border: 1px solid rgba(31, 41, 51, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

.bill-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.92fr);
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

.bill-workbench-form,
.bill-workbench-preview {
  display: grid;
  gap: 16px;
}

.preview-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--muted);
}

.rail .eyebrow,
.rail-copy {
  color: rgba(247, 248, 249, 0.78);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 600;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #109f92);
  color: #f5fffe;
}

.button-subtle {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-deep);
}

.button-danger {
  border-color: transparent;
  background: linear-gradient(135deg, #b42318, #d92d20);
  color: #fff6f5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.company-card,
.empty-state {
  padding: 24px;
}

.company-card__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.company-card__currency {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.report-catalog-card {
  min-width: 0;
}

.report-catalog-card__actions {
  display: grid;
  gap: 14px;
  align-items: start;
}

.report-catalog-card__actions .button {
  justify-self: start;
  max-width: 100%;
}

.report-catalog-card__meta {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-catalog-card__meta .mono {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-card,
.table-card {
  padding: 24px;
}

.mapping-row-locked {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(15, 118, 110, 0.03));
}

.mapping-row-mapped {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.06), rgba(13, 148, 136, 0.02));
}

.mapping-row-locked td {
  opacity: 0.72;
}

.mapping-row-mapped td {
  opacity: 0.86;
}

.mapping-row-locked strong,
.mapping-row-locked .metric-pill,
.mapping-row-mapped strong,
.mapping-row-mapped .metric-pill {
  opacity: 1;
}

.mapping-row-locked__note {
  margin-top: 8px;
  color: var(--accent-deep);
  font-size: 0.88rem;
  font-weight: 700;
}

.mapping-row-locked select:disabled,
.mapping-row-locked input:disabled,
.mapping-row-locked textarea:disabled {
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  cursor: not-allowed;
}

.qbd-inline-tax-setup {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.qbd-inline-tax-setup__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.qbd-tax-builder-dialog {
  width: min(880px, calc(100vw - 48px));
  border: none;
  padding: 0;
  background: transparent;
}

.qbd-tax-builder-dialog::backdrop {
  background: rgba(17, 24, 39, 0.36);
}

.qbd-tax-builder-dialog__card {
  padding: 22px;
  background: var(--panel);
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.qbd-tax-builder-dialog__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.qbd-tax-builder-grid {
  display: grid;
  gap: 12px;
}

.qbd-tax-builder-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(15, 118, 110, 0.04);
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: var(--radius-sm);
}

.qbd-tax-builder-exempt {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-radius: var(--radius-sm);
}

.statement-card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.setup-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.setup-checkbox-grid label,
.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.callout-card {
  padding: 18px 20px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.18);
}

.field-row {
  display: grid;
  gap: 8px;
}

.field-row label {
  font-weight: 700;
}

.field-row input,
.field-row select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 41, 51, 0.18);
  background: var(--panel-strong);
  font: inherit;
  color: var(--ink);
}

.field-row textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 41, 51, 0.18);
  background: var(--panel-strong);
  font: inherit;
  color: var(--ink);
}

.field-row input::placeholder,
.field-row textarea::placeholder,
.qbo-inline-input::placeholder,
.qbd-inline-tax-setup input::placeholder,
.qbd-inline-tax-setup textarea::placeholder {
  color: rgba(95, 109, 123, 0.58);
  font-style: italic;
}

.field-row input[type="checkbox"] {
  width: 20px;
  min-height: auto;
}

.segmented-code-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.segmented-code-separator {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--muted);
}

.field-error,
.error-banner {
  color: #9f1239;
}

.success-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #0f6f53;
}

.info-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(15, 118, 110, 0.1);
  border: 1px solid rgba(15, 118, 110, 0.18);
  color: var(--accent-deep);
}

.info-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.info-banner-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: #92400e;
}

.info-banner-critical {
  background: rgba(190, 24, 93, 0.1);
  border-color: rgba(190, 24, 93, 0.18);
  color: #9f1239;
}

.info-banner-setup {
  background: rgba(59, 130, 246, 0.09);
  border-color: rgba(59, 130, 246, 0.18);
  color: #1d4ed8;
}

.attention-group {
  display: grid;
  gap: 14px;
}

.field-help,
.detail-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.setup-mapping-review {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.setup-mapping-review__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(255, 255, 255, 0.62);
}

.setup-mapping-review__status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.setup-confidence {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.setup-confidence-high {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-deep);
}

.qbo-inline-table {
  table-layout: fixed;
}

.qbo-inline-table th:nth-child(1),
.qbo-inline-table td:nth-child(1) {
  width: 8%;
}

.qbo-inline-table th:nth-child(2),
.qbo-inline-table td:nth-child(2) {
  width: 18%;
}

.qbo-inline-table th:nth-child(3),
.qbo-inline-table td:nth-child(3) {
  width: 8%;
}

.qbo-inline-table th:nth-child(4),
.qbo-inline-table td:nth-child(4) {
  width: 20%;
}

.qbo-inline-table th:nth-child(5),
.qbo-inline-table td:nth-child(5) {
  width: 14%;
}

.qbo-inline-table th:nth-child(6),
.qbo-inline-table td:nth-child(6) {
  width: 12%;
}

.qbo-inline-table th:nth-child(7),
.qbo-inline-table td:nth-child(7) {
  width: 12%;
}

.qbo-inline-table th:nth-child(8),
.qbo-inline-table td:nth-child(8) {
  width: 8%;
}

.qbo-inline-input,
.qbo-inline-select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 51, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
}

.qbo-inline-input:focus,
.qbo-inline-select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.qbo-inline-status-stack {
  display: grid;
  gap: 4px;
}

.qbo-inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  width: fit-content;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(92, 107, 115, 0.12);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.qbo-inline-status[data-tone="pending"] {
  background: rgba(180, 83, 9, 0.12);
  color: #9a3412;
}

.qbo-inline-status[data-tone="success"] {
  background: rgba(16, 185, 129, 0.12);
  color: #0f6f53;
}

.qbo-inline-status[data-tone="error"] {
  background: rgba(225, 29, 72, 0.12);
  color: #9f1239;
}

.qbo-inline-error {
  margin-top: 6px;
}

.qbo-inline-actions .button {
  white-space: nowrap;
}

.setup-confidence-medium {
  background: rgba(180, 83, 9, 0.12);
  color: #92400e;
}

.setup-confidence-low {
  background: rgba(185, 28, 28, 0.1);
  color: #991b1b;
}

.error-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.metric-card strong {
  display: block;
  font-size: 1.2rem;
  margin-top: 6px;
}

.journal-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.activity-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.field-row-actions {
  align-self: end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qbd-mapping-filter-form {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(13, 148, 136, 0.12);
}

.inline-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
}

.inline-checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

.qbd-bulk-inline-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.qbd-bulk-inline-bar select {
  min-width: 280px;
}

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

.field-row-wide {
  grid-column: 1 / -1;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.info-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.info-stack p {
  margin: 0;
  line-height: 1.5;
}

.entry-lines-card {
  padding: 6px 0 0;
}

.entry-lines-table select,
.entry-lines-table input {
  min-width: 140px;
}

.job-cost-picker-native[data-job-cost-picker-enhanced="1"] {
  display: none;
}

.job-cost-picker {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.job-cost-picker-input {
  min-width: 170px;
}

.job-cost-picker-error[hidden] {
  display: none;
}

.job-cost-picker-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.digit-code-shell {
  position: relative;
  display: block;
}

.digit-code-shell .digit-code-input {
  padding-right: 52px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.digit-code-shadow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(24, 63, 78, 0.28);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  pointer-events: none;
  user-select: none;
}

.digit-code-shadow.is-complete {
  opacity: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.email-routing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.email-routing-form-card {
  max-width: 1120px;
}

.email-routing-settings-grid,
.email-routing-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.email-routing-form-grid .field-row-checkbox {
  align-content: start;
  justify-items: start;
}

.email-routing-form-grid .field-row-checkbox label {
  order: 1;
}

.email-routing-form-grid .field-row-checkbox input[type="checkbox"] {
  order: 2;
  margin-top: 4px;
}

.email-routing-form-grid .field-row-checkbox .subtle-copy,
.email-routing-form-grid .field-row-checkbox .field-error {
  order: 3;
}

.detail-card {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.detail-label {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
}

.detail-value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill-draft {
  background: rgba(245, 158, 11, 0.14);
  color: #9a5a00;
}

.status-pill-posted {
  background: rgba(16, 185, 129, 0.14);
  color: #0f6f53;
}

.status-pill-open {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-deep);
}

.status-pill-partial {
  background: rgba(245, 158, 11, 0.18);
  color: #8a4b00;
}

.status-pill-paid {
  background: rgba(16, 185, 129, 0.14);
  color: #0f6f53;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-badge-draft {
  background: rgba(245, 158, 11, 0.14);
  color: #9a5a00;
}

.status-badge-posted {
  background: rgba(16, 185, 129, 0.14);
  color: #0f6f53;
}

.statement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.statement-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.statement-header h3,
.statement-block h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.statement-date {
  margin: 8px 0 0;
  color: var(--muted);
}

.statement-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.statement-line,
.statement-total,
.statement-net {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.statement-line-empty {
  color: var(--muted);
}

.statement-link,
.table-link {
  color: var(--accent-deep);
  font-weight: 600;
}

.statement-link:hover,
.table-link:hover {
  text-decoration: underline;
}

.statement-total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-weight: 700;
}

.statement-net {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 2px solid rgba(15, 118, 110, 0.18);
  font-size: 1.02rem;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mono {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.subtle-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-actions {
  text-align: right;
}

.empty-table {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}

.empty-inline-state {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-deep);
}

.check-print-page {
  padding: 24px;
  background: #f4efe7;
}

.print-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.check-sheet {
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  padding: 0.35in;
  background: white;
  box-shadow: 0 18px 40px rgba(26, 40, 53, 0.12);
  transform: translate(var(--check-x-offset), var(--check-y-offset));
  display: grid;
  grid-template-rows: 1fr 1fr 1.15fr;
  gap: 0.2in;
}

.check-pane {
  border: 1px dashed rgba(31, 41, 51, 0.24);
  border-radius: 14px;
  padding: 0.18in 0.22in;
}

.check-pane__header,
.check-face__header,
.check-payee-row,
.check-micr {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.check-pane__header {
  align-items: flex-start;
  margin-bottom: 12px;
}

.check-mini-meta {
  text-align: right;
}

.check-mini-meta p,
.address-block p,
.compact p,
.check-face p {
  margin: 0;
}

.address-block {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}

.check-stub-table th,
.check-stub-table td {
  padding: 8px 6px;
  font-size: 0.82rem;
}

.check-face {
  display: grid;
  gap: 16px;
}

.check-header-right {
  text-align: right;
  display: grid;
  gap: 4px;
}

.check-payee-row {
  align-items: center;
  border-bottom: 1px solid rgba(31, 41, 51, 0.24);
  padding-bottom: 8px;
}

.check-amount-box {
  min-width: 1.6in;
  text-align: right;
  border: 1px solid rgba(31, 41, 51, 0.28);
  border-radius: 10px;
  padding: 8px 10px;
}

.check-amount-words {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.check-memo-line {
  border-top: 1px solid rgba(31, 41, 51, 0.16);
  padding-top: 10px;
}

.check-micr {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(31, 41, 51, 0.24);
  font-size: 1rem;
  font-family: "LedgerSeer MICR", "MICR E13B", "E13B", "SFMono-Regular", "Menlo", "Consolas", monospace;
  letter-spacing: 0.05em;
}

.rail-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(247, 248, 249, 0.9);
  background: rgba(255, 255, 255, 0.06);
}

.customer-report-card {
  display: grid;
  gap: 14px;
}

.report-address {
  color: #5d6977;
  font-size: 0.92rem;
  line-height: 1.45;
}

.popup-body {
  margin: 0;
  padding: 16px;
  background: #f4efe7;
}

.popup-shell {
  max-width: 980px;
  margin: 0 auto;
}

.popup-form-card {
  margin-top: 0;
}

.popup-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.notification-strip {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.notification-strip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.notification-strip__list {
  display: grid;
  gap: 12px;
}

.notification-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.notification-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.notification-strip-banner {
  border-color: rgba(255, 199, 112, 0.28);
  background: rgba(255, 199, 112, 0.08);
}

.notification-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.notification-list-card__body h3 {
  margin: 0 0 8px;
}

.notification-list-card__body p {
  margin: 0;
}

.notification-list-card__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.notification-inbox {
  display: grid;
  gap: 14px;
}

.notification-card-warning,
.notification-list-card.notification-card-warning {
  border-color: rgba(255, 193, 94, 0.3);
  background: rgba(255, 193, 94, 0.08);
}

.notification-card-critical,
.notification-list-card.notification-card-critical {
  border-color: rgba(235, 87, 87, 0.38);
  background: rgba(235, 87, 87, 0.1);
}

.mfa-qr {
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.recovery-code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.recovery-code-grid code {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 920px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    padding-bottom: 20px;
  }

  .workbench-grid,
  .bill-workbench {
    grid-template-columns: 1fr;
  }

  .notification-list-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-panel {
    padding: 20px 14px 32px;
  }

  .journal-meta-grid,
  .activity-filter-grid,
  .bank-account-grid,
  .email-routing-settings-grid,
  .email-routing-form-grid,
  .detail-grid,
  .statement-grid,
  .hero,
  .company-card__header,
  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .hero,
  .company-card__header,
  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .check-print-page {
    padding: 12px;
  }

  .check-sheet {
    width: 100%;
    min-height: auto;
    padding: 12px;
    transform: none;
  }
}

@media print {
  .no-print {
    display: none !important;
  }

  .check-print-page {
    padding: 0;
    background: white;
  }

  .check-sheet {
    margin: 0;
    box-shadow: none;
  }
}

.detail-grid-tight {
  margin-top: 12px;
}

.detail-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--ink-muted);
}

.code-block {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(10, 31, 42, 0.08);
  border: 1px solid rgba(10, 31, 42, 0.12);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
  font-size: 0.92rem;
}
