/* One visual contract for the financial product sections. */

body.dash-page {
  --nv-financial-aside: 320px;
  --nv-financial-gap: 24px;
  --nv-financial-control-gap: 8px;
  --nv-financial-control-height: 32px;
  --nv-financial-card-padding: var(--nv-island-padding, 24px);
}
/* Every finance screen follows the same vertical rhythm. Local module margins
   must not create a second, invisible spacing system. */
body.dash-page :is(.nv-tx, .nv-pay, .nv-inv, .nv-acc, .nv-ops, .nv-bud, .nv-inc, .nv-tax, .nv-acct, .nv-ins) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-auto-rows: max-content;
  align-content: start;
  gap: var(--nv-financial-gap) !important;
}

/* Direct children never contribute their own outer margin. The page stack is
   the single owner of the 24 px rhythm from KPI row to controls and content. */
body.dash-page :is(.nv-tx, .nv-pay, .nv-inv, .nv-acc, .nv-ops, .nv-bud, .nv-inc, .nv-tax, .nv-acct, .nv-ins) > * {
  margin-block: 0 !important;
}

/* Every section, Payments and Taxes included, keeps the one 24 px island
   rhythm between the KPI row and the first working island. */

/* Insights keeps the four overview metrics as white islands in light mode.
   The muted inset is reserved for content nested inside those islands. */
:is(html.light-theme, html.light) body.ins-page .nv-ins {
  --nv-section-surface: #fff;
  --nv-kpi-surface: #fff;
}

body.dash-page .nv-pay [data-pay-tab-panel="receive"] {
  display: grid !important;
  gap: var(--nv-financial-gap) !important;
}

body.dash-page .nv-pay [data-pay-tab-panel="receive"] > * {
  margin-block: 0 !important;
}

/* KPI cards deliberately share one anatomy: icon, label, value, context. */
body.dash-page :is(
  .nv-tx__stats,
  .nv-pay__stats,
  .nv-inv__stats,
  .nv-acc__stats,
  .nv-ops__stats,
  .nv-bud__stats,
  .nv-inc__stats,
  .nv-tax__stats,
  .nv-acct__stats,
  .nv-ins__stats
) {
  display: grid !important;
  width: 100% !important;
  max-width: none !important;
  grid-column: 1 / -1 !important;
  justify-self: stretch !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 4px !important;
}

/* Mini visualisations made the same component read as five different ones. */
body.dash-page :is(.nv-tax__stats, .nv-inc__stats, .nv-bud__stats, .nv-acct__stats, .nv-ins__stats)
  :is(.nv-o-stat__spark, .nv-o-stat__meter) {
  display: none !important;
}

/* One filter contract: 32 px controls, 8 px between controls, no local outer
   margins or padding. The 24 px section gap belongs to the page stack. */
body.dash-page :is(
  .nv-tx__bar,
  .nv-pay__bar,
  .nv-inv-tools,
  .nv-inv-tools__row,
  .nv-acc-tools,
  .nv-ops-tools,
  .nv-bud-tools,
  .nv-inc-tools,
  .nv-tax-tools,
  .nv-acct-tools,
  .nv-ins-bar
) {
  min-height: var(--nv-financial-control-height) !important;
  gap: var(--nv-financial-control-gap) !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.dash-page :is(
  .nv-tx__bar,
  .nv-pay__bar,
  .nv-inv-tools__row,
  .nv-acc-tools,
  .nv-ops-tools,
  .nv-bud-tools,
  .nv-inc-tools,
  .nv-tax-tools,
  .nv-acct-tools,
  .nv-ins-bar
) :is(button, select, input, [role="button"], .nv-select, .nv-m-select__trigger) {
  min-height: var(--nv-financial-control-height) !important;
  max-height: var(--nv-financial-control-height) !important;
  box-sizing: border-box;
}

body.dash-page :is(
  .nv-tx__bar .tx-chips,
  .nv-pay__bar .pay-chips,
  .nv-acc-tools .acc-chips,
  .nv-ops-tools .ops-chips,
  .nv-bud-tools .bud-filters,
  .nv-inc-tools .inc-filters,
  .nv-acct-tools .acct-filters,
  .nv-ins-bar .ins-filters
) {
  gap: var(--nv-financial-control-gap) !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* The content/rail proportion is identical across the financial workspace. */
body.dash-page :is(.nv-tax__layout, .nv-inc__layout, .nv-bud__layout, .nv-ops__layout, .nv-acct__layout, .nv-ins__layout) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--nv-financial-aside)) !important;
  gap: var(--nv-financial-gap) !important;
  align-items: start;
}

/* Income view selector changes the composition instead of only renaming the
   trigger. Unsupported views are not offered in the control. */
body.dash-page[data-inc-view="sources"] .nv-inc-chart,
body.dash-page[data-inc-view="sources"] .nv-inc__aside,
body.dash-page[data-inc-view="snapshots"] .nv-inc__main {
  display: none !important;
}

body.dash-page[data-inc-view="sources"] .nv-inc__layout,
body.dash-page[data-inc-view="snapshots"] .nv-inc__layout {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.dash-page[data-inc-view="snapshots"] .nv-inc__aside {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.dash-page :is(.nv-tax__aside, .nv-inc__aside, .nv-bud__aside, .nv-ops__aside, .nv-acct__aside, .nv-ins__aside) {
  display: grid !important;
  min-width: 0;
  width: auto !important;
  gap: var(--nv-financial-gap) !important;
  align-content: start;
  grid-auto-rows: max-content;
  position: static !important;
}

body.dash-page :is(.nv-tax__aside, .nv-inc__aside, .nv-bud__aside, .nv-ops__aside, .nv-acct__aside, .nv-ins__aside)
  > :is(.nv-o-card, .tax-panel, .inc-panel, .bud-panel, .ops-panel, .acct-panel, .ins-panel) {
  width: 100%;
  padding: var(--nv-financial-card-padding) !important;
  border: 0 !important;
  border-radius: var(--dash-radius-card, 20px) !important;
  background: var(--nv-section-surface) !important;
  box-shadow: none !important;
}

body.dash-page :is(.nv-tax__aside, .nv-inc__aside, .nv-bud__aside, .nv-ops__aside, .nv-acct__aside, .nv-ins__aside)
  :is(.tax-panel__title, .inc-panel__title, .bud-panel__title, .ops-panel__title, .acct-panel__title, .ins-panel__title, .acct-detail__title, .bud-detail__title) {
  color: var(--nv-table-text);
  font-size: var(--nv-type-title-3-size) !important;
  letter-spacing: var(--nv-type-title-3-tracking);
  font-weight: var(--nv-type-title-3-weight) !important;
}

body.dash-page :is(.nv-tax__aside, .nv-inc__aside, .nv-bud__aside, .nv-ops__aside, .nv-acct__aside, .nv-ins__aside)
  :is(.tax-panel__head, .inc-panel__head, .bud-panel__head, .ops-panel__head, .acct-panel__head, .ins-panel__head) {
  min-height: 32px;
  align-items: center;
  margin-block-end: 16px;
}

/* Selected-object details use the same 2 × 2 quiet tile grid. */
body.dash-page :is(.nv-bud-detail .bud-detail__stats, .nv-acct__aside .acct-detail__stats, .nv-tax__aside .tax-filing-detail__grid) {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

body.dash-page :is(.nv-bud-detail .bud-detail__stats > div, .nv-acct__aside .acct-detail__stats > div, .nv-tax__aside .tax-filing-detail__grid > span) {
  display: grid !important;
  min-width: 0;
  min-height: 68px;
  align-content: start;
  gap: 5px;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: var(--nv-card-tile) !important;
}

body.dash-page .nv-bud-detail .bud-detail__stats > div {
  align-items: start;
  justify-content: stretch;
}

body.dash-page .nv-bud-detail .bud-detail__stats dd {
  margin: 0;
  color: var(--nv-table-text);
  text-align: start;
}

/* One action hierarchy: calm primary, text-like secondary. */
body.dash-page :is(
  .nv-tax__aside .tax-filing-detail__actions,
  .nv-bud-detail .bud-detail__actions,
  .nv-acct__aside .acct-detail__actions,
  .nv-acct__aside .acct-month-close__actions
) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 8px !important;
}

body.dash-page :is(
  .nv-tax__aside .tax-filing-detail__actions,
  .nv-bud-detail .bud-detail__actions,
  .nv-acct__aside .acct-detail__actions,
  .nv-acct__aside .acct-month-close__actions
) :is(button, a) {
  min-height: 36px !important;
  padding-inline: 12px;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--nv-table-cell) !important;
  box-shadow: none !important;
}

body.dash-page :is(
  .nv-tax__aside .tax-filing-detail__actions,
  .nv-bud-detail .bud-detail__actions,
  .nv-acct__aside .acct-detail__actions,
  .nv-acct__aside .acct-month-close__actions
) :is(button, a):first-child {
  background: var(--nv-table-well-hover) !important;
  color: var(--nv-table-text) !important;
}

/* Operations uses the same rail density; actions are rows, not a button mosaic. */
body.dash-page .nv-ops__aside .ops-actions-card .nv-o-card__actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 2px !important;
}

body.dash-page .nv-ops__aside .ops-actions-card .nv-o-card__action {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nv-table-cell);
  text-align: start;
}

body.dash-page .nv-ops__aside .ops-actions-card .nv-o-card__action:hover {
  background: var(--nv-table-well-hover);
  color: var(--nv-table-text);
}

body.dash-page .nv-ops__aside .ops-actions-card .nv-o-card__action svg {
  width: 16px;
  height: 16px;
  justify-self: center;
}

@container dash-page-main (max-width: 980px) {
  body.dash-page :is(.nv-tax__layout, .nv-inc__layout, .nv-bud__layout, .nv-ops__layout, .nv-acct__layout, .nv-ins__layout) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 1100px) {
  body.dash-page :is(.nv-tax__layout, .nv-inc__layout, .nv-bud__layout, .nv-ops__layout, .nv-acct__layout, .nv-ins__layout) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.dash-page :is(
    .nv-tx__stats,
    .nv-pay__stats,
    .nv-inv__stats,
    .nv-acc__stats,
    .nv-ops__stats,
    .nv-bud__stats,
    .nv-inc__stats,
    .nv-tax__stats,
    .nv-acct__stats
  ) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  body.dash-page :is(
    .nv-tx__stats,
    .nv-pay__stats,
    .nv-inv__stats,
    .nv-acc__stats,
    .nv-ops__stats,
    .nv-bud__stats,
    .nv-inc__stats,
    .nv-tax__stats,
    .nv-acct__stats
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Signed-in owner workspace (not the landing demo). Hidden demo rails leave
   no empty column: every island spans the content area like the KPI row. */
html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) :is(.nv-tax__layout, .nv-inc__layout, .nv-bud__layout, .nv-ops__layout, .nv-acct__layout, .nv-ins__layout) {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-areas: none !important;
}

html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) :is(.nv-tax__layout, .nv-inc__layout, .nv-bud__layout, .nv-ops__layout, .nv-acct__layout, .nv-ins__layout) > * {
  grid-area: auto !important;
}

/* The KPI row, filters and copy/export actions describe data. Until the
   section has real data they stay hidden, so the static sample figures never
   paint and an empty account sees one island with one action. */
html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]):not([data-nv-page-data="ready"]) :is(
  [data-nv-stats],
  .nv-tax-tools,
  .nv-o-table__toolbar,
  [data-budget-copy-all],
  [data-tax-copy-all],
  [data-acct-action="copy-all"],
  [data-acct-action="export-csv"],
  [data-ops-export],
  #accExportBtn,
  [data-tax-open="filing"],
  #openAddIncomeBtn,
  .nv-o-table__head-actions .bud-add-cat__btn,
  .nv-bud__pair,
  .nv-acct-foot
) {
  display: none !important;
}

/* An empty or loading table shows its state centred in the island, without
   column headers, drag handles or a sideways scroll. */
html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) table:has(> tbody > tr:is(
  [data-preview-transactions-loading], [data-preview-transactions-state],
  [data-preview-payments-loading], [data-preview-payments-state],
  [data-preview-invoices-loading], [data-preview-invoices-state],
  [data-preview-budgets-loading], [data-preview-budgets-state],
  [data-preview-income-loading], [data-preview-income-state],
  [data-preview-taxes-loading], [data-preview-taxes-state],
  [data-preview-accounting-loading], [data-preview-accounting-state],
  #accLoadingRow, #accDataStateRow
):not([hidden])) > thead {
  display: none !important;
}

html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) tr:is(
  [data-preview-transactions-state], [data-preview-payments-state], [data-preview-invoices-state],
  [data-preview-budgets-state], [data-preview-income-state], [data-preview-taxes-state],
  [data-preview-accounting-state], #accDataStateRow
) > td {
  white-space: normal !important;
  max-width: none !important;
  overflow-wrap: anywhere;
}

/* Narrow widths turn tables into stacked cards (nv-table.css); a state row still spans the whole island. */
@container nv-responsive-table (max-width: 35rem) {
  html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) tr:is(
    [data-preview-transactions-state], [data-preview-payments-state], [data-preview-invoices-state],
    [data-preview-budgets-state], [data-preview-income-state], [data-preview-taxes-state],
    [data-preview-accounting-state], #accDataStateRow,
    [data-preview-transactions-loading], [data-preview-payments-loading], [data-preview-invoices-loading],
    [data-preview-budgets-loading], [data-preview-income-loading], [data-preview-taxes-loading],
    [data-preview-accounting-loading]
  ):not([hidden]) {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }

  html.nv-cloudflare-preview-auth:not(.dash-landing-preview) body.dash-page:not([data-preview-dataset="demo"]) tr:is(
    [data-preview-transactions-state], [data-preview-payments-state], [data-preview-invoices-state],
    [data-preview-budgets-state], [data-preview-income-state], [data-preview-taxes-state],
    [data-preview-accounting-state], #accDataStateRow,
    [data-preview-transactions-loading], [data-preview-payments-loading], [data-preview-invoices-loading],
    [data-preview-budgets-loading], [data-preview-income-loading], [data-preview-taxes-loading],
    [data-preview-accounting-loading]
  ):not([hidden]) > td {
    display: block !important;
    width: 100% !important;
  }
}

/* One empty state for every section: a short title, one line of context and
   at most one action, centred in the island. */
html.nv-cloudflare-preview-auth body.dash-page :is(.tx-empty, .pay-preview-empty, .inv-preview-state, .acc-empty, .ops-preview-state, .bud-preview-state, .inc-preview-empty, .tax-preview-empty, .acct-preview-empty):not([hidden]) {
  display: grid !important;
  justify-items: center;
  align-content: center;
  gap: 6px !important;
  min-height: 0 !important;
  padding: 48px 24px !important;
  text-align: center;
}

html.nv-cloudflare-preview-auth body.dash-page :is(.tx-empty__title, .pay-preview-empty > strong, .inv-preview-state__title, .acc-empty__title, .ops-preview-state__title, .bud-preview-state__title, .inc-preview-empty > strong, .tax-preview-empty > strong, .acct-preview-empty > strong) {
  margin: 0;
  color: var(--dash-text);
  font-size: var(--nv-type-headline-size);
  letter-spacing: var(--nv-type-headline-tracking);
  font-weight: var(--nv-type-headline-weight);
}

html.nv-cloudflare-preview-auth body.dash-page :is(.tx-empty__copy, .pay-preview-empty > span, .inv-preview-state__copy, .acc-empty__copy, .ops-preview-state__copy, .bud-preview-state__copy, .inc-preview-empty > span, .tax-preview-empty > span, .acct-preview-empty > span) {
  max-width: 42ch;
  margin: 0;
  color: var(--dash-text-subtle, var(--dash-text-muted));
  font-size: var(--nv-type-callout-size);
  letter-spacing: var(--nv-type-callout-tracking);
  line-height: 1.45;
}

html.nv-cloudflare-preview-auth body.dash-page :is(.tx-empty, .pay-preview-empty, .inv-preview-state, .acc-empty, .ops-preview-state, .bud-preview-state, .inc-preview-empty, .tax-preview-empty, .acct-preview-empty) :is(button, a):not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin-top: 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--dash-surface-hover);
  color: var(--dash-text);
  font: inherit;
  font-size: var(--nv-type-subhead-size);
  letter-spacing: var(--nv-type-subhead-tracking);
  font-weight: var(--nv-type-weight-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dash-transition, .15s);
}

html.nv-cloudflare-preview-auth body.dash-page :is(.tx-empty, .pay-preview-empty, .inv-preview-state, .acc-empty, .ops-preview-state, .bud-preview-state, .inc-preview-empty, .tax-preview-empty, .acct-preview-empty) :is(button, a):not([hidden]):hover {
  background: var(--dash-border-hover);
}

