/* Document workspace: flat sections, one search surface, aligned table headers. */
.workspace-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.workspace-filter-chips:empty { display: none; }
.workspace-filter-chips a { padding: 4px 8px; border: 1px solid #cbd6e1; border-radius: 4px; color: #344253; background: #f3f6f8; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; text-decoration: none; }
.workspace-filter-chips a:hover { border-color: #205da5; color: #205da5; }
body:not(.wms) .doc-page .doc-footer-actions {
    position: sticky; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    background: #fff; border-top: 1px solid #dbe1e7; padding: 10px 0; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
body:not(.wms) .doc-page .order-section > .doc-section { border: 0; padding: 0; margin: 0; }
body:not(.wms) .doc-page .order-section > .doc-section > .doc-section-title { display: none; }
@media (min-width: 701px) {
    body:not(.wms) .doc-page .list-table[data-list-key="orders"] tbody td:nth-child(2) {
        position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 #dbe1e7;
    }
}
/* Status names must remain readable at saved narrow column widths too. */
body:not(.wms) .main .badge {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    min-height: 26px;
    height: auto;
    padding: 3px 9px;
    border-radius: 5px;
    box-shadow: none;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
    max-width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
    text-align: left;
}
/* Inline widths restored by col_resize retain the user's chosen column size. */
body:not(.wms) .main .list-table th.lcol-status { width: 210px; }
body:not(.wms) .main .order-status-cell { width: auto; max-width: none; min-width: 0; }
body:not(.wms) .main .order-status-row,
body:not(.wms) .main .status-picker-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}
body:not(.wms) .main .status-picker-value { flex: 1 1 auto; }
body:not(.wms) .main .order-status-row { width: 100%; }
.order-counterparty-link { color: #205da5; font-weight: 700; text-decoration: none; }
.order-counterparty-link:hover { text-decoration: underline; }
.order-counterparty-link:focus-visible { outline: 2px solid #205da5; outline-offset: 2px; }
body:not(.wms) .main .status-picker summary { min-width: 0; gap: 8px; }
body:not(.wms) .main .status-picker .doc-status-label { flex-shrink: 0; }
body:not(.wms) .main .status-check { align-items: center; gap: 8px; }
@media (max-width: 700px) {
    body:not(.wms) .main .order-status-cell { min-width: 0; }
    body:not(.wms) .main .status-picker-value { max-width: 100%; }
}
.order-more { position: relative; }
.order-more > summary { cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 700; }
.order-more-menu {
    position: absolute; right: 0; top: 100%; z-index: 40; width: 260px; max-width: calc(100vw - 32px);
    background: #fff; border: 1px solid #dbe1e7; border-radius: 6px; padding: 6px;
    box-shadow: 0 6px 20px #202a351a;
}
.order-more-menu form { margin: 0; }
.order-more-menu .btn-secondary {
    display: flex; width: 100%; justify-content: flex-start; white-space: normal; text-align: left;
    border: 0; background: transparent; box-shadow: none; margin: 0; padding: 10px; border-radius: 4px;
}
.order-more-menu .btn-secondary:hover { background: #edf1f5; }
.order-more-menu .order-delete { color: #b42332; border-top: 1px solid #dbe1e7; margin-top: 4px; }
.order-section { border-bottom: 1px solid #dbe1e7; padding: 12px 0; }
.order-section > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: #344253; }
.order-section[open] > summary { margin-bottom: 14px; }
.order-section-hint { margin-left: 10px; color: #5a6675; font-size: 12px; font-weight: 600; }
body:not(.wms) .order-form-page .order-section > .doc-section { border: 0; padding: 0; margin: 0; }
body:not(.wms) .order-form-page .order-section > .doc-section > .doc-section-title { display: none; }
body:not(.wms) .order-form-page .field select[multiple] { height: auto; min-height: 90px; }
body:not(.wms) .order-form-page .doc-title { display: block; flex: 1; }
body:not(.wms) .order-form-page .order-save-bar {
    position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #fff; border: 0; border-top: 1px solid #dbe1e7; padding: 10px 0; margin-top: 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.order-save-state { margin-right: auto; color: #805600; font-size: 12px; font-weight: 700; }
@media (max-width: 700px) {
    .order-save-state:not(:empty) { flex-basis: 100%; }
    body:not(.wms) .order-form-page .order-save-bar .btn-primary { flex: 1; }
    body:not(.wms) .order-form-page .doc-actions { width: 100%; justify-content: flex-start; }
    .order-more-menu { right: auto; left: 0; }
}
body:not(.wms) .doc-page {
    --workspace-border: #dbe1e7;
    color: #202a35;
}
body:not(.wms) .doc-page .doc-header {
    padding: 12px 0;
    margin: 0 0 12px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--workspace-border);
    border-radius: 0;
    box-shadow: none;
    align-items: flex-start;
    gap: 12px;
}
body:not(.wms) .doc-page .doc-title h1 { font-size: 22px; line-height: 1.3; letter-spacing: 0; }
body:not(.wms) .doc-page .doc-title { min-width: 0; flex-wrap: wrap; gap: 8px; }
body:not(.wms) .doc-page .doc-actions { gap: 6px; flex-wrap: wrap; }
body:not(.wms) .doc-page .doc-section {
    padding: 14px 0;
    margin: 0 0 12px;
    border: 0;
    border-bottom: 1px solid var(--workspace-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
body:not(.wms) .doc-page .doc-section-title { margin: 0 0 12px; font-size: 14px; line-height: 1.4; }
body:not(.wms) .doc-page .doc-grid { gap: 12px 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body:not(.wms) .doc-page .field { min-width: 0; gap: 4px; }
body:not(.wms) .doc-page .field label { font-size: 12px; font-weight: 700; color: #465364; }
body:not(.wms) .doc-page .field :is(input:not([type="checkbox"]):not([type="radio"]), select) {
    min-height: 36px; height: 36px; padding: 6px 10px; border-radius: 5px; font-weight: 600; max-width: 100%;
}
body:not(.wms) .doc-page .field textarea { min-height: 64px; height: 64px; resize: vertical; border-radius: 5px; }
body:not(.wms) .doc-page .doc-summary {
    display: flex; flex-wrap: wrap; gap: 0; padding: 0; margin: 0 0 16px;
    background: #f3f6f8; border: 0; border-radius: 0; box-shadow: none;
}
body:not(.wms) .doc-page .ds-item {
    flex: 1 1 130px; padding: 10px 14px; border: 0; border-right: 1px solid var(--workspace-border);
    background: transparent; border-radius: 0; box-shadow: none;
}
body:not(.wms) .doc-page .ds-value,
body:not(.wms) .doc-page .ds-value.big { font-size: 16px; line-height: 1.4; }
body:not(.wms) .doc-page .doc-status-panel {
    padding: 0; margin-top: 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; gap: 8px;
}
body:not(.wms) .doc-page .table-tools-top { margin: 0; padding: 6px 0; min-height: 34px; justify-content: flex-end; background: transparent; border: 0; box-shadow: none; }
/* The viewport menu offset must not be applied inside a table scroll container. */
body:not(.wms) .table thead th { top: 0; }
body:not(.wms) .doc-page .table thead th {
    position: relative; top: 0; padding: 9px 10px; vertical-align: middle;
    background: #edf1f5; color: #344253; font-size: 12px; font-weight: 800;
    border-bottom: 1px solid #cbd4de; white-space: nowrap;
}
body:not(.wms) .doc-page .table { margin-top: 0; }
body:not(.wms) .doc-page .list-table td { padding: 9px 10px; font-size: 13px; font-weight: 600; }
body:not(.wms) .doc-page .column-filter summary { border: 0; background: transparent; border-radius: 4px; }
body:not(.wms) .doc-page .workspace-search { padding: 0 0 12px; }
.workspace-search-bar { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.workspace-search-bar > .field { flex: 1 1 260px; max-width: 560px; }
.workspace-search-bar > .form-actions { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
.workspace-filters { margin-top: 8px; }
.workspace-filters > summary { display: list-item; width: fit-content; cursor: pointer; padding: 6px 0; font-size: 13px; font-weight: 700; color: #285fa5; }
.workspace-filters[open] > summary { margin-bottom: 8px; }
.workspace-filters > summary:focus-visible { outline: 2px solid #285fa5; outline-offset: 3px; }
@media (max-width: 1100px) {
    body:not(.wms) .doc-page .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    body:not(.wms) .doc-page .doc-header { padding-top: 6px; gap: 8px; }
    body:not(.wms) .doc-page .doc-title h1 { font-size: 19px; }
    body:not(.wms) .doc-page .doc-grid { gap: 10px; }
    body:not(.wms) .doc-page .field :is(input:not([type="checkbox"]):not([type="radio"]), select) { font-size: 16px; }
    body:not(.wms) .doc-page .ds-item { flex-basis: 40%; padding: 8px 10px; }
    .workspace-search-bar > .field { max-width: none; flex-basis: 100%; }
    .workspace-search-bar > .form-actions { flex-wrap: wrap; }
    body:not(.wms) .doc-page .list-table td { padding: 5px 8px; }
}
@media (max-width: 380px) {
    body:not(.wms) .doc-page .doc-grid { grid-template-columns: minmax(0, 1fr); }
}
