/* Shared workspace surfaces. Copy the existing frameless partner/finance and
   employee-hours layouts from professional.css: the page itself is the shell.
   These selectors deliberately name layout wrappers, never arbitrary cards.
   Data cards, selectable items, summaries, menus and modal boundaries remain. */
body:not(.shop-public-mode) #tableView > .table-panel,
body:not(.shop-public-mode) #tableView:is(.is-partners-workspace, .is-settings-workspace) > .table-panel,
body:not(.shop-public-mode) #tableView > #actionPanel > .action-card,
body:not(.shop-public-mode) #tableView #subNavPanel > .subnav-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* A scrolling table already supplies its header and row separators. Its page
   container must not draw a second rectangle; scrolling and sizing stay native
   to each module. Only the direct outer wrapper is affected. */
body:not(.shop-public-mode) #tableView > .table-panel > .table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Many workspaces are mounted in the shared table's one presentation cell.
   Clear that cell's decoration without touching ordinary data table cells. */
body:not(.shop-public-mode) #tableView > .table-panel > .table-wrap > table > tbody > tr > .full-panel-cell {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Single-workflow editors and lists follow the existing employee-hours page.
   Actual note cards, task rows, product cards and debt entries retain their
   own boundaries and selected/state colours. Grid gaps separate columns. */
body:not(.shop-public-mode) #tableView .todo-page > :is(.todo-editor-card, .todo-list-card),
body:not(.shop-public-mode) #tableView .note-page > :is(.note-editor-card, .note-list-card),
body:not(.shop-public-mode) #tableView .email-shell > .email-card,
body:not(.shop-public-mode) #tableView .email-page > .email-card,
body:not(.shop-public-mode) #tableView .email-template-page > .email-card,
body:not(.shop-public-mode) #tableView .order-inbox-page > .email-card,
body:not(.shop-public-mode) #tableView .market-admin-top-grid > .market-card,
body:not(.shop-public-mode) #tableView .market-admin-bottom-grid > .market-card,
body:not(.shop-public-mode) #tableView .market-notification-page > .market-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Layout-only padding need not surround already spaced page sections. */
body:not(.shop-public-mode) #tableView :is(.todo-page, .note-page) {
  padding: 0;
}
body:not(.shop-public-mode) #tableView .email-shell > .email-card + .email-card {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Billing's form has its own compact fold headings and item-row boundaries.
   Remove the form-column cards, retaining the sticky toolbar's opaque themed
   background so scrolling content cannot show through it. */
body:not(.shop-public-mode) #tableView.is-billing-view .billing-reform #billingForm > :is(.billing-partner-column, .billing-order-column) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-reform > .billing-order-toolbar {
  padding-inline: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

/* Billing uses the same explicit page/header/navigation order as Accounting
   and Employee hours. Its adapter places the current billing tabs in the
   shared navigation before loading or painting a tab's own content. */
body:not(.shop-public-mode) #tableView.is-billing-view.is-visible {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
body:not(.shop-public-mode) #tableView.is-billing-view > #financeWorkspaceHead {
  grid-row: 1;
}
body:not(.shop-public-mode) #tableView.is-billing-view > #subNavPanel {
  grid-row: 2;
  margin-bottom: 18px;
}
body:not(.shop-public-mode) #tableView.is-billing-view > #actionPanel {
  grid-row: 3;
}
body:not(.shop-public-mode) #tableView.is-billing-view > .table-panel {
  grid-row: 4;
}
body:not(.shop-public-mode) #tableView.is-billing-view .finance-subnav-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
body:not(.shop-public-mode) #tableView.is-billing-view .finance-subnav-card > .subnav-head {
  grid-row: 1;
  min-width: 0;
  margin: 0;
}
body:not(.shop-public-mode) #tableView.is-billing-view .finance-detail-nav {
  grid-row: 2;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
body:not(.shop-public-mode) #tableView.is-billing-view .finance-subnav-card > .subnav-head:empty {
  display: none;
}
body:not(.shop-public-mode) #tableView.is-billing-view .finance-subnav-card > .subnav-head:empty + .finance-detail-nav {
  grid-row: 1;
}

/* Empty, completed documents, passport import and catalogue invoice are
   alternate contents of the same page. Their old standalone shell is not a
   data card: retain the form/rows and remove only that outer decoration.
   Catalogue invoice dialogs are deliberately outside this direct-page scope. */
body:not(.shop-public-mode) #tableView.is-billing-view .billing-page {
  min-width: 0;
  padding: 0;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-page > :is(.billing-empty-card, .billing-documents-panel, .billing-catalog-invoice-card) {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-page > :is(.billing-empty-card, .billing-documents-panel, .billing-catalog-invoice-card) :is(.billing-card-head h3, h3:first-child) {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

/* Completed documents reuse the wrapping action rows from partner/finance
   tables. Long numbers, partner names and actions stay inside their column;
   only the real table may scroll sideways at intermediate widths. */
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-panel > .table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table :is(th, td) {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table :is(th, td):nth-child(4) {
  width: 20%;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table :is(th, td):last-child {
  width: 25%;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table .action-cell {
  min-width: 0;
  max-width: none;
  white-space: normal;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-document-actions {
  gap: 6px;
  min-width: 0;
  margin: 0;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-document-actions > .mini-button,
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table [data-ekaer-open] {
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-pagination {
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  gap: 8px;
  margin-top: 12px;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-page-summary {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--font-button-size);
  text-align: center;
  overflow-wrap: anywhere;
}
body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-pagination > .ghost-button {
  min-height: 44px;
}
@media (max-width: 768px) {
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-panel > .table-wrap {
    overflow: visible;
    max-height: none;
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table {
    min-width: 0;
    max-width: 100%;
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table tbody tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
  }
  /* Billing has its own mobile row layout, so it does not receive the
     generic mobile-card-table transparent-cell rule. */
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table > tbody > tr > td {
    background: transparent;
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-table :is(th, td):is(:nth-child(4), :last-child) {
    width: auto;
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-document-actions > .mini-button {
    flex: 1 1 120px;
    min-height: 44px;
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  body:not(.shop-public-mode) #tableView.is-billing-view .billing-documents-page-summary {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

/* Inside an established section the table's own row separators are enough.
   Do not target all table wrappers: popovers, dialogs and standalone tables
   may still need their existing boundary. */
body:not(.shop-public-mode) #tableView .todo-list-card > .todo-table-wrap,
body:not(.shop-public-mode) #tableView .billing-documents-panel > .table-wrap,
body:not(.shop-public-mode) #tableView .email-card > .mini-table-wrap,
body:not(.shop-public-mode) #tableView .market-card > .mini-table-wrap,
body:not(.shop-public-mode) #tableView .delivery-sites-panel > .delivery-sites-table-wrap,
body:not(.shop-public-mode) #tableView .management-invite-card > .management-invite-table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* The company group remains the meaningful collapsible boundary. The second
   frame around its people list is redundant; row separators remain intact. */
body:not(.shop-public-mode) #tableView.is-management-view .management-company-group-body > .management-company-users {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Plant protection already separates numbered steps with horizontal rules.
   The additional enclosing workspace rectangle contributes no grouping. */
body:not(.shop-public-mode) #tableView.is-plant-protection-view .plant-protection-workspace {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body:not(.shop-public-mode) #tableView.is-plant-protection-view .plant-protection-workspace > .plant-protection-section {
  padding-inline: 0;
}

/* Dialogs keep their outer boundary. Their inner account forms follow the
   compact settings dialog pattern rather than adding nested form cards. */
body:not(.shop-public-mode) .customer-profile-dialog > .profile-settings-form > .profile-password-card {
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-settings-dialog.bank-match-dialog {
  width: min(640px, calc(100vw - 24px));
}

.bank-match-dialog .email-choice-list {
  grid-auto-rows: max-content;
  align-content: start;
}

.bank-match-dialog .email-choice-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bank-match-dialog .email-choice-row .field {
  margin-top: 8px;
}

.bank-match-dialog .bank-transaction-choice {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  text-align: left;
  white-space: normal;
}

.accounting-outgoing-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.accounting-transfer-status-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.accounting-transfer-bank-verification {
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.accounting-transfer-amount .accounting-transfer-status-stack {
  align-items: flex-end;
}

.accounting-bank-copy > button {
  justify-self: start;
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 1050px) {
  /* The task and note grids become one column at this existing breakpoint. */
  body:not(.shop-public-mode) #tableView .todo-page > .todo-editor-card + .todo-list-card,
  body:not(.shop-public-mode) #tableView .note-page > .note-editor-card + .note-list-card {
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 1100px), (any-pointer: coarse) {
  /* When the mail/editor columns stack, a simple section rule preserves their
     relationship without restoring the old rounded frames. */
  body:not(.shop-public-mode) #tableView .email-page > .email-card + .email-card,
  body:not(.shop-public-mode) #tableView .email-template-page > .email-card + .email-card,
  body:not(.shop-public-mode) #tableView .order-inbox-page > .email-card + .email-card,
  body:not(.shop-public-mode) #tableView .market-notification-page > .market-card + .market-card {
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
}

/* Debt workflows use the same frameless editor/list sections as partners,
   finance and mail. Equipment illustrations retain their own material colours. */
body:not(.shop-public-mode) #tableView .market-debt-page .market-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
/* Like the occupancy editor, a full workflow uses the page scroll rather than
   clipping its form and journal inside the shared data-table viewport. */
#tableView > .table-panel > .table-wrap:has(.market-debt-page) {
  max-height: none;
  overflow: visible;
  scrollbar-gutter: auto;
}
.market-debt-page {
  gap: 26px;
}
.market-debt-page .market-debt-layout {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 28px;
}
.market-debt-page .billing-card-head {
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 16px;
}
.market-debt-page .billing-card-head h3 {
  font-size: 1.05rem;
}
.market-debt-page .debt-section-count {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}
.market-debt-page .market-order-search-row {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.market-debt-page .market-debt-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
}
.market-debt-page .field,
.market-debt-page .market-debt-touch-section {
  min-width: 0;
}
.market-debt-page .market-debt-label {
  margin-bottom: 8px;
}
.debt-illustration {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  vertical-align: middle;
}
.market-debt-page .debt-visual-choices {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.market-debt-page .debt-visual-choices .market-debt-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 86px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .79rem;
  font-weight: 750;
  line-height: 1.25;
  box-shadow: none;
  white-space: normal;
}
.market-debt-page .debt-visual-choices .market-debt-choice:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
.market-debt-page .debt-visual-choices .market-debt-choice.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.market-debt-page .debt-visual-choices .market-debt-choice.is-active::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 6px;
  color: var(--primary-strong);
  font-size: .72rem;
}
.market-debt-page .market-debt-choice:focus-visible,
.market-debt-page .market-debt-partner-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.market-debt-page .market-debt-direction-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.market-debt-page .market-debt-direction-row .market-debt-choice {
  flex-direction: row;
  min-height: 46px;
  gap: 10px;
  font-size: .9rem;
}
.market-debt-page .market-debt-direction-row .debt-illustration {
  width: 24px;
  height: 24px;
}
.market-debt-page .market-debt-save-button {
  min-height: 46px;
  font-size: .93rem;
}
.market-debt-page .market-debt-summary-table-wrap {
  margin-top: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.market-debt-page .market-debt-summary-table {
  table-layout: fixed;
}
.market-debt-page .market-debt-summary-person-head {
  width: 150px;
  min-width: 0;
}
.market-debt-page .market-debt-summary-cell {
  min-width: 0;
  font-size: .84rem;
}
.market-debt-page .market-debt-summary-cell > .debt-cell-value {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.market-debt-page .market-debt-summary-head .debt-illustration {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 5px;
}
.market-debt-page .market-debt-summary-head > span {
  display: block;
  max-width: 96px;
  margin-inline: auto;
  white-space: normal;
}
.market-debt-page .market-debt-summary-table th,
.market-debt-page .market-debt-summary-table td {
  padding: 10px 8px;
}
.market-debt-page .market-debt-summary-person {
  min-width: 0;
  max-width: 240px;
  overflow-wrap: anywhere;
  white-space: normal;
  font-weight: 750;
  text-transform: none;
}
.market-debt-page .market-debt-summary-cell > .debt-cell-label {
  display: none;
}
.market-debt-page .market-debt-history-card {
  padding-top: 22px !important;
  border-top: 1px solid var(--line) !important;
}
.market-debt-page .market-debt-entry-list {
  gap: 0;
}
.market-debt-page .market-debt-entry-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px 18px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.market-debt-page .market-debt-entry-row:last-child {
  border-bottom: 0;
}
.market-debt-page .market-debt-entry-main {
  min-width: 0;
  overflow-wrap: anywhere;
}
.market-debt-page .debt-entry-person {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}
.market-debt-page .debt-entry-person .debt-illustration {
  width: 26px;
  height: 26px;
}
.market-debt-page .market-debt-entry-main strong {
  font-size: .94rem;
}
.market-debt-page .market-debt-entry-main > :is(span, small),
.market-debt-page .market-debt-entry-side small {
  font-size: .8rem;
  line-height: 1.5;
  font-weight: 550;
}
.market-debt-page .market-debt-entry-side {
  justify-items: end;
}
@media (max-width: 1180px) {
  .market-debt-page .market-debt-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .market-debt-page .market-debt-summary-card {
    padding-top: 22px !important;
    border-top: 1px solid var(--line) !important;
  }
}
@media (max-width: 680px) {
  .market-debt-page .market-debt-summary-table tbody {
    gap: 12px;
  }
  .market-debt-page .market-debt-summary-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 12px 14px;
    border-color: var(--line);
    box-shadow: none;
  }
  .market-debt-page .market-debt-summary-table .market-debt-partner-row.is-selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    box-shadow: inset 3px 0 0 var(--primary);
  }
  .market-debt-page .market-debt-summary-table th,
  .market-debt-page .market-debt-summary-table td {
    padding: 8px 0;
  }
  .market-debt-page .market-debt-summary-table .market-debt-summary-person {
    max-width: none;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  .market-debt-page .market-debt-summary-table .market-debt-summary-cell {
    min-height: 38px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .market-debt-page .market-debt-summary-cell::before {
    display: none;
  }
  .market-debt-page .market-debt-summary-cell > .debt-cell-label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    white-space: normal;
  }
  .market-debt-page .debt-cell-label .debt-illustration {
    width: 24px;
    height: 24px;
  }
  .market-debt-page .market-debt-summary-cell > .debt-cell-value {
    min-width: 0;
    font-size: .93rem;
    font-variant-numeric: tabular-nums;
  }
  .market-debt-page .market-debt-summary-cell.is-owed > .debt-cell-value {
    color: var(--danger);
  }
  .market-debt-page .market-debt-summary-cell.is-returned > .debt-cell-value {
    color: var(--color-success);
  }
  .market-debt-page .market-debt-entry-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
  }
  .market-debt-page .market-debt-entry-main {
    grid-row: 1 / 3;
  }
  .market-debt-page .market-debt-entry-side,
  .market-debt-page .market-debt-entry-row > button {
    grid-column: 2;
    justify-self: end;
  }
  .market-debt-page .market-debt-entry-side strong {
    font-size: .93rem;
  }
}
@media (max-width: 560px) {
  .market-debt-page .market-debt-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .market-debt-page .market-debt-lock-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .market-debt-page .market-debt-lock-row .market-debt-choice {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 58px;
    padding: 8px;
    gap: 7px;
    text-align: left;
  }
  .market-debt-page .market-debt-lock-row .debt-illustration {
    width: 30px;
    height: 30px;
  }
}

/* Movement editor: reuse the existing input, choice and table surfaces while
   keeping the reference's four quantities visible in a single compact form. */
.market-debt-page .debt-movement-form {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.debt-overview-column {
  display: grid;
  min-width: 0;
  gap: 24px;
}
.market-debt-page .market-debt-label small,
.debt-movement-form .field > span > small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}
.market-debt-page .market-debt-direction-row .market-debt-choice {
  min-height: 60px;
  padding: 10px;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
}
.debt-direction-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.debt-direction-copy strong {
  font-size: .85rem;
  line-height: 1.3;
}
.debt-direction-copy small {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 500;
  line-height: 1.3;
}
.market-debt-page .market-debt-direction-row .market-debt-choice.is-active {
  background: var(--primary-strong);
  color: var(--color-button-text, #fff);
}
.market-debt-page .market-debt-direction-row .is-active small,
.market-debt-page .market-debt-direction-row .is-active::after {
  color: inherit;
}
.market-debt-page .market-debt-direction-row .debt-illustration {
  stroke: currentColor;
}
.debt-quantity-list {
  display: grid;
  gap: 8px;
}
.debt-quantity-item {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(140px, 166px);
  gap: 8px;
  align-items: center;
  min-height: 62px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.debt-quantity-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink);
}
.debt-quantity-name .debt-illustration {
  width: 36px;
  height: 36px;
}
.debt-stepper {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  min-width: 0;
  padding-right: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.debt-quantity-item:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--selection-ring);
}
.debt-stepper.is-money {
  grid-template-columns: minmax(0, 1fr);
}
.market-debt-page .debt-stepper input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 2px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.market-debt-page .debt-stepper button {
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--primary-strong);
  font: inherit;
  font-size: 1.35rem;
}
.market-debt-page .debt-stepper button:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.debt-quantity-unit {
  position: absolute;
  right: 5px;
  color: var(--muted);
  font-size: .72rem;
}
.debt-movement-preview {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  color: var(--ink);
}
.debt-movement-preview > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.debt-movement-preview strong {
  font-size: .86rem;
}
.debt-movement-preview small,
.debt-movement-preview > div > span {
  font-size: .76rem;
  line-height: 1.4;
}
.debt-preview-check {
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-strong);
  color: var(--color-button-text, #fff);
}
.market-debt-page .debt-reference-balances {
  font-size: .84rem;
}
.market-debt-page .debt-reference-balances .market-debt-summary-person-head {
  width: 34%;
}
.market-debt-page .debt-reference-balances .market-debt-summary-person {
  max-width: none;
  line-height: 1.5;
}
.market-debt-page .debt-reference-balances thead th:last-child {
  width: 100px;
}
.market-debt-page .debt-reference-balances .debt-cell-value {
  white-space: normal;
  overflow-wrap: anywhere;
}
.market-debt-page .debt-reference-balances thead th {
  padding-block: 12px;
  text-transform: none;
  font-weight: 650;
  font-size: .73rem;
  line-height: 1.4;
  white-space: normal;
}
.market-debt-page .debt-reference-balances th,
.market-debt-page .debt-reference-balances td {
  border-right: 1px solid var(--line);
}
.market-debt-page .debt-reference-balances tr > :last-child {
  border-right: 0;
}
.market-debt-page .debt-reference-balances .is-owed {
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}
.market-debt-page .debt-reference-balances .is-returned {
  background: color-mix(in srgb, var(--color-success) 7%, var(--surface));
}
.debt-history-table-wrap {
  display: block;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.debt-history-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: .8rem;
}
.debt-history-table th,
.debt-history-table td {
  box-sizing: border-box;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  white-space: normal;
  text-transform: none;
}
.debt-history-table thead th:nth-child(1) { width: 84px; }
.debt-history-table thead th:nth-child(2) { width: 23%; }
.debt-history-table thead th:nth-child(3) { width: 84px; }
.debt-history-table thead th:nth-child(4) { width: 55px; }
.debt-history-table thead th:nth-child(5),
.debt-history-table thead th:nth-child(6) { width: 45px; }
.debt-history-table thead th:nth-child(7) { width: 80px; }
.debt-history-table thead th:nth-child(9) { width: 40px; }
.debt-history-table tbody td:first-child {
  white-space: nowrap;
  font-size: .68rem;
}
.debt-history-mobile-quantity {
  display: none;
}
.debt-history-direction {
  overflow-wrap: normal;
  word-break: normal;
}
.debt-history-table .debt-history-action {
  text-align: center;
  vertical-align: middle;
}
.debt-history-table .debt-history-action > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  color: var(--danger);
  line-height: 1;
  vertical-align: middle;
}
.debt-history-table .debt-delete-icon {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.debt-history-table thead th {
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}
.debt-history-table tbody th {
  min-width: 150px;
  max-width: 280px;
  font-weight: 650;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--surface);
}
.debt-history-table tr:last-child > * {
  border-bottom: 0;
}
.debt-history-table tr > :last-child {
  border-right: 0;
}
.debt-history-heading {
  display: grid;
  justify-items: center;
  gap: 3px;
}
.debt-history-heading .debt-illustration {
  width: 24px;
  height: 24px;
}
.debt-history-table .debt-history-quantity {
  min-width: 65px;
  text-align: center;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.debt-history-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
}
.debt-history-table .is-debt-out .debt-history-direction {
  color: var(--primary-strong);
}
.debt-history-table .is-debt-returned .debt-history-direction {
  color: var(--danger);
}
@media (max-width: 680px) {
  .market-debt-page .debt-reference-balances th,
  .market-debt-page .debt-reference-balances td {
    border-right: 0;
  }
  .market-debt-page .debt-history-table-wrap {
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
  }
  .debt-history-table,
  .debt-history-table tbody {
    display: block;
    min-width: 0;
  }
  .debt-history-table thead {
    display: none;
  }
  .market-debt-page .debt-history-table .debt-history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 8px;
    align-items: center;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  .market-debt-page .debt-history-table .debt-history-row:last-child {
    border-bottom: 0;
  }
  .market-debt-page .debt-history-table tbody th,
  .market-debt-page .debt-history-table td {
    display: block;
    position: static;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  .market-debt-page .debt-history-table td::before {
    display: none;
  }
  .market-debt-page .debt-history-table .debt-history-partner {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    font-size: .84rem;
  }
  .market-debt-page .debt-history-table .debt-history-date {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    color: var(--muted);
    text-align: right;
  }
  .market-debt-page .debt-history-table .debt-history-info {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
  }
  .market-debt-page .debt-history-table .debt-history-direction {
    white-space: nowrap;
  }
  .market-debt-page .debt-history-table .debt-history-mobile-quantity {
    display: inline;
    color: var(--ink);
  }
  .market-debt-page .debt-history-table .debt-history-quantity,
  .market-debt-page .debt-history-table .debt-history-notes.is-empty {
    display: none;
  }
  .market-debt-page .debt-history-table .debt-history-notes {
    grid-column: 1 / -1;
    grid-row: 3;
    color: var(--muted);
    font-size: .75rem;
    padding-top: 2px;
  }
  .market-debt-page .debt-history-table .debt-history-action {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
  .market-debt-page .debt-history-table .debt-history-action > button {
    min-width: 44px;
    min-height: 44px;
  }

}

.debt-quantity-list > .debt-cc-details {
  padding: 4px 0 8px;
}

/* Existing dropdown styles are retained in the shared floating layer. */
.plantaevo-floating-dropdown {
  z-index: 10090 !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
}

/* Compact debt rows keep the established controls and their touch targets. */
.market-debt-page .debt-quantity-item {
  grid-template-columns: minmax(80px, 1fr) minmax(144px, 166px);
  min-height: 54px;
  padding: 3px 6px;
}
.market-debt-page .debt-stepper:not(.is-money) {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}
.market-debt-page .debt-stepper input,
.market-debt-page .debt-stepper button {
  min-height: 44px;
}
.market-debt-page .debt-quantity-name .debt-illustration {
  width: 30px;
  height: 30px;
}
@media (max-width: 680px) {
  .market-debt-page,
  .market-debt-page .market-debt-layout,
  .market-debt-page .debt-overview-column {
    gap: 18px;
  }
  .market-debt-page .billing-card-head {
    margin-bottom: 10px;
  }
  .market-debt-page .debt-movement-form {
    gap: 10px;
  }
  .market-debt-page .debt-movement-form .field {
    gap: 5px;
  }
  .market-debt-page .market-debt-label {
    margin-bottom: 5px;
  }
  .market-debt-page .debt-movement-form .field > span > small {
    display: inline;
    margin: 0 0 0 6px;
  }
  .market-debt-page .market-debt-direction-row .market-debt-choice {
    min-height: 48px;
    padding: 6px 8px;
  }
  .market-debt-page .debt-quantity-list {
    gap: 4px;
  }
  .market-debt-page .debt-quantity-item {
    min-height: 50px;
    padding-block: 1px;
  }
  .market-debt-page .debt-cc-details {
    padding: 3px 0 5px;
  }
  .market-debt-page .market-debt-lock-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .market-debt-page .market-debt-lock-row .market-debt-choice {
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
    padding: 5px 2px;
    gap: 3px;
    text-align: center;
  }
  .market-debt-page .market-debt-lock-row .debt-illustration {
    width: 26px;
    height: 26px;
  }
  .market-debt-page .debt-movement-preview {
    padding: 8px;
    gap: 7px;
  }
  .market-debt-page .debt-movement-preview > div {
    gap: 2px;
  }
  .market-debt-page .market-debt-summary-card,
  .market-debt-page .market-debt-history-card {
    padding-top: 14px !important;
  }
  .market-debt-page .market-debt-summary-table tbody {
    gap: 8px;
  }
  .market-debt-page .market-debt-summary-table tbody tr {
    padding: 8px 10px;
  }
  .market-debt-page .market-debt-summary-table th,
  .market-debt-page .market-debt-summary-table td {
    padding: 3px 0;
  }
  .market-debt-page .market-debt-summary-table .market-debt-summary-person {
    line-height: 1.35;
    padding-bottom: 6px;
  }
  .market-debt-page .market-debt-summary-table .market-debt-summary-cell {
    min-height: 30px;
  }
  .market-debt-page .debt-cell-label .debt-illustration {
    width: 22px;
    height: 22px;
  }

}
