/* Desktop ERP density. Touch layouts retain their existing control sizes. */
.desktop-erp {
  grid-template-columns: 208px minmax(0, 1fr);
}
.desktop-erp .sidebar {
  width: 208px;
  padding: 16px 10px;
}
.desktop-erp .brand {
  font-size: 16px;
  padding-bottom: 16px;
}
.desktop-erp .brand-icon {
  width: 34px;
  height: 34px;
}
.desktop-erp .nav-item {
  padding: 9px 10px;
  margin-bottom: 2px;
  gap: 9px;
}
.desktop-erp .topbar {
  height: 56px;
  padding: 0 16px;
}
.desktop-erp .page {
  padding: 12px 16px;
  max-width: none;
}
.desktop-erp .page-heading {
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.desktop-erp .page-heading > :first-child {
  flex: 0 1 260px;
  min-width: 200px;
}
.desktop-erp .page-heading h1 {
  font-size: 22px;
  line-height: 1.3;
}
.desktop-erp .page-heading .eyebrow {
  font-size: 9px;
  letter-spacing: 0.8px;
  margin-bottom: 3px;
}
.desktop-erp .subtitle {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
}
.desktop-erp .heading-actions {
  margin-left: auto;
  flex: none;
}
.desktop-erp .heading-actions:empty {
  display: none;
}
.desktop-erp .page-heading .task-toolbar,
.desktop-erp .page-heading .filter-toolbar,
.desktop-erp .page-heading .receipts-tabs {
  flex: 1 1 420px;
  width: auto;
  margin: 0;
  min-width: 0;
}
.desktop-erp .page-heading .task-toolbar {
  gap: 8px;
  flex-wrap: wrap;
}
.desktop-erp .task-toolbar .q-field {
  flex: 1 1 150px;
  min-width: 140px;
}
.desktop-erp .task-toolbar .q-space {
  display: none;
}
.desktop-erp .task-toolbar .q-btn {
  padding-inline: 9px;
}
.desktop-erp .task-toolbar .q-btn .q-icon {
  font-size: 18px;
  margin-right: 5px;
}
.desktop-erp .receipts-tabs .q-tab {
  min-height: 36px;
  padding: 0 10px;
}
.desktop-erp .receipts-tabs .q-tab__label {
  font-size: 13px;
}
.desktop-erp .receipts-tabs .q-tab__icon {
  font-size: 20px;
}
.desktop-erp .q-btn {
  min-height: 32px;
  font-size: 12px;
}
.desktop-erp .q-field {
  font-size: 13px;
}
.desktop-erp .panel {
  padding: 12px;
  margin-bottom: 12px;
}
.desktop-erp .panel-head {
  gap: 8px;
  margin-bottom: 10px;
}
.desktop-erp h2 {
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 10px;
}
.desktop-erp .panel-head h2 {
  margin-bottom: 0;
}
.desktop-erp h3 {
  font-size: 14px;
  line-height: 1.4;
}
.desktop-erp p {
  margin-bottom: 8px;
}
.desktop-erp .period {
  gap: 8px;
  margin-bottom: 10px;
}
.desktop-erp .period .q-field {
  min-width: 135px;
  flex-basis: 150px;
}
.desktop-erp .filter-toolbar .expense-filter {
  min-width: 175px;
  flex-basis: 190px;
}
.desktop-erp .note {
  padding: 8px 12px;
  line-height: 1.4;
  margin-bottom: 10px;
}
.desktop-erp .kpis {
  gap: 10px;
  margin-bottom: 12px;
}
.desktop-erp .kpi {
  padding: 12px;
}
.desktop-erp .kpi-value {
  font-size: 24px;
  margin: 6px 0 2px;
}
.desktop-erp .columns,
.desktop-erp .cards {
  gap: 12px;
}
.desktop-erp .work-card {
  padding: 12px;
}
.desktop-erp .work-meta {
  margin-top: 10px;
}
.desktop-erp .doc-row {
  padding-block: 8px;
}
.desktop-erp .receipt-main-fields,
.desktop-erp .receipt-filters {
  gap: 8px;
  margin: 8px 0;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}
.desktop-erp .receipt-journal-total {
  margin: 0 0 8px;
  padding-block: 4px;
}
.desktop-erp .receipt-filters {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.desktop-erp .receipt-filters .q-field {
  min-width: 0;
}
.desktop-erp .page-heading .debt-report-kpis {
  flex: 1 1 420px;
  min-width: 0;
  margin: 0;
}
.desktop-erp .receipt-total {
  padding: 8px 0;
  margin: 10px 0;
}
.desktop-erp .receipt-lines-heading {
  margin-top: 12px;
}
.desktop-erp .batch-paste {
  margin: 8px 0;
}
.desktop-erp .batch-actions {
  gap: 8px;
  margin: 4px 0;
}
.desktop-erp .batch-grid-row {
  padding-block: 4px;
}
.desktop-erp .q-table__top {
  padding: 8px 10px;
}
.desktop-erp .q-table th {
  height: 34px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}
.desktop-erp .q-table thead tr {
  height: 34px;
}
.desktop-erp .q-table tbody td {
  height: 38px;
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1.35;
}
.desktop-erp .q-table .badge {
  margin: 0;
  padding: 4px 7px;
}
.desktop-erp .q-table td:last-child {
  white-space: nowrap;
}
.desktop-erp .q-table .actions {
  flex-wrap: nowrap;
  gap: 2px;
}
.desktop-erp .q-table .q-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 2px;
  flex: none;
}
.desktop-erp .q-table .q-btn .q-icon {
  font-size: 19px;
}
.desktop-erp .tasks-table .q-table {
  min-width: 1000px;
  table-layout: auto;
}
.desktop-erp .tasks-table .q-table th {
  white-space: nowrap;
}
.desktop-erp .tasks-table .q-table th,
.desktop-erp .tasks-table .q-table td {
  padding: 5px 8px;
}
.desktop-erp .tasks-table .task-table-title {
  line-height: 1.35;
}
.desktop-erp .q-table .q-checkbox__inner {
  font-size: 28px;
}
.desktop-erp
  .q-table__bottom:not(.q-table__bottom--nodata):not(
    :has(.q-table__bottom-item)
  ) {
  display: none;
}

/* A bounded workspace lets the table own both scroll axes. */
.table-workspace {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.table-workspace .main {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.table-workspace .topbar {
  flex: none;
}
.table-workspace .page {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.table-workspace .page > * {
  flex-shrink: 0;
  min-width: 0;
  margin-block: 0;
}
.table-workspace .page > .q-table__container,
.table-workspace .page > .panel:has(> .q-table__container),
.table-workspace .receipt-workbench:has(.batch-grid) {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.table-workspace .panel > * {
  flex-shrink: 0;
  min-width: 0;
}
.table-workspace .panel > .q-table__container,
.table-workspace .batch-grid {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
}
.table-workspace .q-table__middle {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.table-workspace .q-table__top,
.table-workspace .q-table__bottom {
  flex: none;
}
.table-workspace .report-toolbar {
  flex-wrap: wrap;
  overflow: visible;
}
.table-workspace .report-toolbar .q-field {
  min-width: 115px;
}
.table-workspace .debt-register {
  flex-grow: 1.5 !important;
}
.table-workspace .debt-report-kpis .kpi {
  padding: 8px 12px;
}
.table-workspace .debt-report-kpis .kpi-value {
  font-size: 21px;
  margin: 3px 0 0;
}
.table-workspace.finance-screen .kpi {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 8px;
  padding: 8px 10px;
}
.table-workspace.finance-screen .kpi-value {
  font-size: 22px;
  margin: 0;
}
.table-workspace.finance-screen .kpi-note {
  grid-column: 1 / -1;
}
.table-workspace .debt-register .panel-head p {
  font-size: 12px;
  margin-top: 3px;
}
.table-workspace .q-table {
  min-width: 780px;
}
.table-workspace .members-table .q-table {
  min-width: max(100%, var(--members-min-width, 1067px));
}
.table-workspace .batch-paste .q-expansion-item__content {
  max-height: 160px;
  overflow: auto;
}

@media (min-width: 901px) {
  body:has(.desktop-erp) .q-dialog h2 {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  body:has(.desktop-erp) .q-dialog h3 {
    font-size: 15px;
    line-height: 1.4;
  }
  body:has(.desktop-erp) .q-dialog .q-card__section {
    padding: 16px;
  }
  body:has(.desktop-erp) .q-dialog .panel-head {
    margin-bottom: 12px;
  }
  body:has(.desktop-erp) .q-dialog .form-grid {
    gap: 12px;
  }
  body:has(.desktop-erp) .q-dialog .detail-facts {
    gap: 10px;
  }
}

/* Virtual spacer cells must never become sticky columns or acquire row height. */
.page .q-table .q-virtual-scroll__padding td,
.q-dialog .q-table .q-virtual-scroll__padding td {
  position: static !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Header controls moved beside the title on desktop stack naturally on touch. */
.shell:not(.desktop-erp) .page-heading {
  flex-wrap: wrap;
}
.shell:not(.desktop-erp) .page-heading > .task-toolbar,
.shell:not(.desktop-erp) .page-heading > .receipts-tabs,
.shell:not(.desktop-erp) .page-heading > .filter-toolbar {
  order: 3;
  flex: 1 0 100%;
  min-width: 0;
  margin: 4px 0 0;
}
.shell:not(.desktop-erp) .page-heading > .debt-report-kpis {
  order: 3;
  flex: 1 0 100%;
  margin: 4px 0 0;
}
.shell:not(.desktop-erp) .page-heading > :first-child {
  flex: 1;
}
.shell:not(.desktop-erp) .heading-actions:empty {
  display: none;
}

@media (max-width: 1200px) {
  .desktop-erp .page-heading > :first-child {
    flex-basis: 230px;
  }
  .desktop-erp .page-heading .task-toolbar {
    order: 3;
    flex-basis: 100%;
  }
  .desktop-erp .receipt-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .desktop-erp {
    grid-template-columns: minmax(0, 1fr);
  }
  .desktop-erp .page {
    padding-bottom: 76px;
  }
}

.q-dialog .meter-panel {
  width: min(760px, 94vw);
  max-width: 94vw;
  max-height: 85vh;
  overflow: auto;
  margin: 0;
}
