/* Screen-only document registers. This sheet is not loaded by print.html. */
@media screen {
  #document-workspace-register-panel:not(.register-revenue-mode) > .invoice-promises-panel {
    display: none;
  }
  #document-workspace-register-panel .register-mode-switch button[data-followup-count]:not([data-followup-count="0"])::after {
    content: attr(data-followup-count);
    min-width: 16px;
    height: 16px;
    margin-left: 5px;
    padding-inline: 3px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: #a33a2c;
    border-radius: 9px;
    font-size: 9px;
    line-height: 1;
  }
  #document-workspace-register-panel .register-table-frame {
    container: register-table / inline-size;
    min-width: 0;
  }

  .register-table-frame > .register-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .register-table > thead > tr > th,
  .register-table > tbody > tr > td {
    box-sizing: border-box;
    min-width: 0;
    padding: 10px 6px;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.5;
  }

  .register-table > thead > tr > th { font-size: 11px; }
  .register-table [data-register-column="document"] { width: 15%; }
  .register-table [data-register-column="job"] { width: 8%; }
  .register-table [data-register-column="party"] { width: 12%; }
  .register-table [data-register-column="date"] { width: 7%; }
  .register-table [data-register-column="due"] { width: 8%; }
  .register-table [data-register-column="total"],
  .register-table [data-register-column="paid"],
  .register-table [data-register-column="balance"] { width: 8%; }
  .register-table [data-register-column="status"] { width: 14%; }
  .register-table [data-register-column="actions"] { width: 12%; }

  .register-table[data-register-layout="billing"] [data-register-column="job"] { width: 12%; }
  .register-table[data-register-layout="billing"] [data-register-column="milestone"] { width: 14%; }
  .register-table[data-register-layout="billing"] [data-register-column="condition"] { width: 17%; }
  .register-table[data-register-layout="billing"] [data-register-column="date"],
  .register-table[data-register-layout="billing"] [data-register-column="due"] { width: 10%; }
  .register-table[data-register-layout="billing"] [data-register-column="total"] { width: 11%; }
  .register-table[data-register-layout="billing"] [data-register-column="document"],
  .register-table[data-register-layout="billing"] [data-register-column="status"] { width: 13%; }

  .register-table > tbody > tr > td:is([data-register-column="total"], [data-register-column="paid"], [data-register-column="balance"]) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .register-table td :is(small, p, a, button, summary, .mono, .due-date-cell) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .register-table td :is(small, .subtext) { font-size: 11px; }
  .register-table td .subtext { margin-left: 0; }
  .register-table td :is(.inv-status-control, .inv-status-summary, .document-workflow, .document-row-actions, .quotation-status-history, .qt-row-lock, .wo-status-control) {
    width: auto;
    min-width: 0;
    max-width: 100%;
  }
  .register-table td .inv-status-summary { grid-template-columns: minmax(0, 1fr); }
  .register-table td :is(select, input, button, .mini-action) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
  .register-table td select { width: 100%; font-size: 12px; }
  .register-table td :is(button:not(.qt-row-link), .mini-action, summary) { min-height: 30px; }
  .register-table td :is(.document-row-actions, .quotation-print-actions, .inv-status-actions) { flex-wrap: wrap; gap: 5px; }
  .register-table td details { min-width: 0; max-width: 100%; white-space: normal; }
  .register-table td details .table-wrap { margin: 0; max-width: 100%; overflow: auto; }
  .register-table td details table { width: 100%; min-width: 0; table-layout: fixed; }
  .register-table td details :is(th, td) { min-width: 0; white-space: normal; overflow-wrap: anywhere; }

  /* Use the actual register width, not the browser width (the sidebar varies). */
  @container register-table (max-width: 1040px) {
    .register-table-frame > .register-table,
    .register-table > tbody { display: block; }
    .register-table > thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
    .register-table > tbody > tr {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      border-bottom: 2px solid var(--line, #e4e7e9);
      padding: 6px 4px;
      background: #fff;
    }
    .register-table > tbody > tr:nth-child(even) { background: #f8f9fa; }
    .register-table > tbody > tr > td {
      width: auto;
      max-width: none;
      min-width: 0;
      padding: 8px 10px;
      border: 0;
      grid-column: span 2;
      font-size: 13px;
    }
    .register-table > tbody > tr > td::before {
      content: attr(data-register-label);
      display: block;
      margin-bottom: 4px;
      font-weight: 600;
      line-height: 1.4;
      font-family: inherit;
      font-size: 11px;
      color: #65727b;
    }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="document"] { grid-column: span 3; order: 0; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="party"] { grid-column: span 3; order: 1; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="job"] { order: 2; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="date"] { order: 3; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="due"] { order: 4; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="total"] { order: 5; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="paid"] { order: 6; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="balance"] { order: 7; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="status"] { grid-column: span 3; order: 8; }
    .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="actions"] { grid-column: span 3; order: 9; }
    .register-table > tbody > tr > td:is([data-register-column="total"], [data-register-column="paid"], [data-register-column="balance"]) {
      background: #eef2f4;
      text-align: left;
    }
    .register-table[data-register-layout="billing"] > tbody > tr > td { grid-column: span 2; }
    .register-table[data-register-layout="billing"] > tbody > tr > td:is([data-register-column="document"], [data-register-column="status"]) { grid-column: span 3; }
    .register-table > tbody > tr > td[data-register-column="empty"] { grid-column: 1 / -1; }
    .register-table > tbody > tr > td[data-register-column="empty"]::before { content: none; }
  }

  @container register-table (max-width: 520px) {
    .register-table > tbody > tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-table[data-register-layout] > tbody > tr > td { grid-column: span 1; }
    .register-table[data-register-layout] > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="due"], [data-register-column="balance"], [data-register-column="condition"], [data-register-column="status"], [data-register-column="actions"], [data-register-column="empty"]) { grid-column: 1 / -1; }
  }
}

@layer phasuta-typography {
  @media screen {
    .register-category-heading strong[data-ph-type] { font-size: 16px !important; }
  }
}

.open-well-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.open-well-summary article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #ccd8df;
  border-radius: 8px;
  background: #f5f8fa;
}
.open-well-summary article b { color: #263d4a; }
.open-well-summary article span { color: #356e96; font-weight: 700; text-align: right; }
@media (max-width: 700px) {
  .open-well-summary { grid-template-columns: 1fr; }
}

/* Dense, classic register: short selectable rows; full original controls below. */
@media screen {
  .register-compact { container: compact-list / inline-size; margin: 0 -23px -23px; }
  .register-compact-hint { margin: 0; padding: 8px 10px; color: #65727b; font-size: 11px; border-bottom: 1px solid var(--line); }
  .register-compact > .register-compact-table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
  .register-compact-table > :is(thead, tbody) > tr > :is(th, td) {
    box-sizing: border-box;
    height: 34px;
    padding: 5px 6px;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    border-bottom: 1px solid #e2e6e9;
  }
  .register-compact-table > thead > tr > th {
    background: #e8edf0;
    color: #243744;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    text-align: center;
  }
  .register-compact-table th:nth-child(1) { width: 21%; }
  .register-compact-table th:nth-child(2) { width: 23%; }
  .register-compact-table th:nth-child(3) { width: 10%; }
  .register-compact-table th:nth-child(4),
  .register-compact-table th:nth-child(5) { width: 13%; }
  .register-compact-table th:nth-child(6) { width: 14%; }
  .register-compact-table th:nth-child(7) { width: 6%; }
  .register-compact-table[data-layout="documents"] th:nth-child(1) { width: 23%; }
  .register-compact-table[data-layout="documents"] th:nth-child(2) { width: 25%; }
  .register-compact-table[data-layout="documents"] th:nth-child(3) { width: 11%; }
  .register-compact-table[data-layout="documents"] th:nth-child(4),
  .register-compact-table[data-layout="documents"] th:nth-child(5) { width: 13%; }
  .register-compact-table[data-layout="documents"] th:nth-child(6) { width: 15%; }
  .register-compact-table .register-number { font: 600 11px/1.3 ui-monospace, Consolas, monospace; }
  .register-compact-table[data-layout="documents"] > :is(thead, tbody) > tr > :is(th, td):is(:nth-child(4), :nth-child(5)),
  .register-compact-table[data-layout="billing"] > :is(thead, tbody) > tr > :is(th, td):nth-child(5) { text-align: right; font-variant-numeric: tabular-nums; }
  .register-compact-table > tbody > tr:nth-child(even) { background: #f6f8f9; }
  .register-compact-table > tbody > tr[data-row-key] { cursor: pointer; }
  .register-compact-table > tbody > tr[data-row-key]:hover { background: #eaf1f6; }
  .register-compact-table > tbody > tr.is-selected { background: #dceaf5; box-shadow: inset 3px 0 #356e96; }
  .register-compact-table > tbody > tr[hidden] { display: none !important; }
  .register-compact-table > tbody > tr.register-category-row {
    display: table-row;
    background: #175b49 !important;
    border-top: 1px solid #0f4738;
    border-bottom: 1px solid #0f4738;
  }
  .register-compact-table > tbody > tr.register-category-empty {
    background: #fbfcfc;
    border-left: 1px solid #b8cbc4;
    border-right: 1px solid #b8cbc4;
    border-bottom: 1px solid #b8cbc4;
  }
  .register-compact-table > tbody > tr.register-category-empty > td {
    height: 30px;
    padding: 5px 9px;
    color: #71817b;
    font-size: 11px;
    font-style: italic;
    text-align: left;
  }
  .register-compact-table > tbody > tr.register-category-row > td {
    display: table-cell;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    line-height: 1.2;
  }
  .register-compact-table > tbody > tr.register-type-row {
    display: table-row;
    background: #e8f0ed;
    border-left: 3px solid #4f8070;
    border-bottom: 1px solid #b9cbc4;
  }
  .register-compact-table > tbody > tr.register-type-row > td {
    display: table-cell;
    width: 100%;
    height: auto;
    padding: 0;
    line-height: 1.2;
  }
  .register-type-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
  }
  .register-type-heading strong { color: #234d41; font-size: 12px; }
  .register-type-heading small { color: #587269; font-size: 10px; white-space: nowrap; }
  .register-compact-table > tbody > tr.register-type-first { border-top: 0; }
  .register-compact-table > tbody > tr.register-type-last { border-bottom: 2px solid #cddbd6; }
  .register-category-row button {
    width: 100% !important;
    max-width: none !important;
    min-height: 29px;
    padding: 5px 10px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #fff !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: left;
    font-weight: 700;
  }
  .register-category-row button small { color: #d9ebe5 !important; font-size: 12px !important; font-weight: 500; white-space: nowrap; background: transparent !important; }
  .register-category-tools button {
    min-height: 24px;
    margin-left: 3px;
    padding: 2px 6px;
    color: #365f53;
    background: #fff;
    border: 1px solid #adc3ba;
    border-radius: 4px;
    font-size: 9px;
  }
  .register-simple-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 6px;
  }
  .register-simple-categories {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .register-simple-categories strong { color: #24483e; font-size: 11px; white-space: nowrap; }
  .register-simple-categories > small { color: #71817b; font-size: 9px; white-space: nowrap; }
  .register-category-heading {
    min-height: 30px;
    padding: 5px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .register-category-heading strong { color: #fff !important; font-size: 16px !important; background: transparent !important; }
  .register-category-heading small { color: #d9ebe5 !important; font-size: 12px !important; font-weight: 600; white-space: nowrap; background: transparent !important; }
  .register-category-toggle { width: 100%; cursor: pointer; text-align: left; }
  .register-compact-table > tbody > tr.register-category-item {
    border-left: 1px solid #b8cbc4;
    border-right: 1px solid #b8cbc4;
  }
  .register-compact-table > tbody > tr.register-category-last {
    margin-bottom: 7px;
    border-bottom: 1px solid #b8cbc4;
    border-radius: 0 0 5px 5px;
  }
  .register-category-choice,
  .register-advanced-toggle,
  .register-filter-toggle,
  .register-category-actions button {
    min-height: 30px;
    padding: 3px 8px;
    white-space: nowrap;
    color: #31594e;
    background: #fff;
    border: 1px solid #b9cbc4;
    border-radius: 6px;
    font-size: 10px;
  }
  .register-category-choice { display: inline-flex; align-items: center; gap: 5px; }
  .register-category-actions { display: inline-flex; gap: 4px; }
  #document-workspace-register-panel .register-mode-switch button,
  #document-workspace-register-panel .register-filter-toggle,
  #document-workspace-register-panel .register-category-actions button {
    color: #fff !important;
    background: #175b49 !important;
    border-color: #175b49 !important;
  }
  #document-workspace-register-panel .register-mode-switch button[aria-pressed="true"] {
    box-shadow: 0 0 0 2px #9fcbbd;
  }
  .register-category-choice small {
    min-width: 18px;
    padding: 1px 4px;
    color: #506860;
    background: #edf2f0;
    border-radius: 9px;
    text-align: center;
    font-size: 9px;
  }
  .register-category-choice[aria-pressed="true"] {
    color: #fff;
    background: #175b49;
    border-color: #175b49;
  }
  .register-category-choice[aria-pressed="true"] small { color: #174b3f; background: #fff; }
  #document-workspace-register-panel .panel:not(.register-advanced-open) .document-register-filters > label:not(.register-query) { display: none; }
  #document-workspace-register-panel .panel:not(.register-advanced-open) .document-register-filters {
    display: none !important;
  }
  #document-workspace-register-panel .panel:not(.register-advanced-open) .document-register-filters .register-query { grid-column: auto; }
  #document-workspace-register-panel .panel:not(.register-advanced-open) .register-filter-actions > button,
  #document-workspace-register-panel .panel:not(.register-advanced-open) .register-filter-actions > .danger-text { display: none; }
  #document-workspace-register-panel .panel:not(.register-advanced-open) .register-filter-actions {
    min-height: 0;
    padding-block: 3px;
  }
  /* The register controls and column headings already explain the workspace.
     Hide duplicated helper copy so the document list begins immediately. */
  #document-workspace-register-panel .register-inline-host > .panel-head,
  #document-workspace-register-panel .register-filter-actions > [role="status"],
  #document-workspace-register-panel .register-compact-hint {
    display: none !important;
  }
  .register-compact-table > tbody > tr:focus-visible { outline: 2px solid #356e96; outline-offset: -2px; }
  .register-compact-table button { padding: 3px 7px; min-width: 0; min-height: 26px; font: inherit; line-height: 1.2; color: #244f70; border: 1px solid #b8c9d6; border-radius: 2px; background: #fff; cursor: pointer; }
  .register-compact-table .register-empty { height: 44px; text-align: center; white-space: normal; }
  .register-detail-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 36px -23px 0; padding: 10px; background: #e8edf0; border-top: 2px solid #356e96; font-size: 13px; scroll-margin-top: 100px; }
  .register-detail-header strong { min-width: 0; overflow-wrap: anywhere; }
  .register-detail-header button { min-height: 30px; padding: 4px 8px; white-space: nowrap; font-size: 12px; }
  .register-detail-header[hidden], .register-detail-frame[hidden] { display: none !important; }
  .register-detail-frame > .register-table,
  .register-detail-frame > .register-table > tbody { display: block; }
  .register-detail-frame > .register-table > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .register-detail-frame > .register-table > tbody > tr { display: none; }
  .register-detail-frame > .register-table > tbody > tr[data-register-selected="true"] { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 6px 4px; background: #fff; }
  .register-detail-frame > .register-table > tbody > tr > td { width: auto; min-width: 0; padding: 8px 10px; grid-column: span 2; border: 0; }
  .register-detail-frame > .register-table > tbody > tr > td::before { content: attr(data-register-label); display: block; margin-bottom: 4px; color: #65727b; font: 600 11px/1.4 sans-serif; }
  .register-detail-frame > .register-table > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="status"], [data-register-column="actions"]) { grid-column: span 3; }
  @container register-table (max-width: 520px) {
    .register-detail-frame > .register-table > tbody > tr[data-register-selected="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-detail-frame > .register-table > tbody > tr > td { grid-column: span 1; }
    .register-detail-frame > .register-table > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="due"], [data-register-column="balance"], [data-register-column="condition"], [data-register-column="status"], [data-register-column="actions"]) { grid-column: 1 / -1; }
  }
  @container compact-list (max-width: 620px) {
    .register-compact-table > :is(thead, tbody) > tr > :is(th, td):is(:nth-child(3), :nth-child(4), :nth-child(6)) { display: none; }
    .register-compact-table th:nth-child(1) { width: 35%; }
    .register-compact-table th:nth-child(2) { width: 31%; }
    .register-compact-table th:nth-child(5) { width: 25%; }
    .register-compact-table th:nth-child(7) { width: 9%; }
    .register-compact-table > :is(thead, tbody) > tr > :is(th, td) { font-size: 11px; padding: 5px 4px; }
    .register-compact-table .register-number { white-space: normal; overflow-wrap: anywhere; font-size: 10px; }
    .register-compact-table button { padding: 3px 5px; }
  }
}

/* Interleave summaries with original detail rows without moving React nodes. */
@media screen {
  #document-workspace-register-panel .register-inline-host {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    container: register-inline / inline-size;
  }
  .register-inline-host > * { min-width: 0; }
  .register-inline-host .register-compact,
  .register-compact > .register-compact-table,
  .register-compact-table > :is(thead, tbody),
  .register-inline-host > .register-detail-frame,
  .register-detail-frame > .register-table,
  .register-detail-frame > .register-table > tbody { display: contents; }
  .register-compact-hint { order: 10; margin: 0 -23px; }
  .register-compact-table > :is(thead, tbody) > tr {
    display: grid;
    grid-template-columns: 21% 23% 10% 13% 13% 14% 6%;
    margin: 0 -23px;
    min-width: 0;
    border-bottom: 1px solid #e4e8eb;
  }
  .register-compact-table[data-layout="documents"] > :is(thead, tbody) > tr {
    grid-template-columns: 23% 27% 10% 14% 14% 12%;
  }
  .register-compact-table > tbody > tr.register-category-row {
    grid-template-columns: 1fr;
    margin: 0 -23px;
    border-radius: 5px 5px 0 0;
  }
  .register-compact-table > tbody > tr.register-category-row > td { grid-column: 1 / -1; }
  .register-compact-table > tbody > tr.register-type-row {
    display: grid;
    grid-template-columns: 1fr;
    margin: 0 -23px;
  }
  .register-compact-table > tbody > tr.register-type-row > td { grid-column: 1 / -1; }
  .register-compact-table > tbody > tr.register-category-item {
    margin-inline: -23px;
  }
  .register-compact-table > thead > tr { order: 20; background: #e8edf0; }
  .register-compact-table > thead > tr > th {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    padding: 4px 3px;
  }
  .register-compact-table[data-layout="documents"] > thead > tr > th:nth-child(n+3) {
    justify-content: center;
  }
  .register-compact-table > tbody > tr { order: 100; }
  .register-compact-table > :is(thead, tbody) > tr > :is(th, td) {
    display: block;
    width: auto;
    height: auto;
    min-height: 35px;
    line-height: 25px;
    border: 0;
  }
  .register-compact-table button { min-height: 25px; vertical-align: top; }
  .register-compact-table > thead > tr > th:nth-child(n) { width: auto; }
  .register-compact-table .register-number { line-height: 25px; }
  .register-compact-table .register-empty { grid-column: 1 / -1; }
  .register-detail-header { margin: 0 -23px; padding: 8px 10px; background: #edf3f7; border-top: 0; border-left: 3px solid #356e96; font-size: 12px; }
  .register-inline-host > .register-detail-header[hidden],
  .register-inline-host > .register-detail-frame[hidden] { display: none !important; }
  .register-detail-frame > .register-table > thead { display: none; }
  .register-detail-frame > .register-table > tbody > tr[data-register-selected="true"] {
    min-width: 0;
    margin: 0 -23px;
    padding-bottom: 12px;
    border-left: 3px solid #356e96;
    border-bottom: 2px solid #b8c9d6;
  }
  .register-detail-frame > .register-table[data-register-layout] > tbody > tr > td { width: auto; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="document"] { order: 0; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="party"] { order: 1; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="job"] { order: 2; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="date"] { order: 3; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="due"] { order: 4; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="total"] { order: 5; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="paid"] { order: 6; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="balance"] { order: 7; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="status"] { order: 8; }
  .register-table[data-register-layout="documents"] > tbody > tr > [data-register-column="actions"] { order: 9; }
  .register-table > tbody > tr > td:is([data-register-column="total"], [data-register-column="paid"], [data-register-column="balance"]) { background: #eef2f4; text-align: left; }
  @container register-inline (max-width: 574px) {
    .register-compact-table > :is(thead, tbody) > tr { grid-template-columns: 35% 31% 25% 9%; }
    .register-compact-table[data-layout="documents"] > :is(thead, tbody) > tr { grid-template-columns: 38% 36% 26%; }
    .register-compact-table > :is(thead, tbody) > tr > :is(th, td):is(:nth-child(3), :nth-child(4), :nth-child(6)) { display: none; }
    .register-compact-table > :is(thead, tbody) > tr > :is(th, td) { font-size: 11px; padding: 5px 4px; }
    .register-compact-table .register-number { font-size: 10px; }
    .register-compact-table button { padding: 3px 2px; }
    .register-category-row button { padding-inline: 6px; }
    .register-category-row button small { font-size: 9px; }
  }
  @media (max-width: 760px), (pointer: coarse) {
    .register-category-choice, .register-advanced-toggle, .register-filter-toggle, .register-category-actions button { min-height: 42px; }
    .register-simple-nav { align-items: stretch; }
  }
  @media (max-width: 560px) {
    .register-simple-nav { display: grid; }
    .register-category-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .register-advanced-toggle, .register-filter-toggle { width: 100%; }
  }
  @container register-inline (max-width: 474px) {
    .register-detail-frame > .register-table > tbody > tr[data-register-selected="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-detail-frame > .register-table > tbody > tr > td { grid-column: span 1; }
    .register-detail-frame > .register-table > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="due"], [data-register-column="balance"], [data-register-column="condition"], [data-register-column="status"], [data-register-column="actions"]) { grid-column: 1 / -1; }
  }

  /* The expanded document is a real child of the compact register, so its
     visual position always follows the selected row instead of the source
     table's position at the bottom of the panel. */
  .register-compact-table > tbody > tr.register-inline-detail-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    margin: 0 -23px;
    padding: 0;
    background: #f7fafc;
    border-left: 3px solid #356e96;
    border-bottom: 2px solid #b8c9d6;
  }
  .register-compact-table > tbody > tr.register-inline-detail-row > td {
    display: block !important;
    grid-column: 1 / -1;
    width: auto !important;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
    white-space: normal;
    line-height: normal;
  }
  .register-inline-detail-row .register-detail-header {
    margin: 0;
    border-left: 0;
    border-bottom: 1px solid #ccd8df;
  }
  .register-inline-detail-content { min-width: 0; }
  .register-inline-detail-table,
  .register-inline-detail-table > tbody { display: block; width: 100%; }
  .register-inline-detail-table > tbody > tr[data-register-selected="true"] {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    min-width: 0;
    padding: 6px 4px 12px;
    background: #fff;
  }
  .register-inline-detail-table > tbody > tr > td {
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    padding: 8px 10px;
    grid-column: span 2;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .register-inline-detail-table > tbody > tr > td::before {
    content: attr(data-register-label);
    display: block;
    margin-bottom: 4px;
    color: #65727b;
    font: 600 11px/1.4 sans-serif;
  }
  .register-inline-detail-table .register-inline-edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 4px 0;
    padding: 6px 14px;
    color: #fff;
    background: #175b49;
    border: 1px solid #175b49;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
  }
  .register-inline-detail-table .register-inline-edit-button:hover { background: #0f4738; border-color: #0f4738; }
  .register-inline-detail-table .register-inline-edit-button:focus-visible { outline: 3px solid #c58c36; outline-offset: 2px; }
  .register-inline-detail-table .register-inline-edit-button:disabled { opacity: .5; cursor: not-allowed; }
  .register-inline-detail-table .register-inline-document-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 4px 0 8px;
  }
  .register-inline-detail-table > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="status"], [data-register-column="actions"]) {
    grid-column: span 3;
  }
  @container register-inline (max-width: 474px) {
    .register-inline-detail-table > tbody > tr[data-register-selected="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-inline-detail-table > tbody > tr > td { grid-column: span 1; }
    .register-inline-detail-table > tbody > tr > td:is([data-register-column="document"], [data-register-column="party"], [data-register-column="due"], [data-register-column="balance"], [data-register-column="condition"], [data-register-column="status"], [data-register-column="actions"]) { grid-column: 1 / -1; }
  }

  /* QT detail: keep every field, but group the summary and workflow into two
     compact desktop rows.  The narrower layouts below deliberately expand
     the controls again so touch targets and long Thai labels stay readable. */
  .register-inline-detail-table > tbody > tr.qt-register-row[data-register-selected="true"] {
    grid-template-columns: repeat(15, minmax(0, 1fr));
    align-items: start;
    padding: 4px 6px 8px;
  }
  .register-inline-detail-table > tbody > tr.qt-register-row > td {
    padding: 6px 8px;
  }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="document"] { grid-column: span 3; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="party"] { grid-column: span 5; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="job"] { grid-column: span 2; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="date"] { grid-column: span 2; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="due"] { grid-column: span 3; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="total"],
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="paid"],
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="balance"] { grid-column: span 2; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="status"] { grid-column: span 5; }
  .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="actions"] { grid-column: span 4; }
  .register-inline-detail-table .qt-register-row .quotation-split-status {
    grid-template-columns: minmax(88px, .82fr) minmax(126px, 1.18fr);
    gap: 6px;
    min-width: 0;
  }
  .register-inline-detail-table .qt-register-row .quotation-split-status label { gap: 2px; }
  .register-inline-detail-table .qt-register-row .quotation-split-status select { min-height: 34px; }
  .register-inline-detail-table .qt-register-row .quotation-print-actions { display: inline-flex; margin: 6px 8px 0 0; }
  .register-inline-detail-table .qt-register-row .quotation-print-button { min-height: 32px; padding: 5px 12px; }
  .register-inline-detail-table .qt-register-row .quotation-status-history { display: inline-block; max-width: none; vertical-align: middle; }
  .register-inline-detail-table .qt-register-row .quotation-status-history summary { margin: 4px 0; }
  .register-inline-detail-table .qt-register-row .register-inline-document-actions { gap: 6px; margin: 0 0 5px; }
  .register-inline-detail-table .qt-register-row .register-inline-edit-button { min-height: 32px; margin: 0; padding: 5px 10px; }
  .register-inline-detail-table .qt-register-row [data-register-column="actions"] details { margin-top: 4px; }

  @container register-inline (max-width: 760px) {
    .register-inline-detail-table > tbody > tr.qt-register-row[data-register-selected="true"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="document"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="job"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="date"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="due"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="total"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="paid"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="balance"] { grid-column: span 1; }
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="party"] { grid-column: span 2; }
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="status"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="actions"] { grid-column: span 2; }
  }
  @container register-inline (max-width: 474px) {
    .register-inline-detail-table > tbody > tr.qt-register-row[data-register-selected="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="party"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="due"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="balance"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="status"],
    .register-inline-detail-table > tbody > tr.qt-register-row > [data-register-column="actions"] { grid-column: 1 / -1; }
    .register-inline-detail-table .qt-register-row .quotation-split-status { grid-template-columns: 1fr; }
  }
}
