/* Layout only: keep identifiers intact and give detailed values the remaining space. */
.workspace, main, main > *, .panel, .panel-body { min-width: 0; }
main { max-width: none; padding-bottom: 90px; }
.table-scroll, [class$="-table-scroll"], .orders-list-scroll, .flg-table-scroll,
.of-monthly-scroll, .sailing-table-full { max-width: 100%; scrollbar-width: auto; }
.table-navigation-dock {
  position: fixed; bottom: 12px; z-index: 300; display: flex; align-items: center;
  gap: 10px; padding: 8px 12px; border: 1px solid #c7d9d0; border-radius: 9px;
  background: #fffffff5; box-shadow: 0 3px 18px #17212f26; color: #365247;
  font-size: 12px; pointer-events: auto;
}
.table-navigation-dock button { flex: 0 0 36px; min-height: 32px; border: 1px solid #ccd9d3; border-radius: 5px; background: #eef6f1; color: #176b50; }
.table-navigation-dock button:disabled { cursor: default; }
.table-navigation-dock input { min-width: 40px; flex: 1; width: 0; accent-color: #176b50; padding: 0; cursor: ew-resize; }
.table-navigation-hint { white-space: nowrap; }
.of-root .of-ledger-summary.of-ledger-nine-summary {
  grid-template-columns: repeat(auto-fit,minmax(165px,1fr)); gap: 14px 8px; overflow: visible;
}
.of-root .of-ledger-nine-summary .of-ledger-metric:nth-child(n) { min-width: 0; padding: 0 8px; }
.of-root .of-ledger-nine-summary .of-ledger-metric-value { flex-wrap: wrap; }
.of-root .of-ledger-table { min-width: 1500px; }
.of-ledger-table .of-ledger-invoice-cell > .of-ledger-invoice,
.of-ledger-table .of-ledger-invoice-cell > strong,
.of-ledger-table .of-ledger-invoice-cell > small:not(.of-order-entry-stage) {
  white-space: nowrap !important; overflow-wrap: normal !important; max-width: none !important;
}
.factory-table { min-width: 1390px; }
.factory-col-invoice { width: 142px; }
.factory-col-vo { width: 120px; }
.factory-col-container { width: 118px; }
.factory-col-mark { width: 80px; }
.factory-col-quantities { width: 350px; }
.factory-col-goods { width: 136px; }
.factory-col-fees { width: 162px; }
.factory-col-total { width: 150px; }
.factory-col-status { width: 100px; }
.factory-col-action { width: 92px; }
/* Fixed identifier widths reserve room for detailed cost cells. */
.factory-table { table-layout: fixed; }
.factory-table > thead > tr > th:first-child,
.factory-table > tbody > tr:not(.factory-editor-row) > td:first-child {
  position: sticky; left: 0; z-index: 2; background: #fff;
  box-shadow: 1px 0 #e2e7ed;
}
.factory-table > thead > tr > th:first-child { z-index: 4; background: #f7f9fb; }
.factory-table > tbody > tr.selected > td:first-child { background: #edf6f2; }
.factory-filters, .page-head, .panel-head, .toolbar { flex-wrap: wrap; }
.factory-filters { gap: 12px; }
.factory-filters > *, .toolbar > * { max-width: 100%; }
.of-root .of-ledger-filters { flex-wrap: wrap; }
@media (min-width: 761px) and (max-width: 1440px) {
  .sidebar { width: 184px; }
  .workspace { margin-left: 184px; }
  .sidebar .brand { font-size: 21px; padding: 14px 16px 20px; }
  .sidebar .brand span { font-size: 10px; }
  .sidebar .nav-item { padding-left: 10px; padding-right: 8px; gap: 10px; }
  .sidebar .nav-item small { font-size: 10px; }
  main, main.orders-main, main.factory-main, main.ledger-main, main.sailing-main { padding: 20px 18px 90px; }
  .topbar { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 760px) {
  main { padding-bottom: 90px; }
  .table-navigation-dock { gap: 6px; padding: 7px; }
  .table-navigation-hint { font-size: 11px; }
  .of-root .of-ledger-summary.of-ledger-nine-summary { grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); }
  .factory-filters label { flex-wrap: wrap; gap: 6px; max-width: 100%; }
  .factory-filters label select { max-width: 100%; }
  .page-head > div { min-width: 0; }
}
@media print { .table-navigation-dock { display: none; } }

/* Reserve native scrollbar space before hover or focus changes on Windows/macOS. */
.factory-table-scroll { scrollbar-gutter: stable; }

.of-ledger-table .of-ledger-invoice-cell { position: sticky; left: 0; z-index: 2; background: white; box-shadow: 1px 0 #e2e7ed; }
.of-ledger-table thead .of-ledger-invoice-cell { background: #f6f8fa; z-index: 4; }
dialog:has(.table-navigation-dock) { padding-bottom: 0; }

/* Every finance tab remains reachable with a regular mouse on narrow windows. */
main [role="tablist"], .of-tabs { flex-wrap: wrap; }
