/* Czytelność typografii we wszystkich istniejących widokach, bez zmiany siatki. */
th { font-size: 13px; font-weight: 650; color: #34475e; white-space: normal; }
.card h2 { font-size: 18px; font-weight: 650; }
.tab { font-size: 13px; color: #4f6077; font-weight: 600; }
.tab.active { font-weight: 650; }
.order-number, .client-name { font-size: 13px; font-weight: 600; }
.deadline { font-size: 13px; color: #4a5d77; }
.cell-subtitle { font-size: 12px; color: #65748a; }
.badge { font-size: 11px; font-weight: 650; }
.card-description, .subtitle, .metric-caption, .date-display { color: #5b6d84; }
.card-description, .metric-caption, .section-caption, .process-info, .day-summary { font-size: 12px; }
.section-caption, .process-info { color: #56677e; }
.material-preview small, .material-preview strong, .material-quantity { font-size: 12px; }
.material-preview small, .demo-notice, .table-foot, .module-notice, .document-note { color: #64748b; }
.detail-list dt, .detail-grid small { color: #56677e; font-size: 12px; font-weight: 600; }
.wrap-address { font-size: 13px; color: #4c5f77; }
.search-field input { font-size: 13px; }
.search-field input::placeholder { color: #697a91; }
.select-control { color: #425670; font-size: 13px; }

/* Tabela produkcyjna ma własne przewijanie, zamiast ściskania danych. */
.production-card { min-width: 0; }
.production-card .module-toolbar { gap: 8px; padding: 8px 14px; }
.production-card .search-field { width: 260px; flex-grow: 1; max-width: 340px; }
.production-guide { display: flex; flex-wrap: wrap; gap: 3px 14px; padding: 0 14px 6px; color: #5d6f86; font-size: 11px; line-height: 1.4; }
#production-feedback { color: #2463eb; font-weight: 600; }
#production-feedback.is-error, .form-error { color: #b72f44; }
.production-scroll { max-height: calc(100vh - 325px); min-height: 280px; overflow: auto; scrollbar-gutter: stable; }
.production-table { table-layout: fixed; width: 100%; min-width: 1396px; border-collapse: separate; border-spacing: 0; }
.col-order { width: 132px; }.col-client { width: 140px; }.col-element { width: 272px; }
.col-quantity { width: 96px; }
.col-material { width: 126px; }.col-sheet { width: 148px; }.col-square { width: 108px; }
.col-disc { width: 108px; }.col-date { width: 100px; }.col-due { width: 106px; }
.col-status { width: 168px; }.col-actions { width: 148px; }
.production-table th { background: #eaf0f7; font-size: 13px; line-height: 1.25; padding: 7px 8px; color: #253b57; vertical-align: middle; }
.production-table th small { display: inline; font-size: 11px; font-weight: 400; color: #526780; margin-top: 0; }
.production-table th:nth-child(5) small { display: block; }
.production-table td { padding: 6px 8px; font-size: 13px; line-height: 1.35; background: white; overflow-wrap: anywhere; }
.production-table td:first-child { padding-left: 8px; }
.production-table th:first-child { padding-left: 8px; }
.production-table th:last-child, .production-table td:last-child { padding-right: 8px; }
.production-table .order-group-start:not(:first-child) td { border-top: 4px solid #f4f6fa; }
.production-table .sticky-order, .production-table .sticky-client { position: sticky; background: #fff; z-index: 2; }
.production-table .sticky-order { left: 0; }
.production-table .sticky-client { left: 132px; box-shadow: 1px 0 #e5eaf1; }
.production-table thead .sticky-order, .production-table thead .sticky-client { z-index: 4; background: #eaf0f7; top: 0; }
.production-order, .production-client { vertical-align: top; }
.order-identity { display: flex; align-items: flex-start; gap: 4px; }
.order-identity .order-number { line-height: 1.5; overflow-wrap: anywhere; font-size: 13px; padding-top: 2px; }
.production-order > .cell-subtitle { padding-left: 23px; }
.collapse-button { border: 0; background: none; color: #526984; padding: 2px 0; }
.collapse-button .icon { width: 17px; height: 17px; transform: rotate(90deg); }
.collapse-button.folded .icon { transform: rotate(0); }
.client-link { color: #34475e; background: none; border: 0; padding: 3px 0; text-align: left; font-weight: 600; line-height: 1.5; }
.client-link:hover { color: #2463eb; }
.element-cell strong, .material-cell strong { color: #34475e; font-size: 13px; font-weight: 500; }
.element-cell .cell-subtitle, .material-cell .cell-subtitle { font-size: 12px; line-height: 1.5; }
.production-table .admin-cell { color: #52677f; font-size: 12px; }
.production-input { width: 100%; min-height: 32px; padding: 5px 6px; border: 1px solid #d8e1ec; border-radius: 6px; background: #fff; color: #34475e; font-size: 13px; }
.production-input:focus { outline: 2px solid #b7cefa; border-color: #85aaf2; }
.dimension-input { min-width: 0; }
.disc-field { display: flex; gap: 5px; align-items: center; color: #425a78; }
.disc-field span { font-size: 15px; }
.item-dirty .production-input { border-color: #e0ad44; background: #fffdf7; }
.item-actions { display: flex; gap: 5px; align-items: center; }
.item-actions .button { min-height: 32px; padding: 6px 8px; font-size: 11px; }
.item-actions .item-edit { width: 30px; padding: 5px; }
.item-actions .item-delete { width: 30px; padding: 5px; color: #b72f44; border-color: #e4b8bf; }
.item-actions .item-delete:hover { background: #fff0f2; }
.item-actions .item-delete:disabled { opacity: .5; }
.item-actions .icon { width: 15px; height: 15px; }
.item-save:disabled { color: #8190a5; background: #f7f9fc; border-color: #e5eaf1; }
.production-table .add-item-row td { padding: 3px 8px 6px; }
.add-item-button { border-radius: 6px; background: #eef4ff; padding: 5px 8px; font-size: 12px; }
.add-item-button:hover { background: #e2edff; }
.add-item-button .icon { width: 14px; height: 14px; }
.folded-note { margin-left: 16px; font-size: 12px; color: #5d708a; }
.production-table .no-items { color: #64748b; }

.editor-notice { font-size: 13px; color: #5e7087; line-height: 1.7; margin: 0 0 20px; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 22px; }
.editor-field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #34475e; font-weight: 600; }
.editor-full { grid-column: 1 / -1; }
.editor-field input, .editor-field select, .editor-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #d6e0ee; border-radius: 7px; font: inherit; font-weight: 400; color: #34475e; background: #fff; }
.editor-field input:focus, .editor-field select:focus, .editor-field textarea:focus { outline: 2px solid #b9d0ff; border-color: #8bb1fb; }
.editor-buttons { display: flex; justify-content: flex-end; gap: 10px; padding-top: 15px; border-top: 1px solid #e5eaf1; }
.editor-buttons .button { font-size: 13px; min-width: 105px; }
.form-error { min-height: 20px; font-size: 13px; line-height: 1.6; }
@media (max-width: 1280px) { .production-scroll { max-height: calc(100vh - 360px); } }
/* Tabela wykorzystuje pozostałą wysokość okna; nagłówki i filtry są stale nad nią. */
.workspace:has(.production-card) { height: 100vh; }
main:has(.production-card) { display: flex; flex-direction: column; min-height: 0; }
main:has(.production-card) > .page-heading { flex-shrink: 0; }
.production-card { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.production-card > .module-toolbar, .production-card > .production-guide, .production-card > .table-foot { flex-shrink: 0; }
.production-card .production-scroll { flex: 1; min-height: 0; max-height: none; }

/* Wyłącznie przypisanie pracowników w komórce konkretnego detalu. */
.item-workers { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.item-worker { display: flex; flex-direction: row; align-items: center; gap: 4px; color: #65748a; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.item-worker select { width: 72px; height: 28px; padding: 2px 5px; border: 1px solid #d8e1ec; border-radius: 5px; background: #fff; color: #34475e; font: inherit; font-size: 12px; }
.item-worker select:focus { outline: 2px solid #b7cefa; border-color: #85aaf2; }

.order-client-select, .item-product-select { width: 100%; min-width: 0; height: 28px; padding: 3px 5px; border: 1px solid #d8e1ec; border-radius: 5px; background: #fff; color: #34475e; font: inherit; font-size: 12px; }
.order-client-select:focus, .item-product-select:focus { outline: 2px solid #b7cefa; border-color: #85aaf2; }
.order-client-card { font-size: 11px; margin-top: 6px; }
.order-cancel-button { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; margin: 6px 0 0 23px; padding: 3px; background: #fff; border: 1px solid #e4b8bf; border-radius: 5px; color: #b72f44; }
.order-cancel-button .icon { width: 14px; height: 14px; }
.order-cancel-button:hover { background: #fff0f2; }
.product-selection-notice { display: block; font-size: 11px; color: #b72f44; margin-top: 4px; }

/* Zwarty obszar roboczy dotyczy tylko obu widoków produkcyjnych. */
body.production-view .topbar { height: 56px; }
body.production-view main { padding: 12px 20px 10px; }
body.production-view .page-heading { margin-bottom: 8px; gap: 12px; min-height: 40px; }
body.production-view .page-heading h1 { font-size: 26px; margin: 0; }
body.production-view .page-heading .subtitle { display: none; }
body.production-view .heading-actions { gap: 8px; }
body.production-view .table-foot { padding: 6px 14px; }
body.production-view footer { padding: 6px 20px; }
.item-product-line { display: flex; gap: 8px; align-items: center; min-width: 0; }
.item-product-line .item-product-select, .item-product-line > strong:first-child { flex: 1; min-width: 0; }
.element-cell .item-quantity { flex: 0 0 auto; font-weight: 650; font-size: 12px; white-space: nowrap; }
.item-product-full-name { display: block; margin-top: 3px; color: #34475e; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.item-product-full-name[hidden] { display: none; }
.element-cell .item-notes { margin-top: 3px; line-height: 1.3; }
.order-notes { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; color: #34475e; }
.order-summary { display: flex; gap: 8px; align-items: center; margin: 3px 0; }
.order-summary .cell-subtitle { margin: 0; font-size: 10px; }
.order-summary .order-cancel-button { margin: 0; }
.order-status-control { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; font-size: 10px; color: #65748a; }
.order-status-control select { width: 100%; min-width: 0; min-height: 30px; border: 1px solid #d8e1ec; border-radius: 5px; background: white; color: #34475e; font-size: 11px; }

/* Jeden niewielki krok tonalny, bez zmian granatowej palety nawigacji. */
th { background: #f3f6fa; }
.dialog-head { background: #f5f7fb; }
.detail-grid { background: #f2f5f9; }
.module-notice { background: #edf1f7; }

/* Dziewiąta pozycja menu mieści się także w niskim oknie dzięki przewijaniu. */
.sidebar nav { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.sidebar .brand, .sidebar .nav-caption, .sidebar .sidebar-bottom, .sidebar .sidebar-version { flex-shrink: 0; }
.nav-label { min-width: 0; overflow-wrap: anywhere; }

/* Nowe pola kartoteki korzystają z istniejących kontrolek i palety. */
.product-catalog-table { table-layout: fixed; width: 100%; min-width: 0; }
.product-catalog-table th:nth-child(1) { width: 12%; }
.product-catalog-table th:nth-child(2) { width: 16.5%; }
.product-catalog-table th:nth-child(3) { width: 13%; }
.product-catalog-table th:nth-child(4) { width: 8.5%; }
.product-catalog-table th:nth-child(5) { width: 13%; }
.product-catalog-table th:nth-child(6) { width: 12%; }
.product-catalog-table th:nth-child(7) { width: 9%; }
.product-catalog-table th:nth-child(8) { width: 8%; }
.product-catalog-table th:nth-child(9) { width: 8%; }
.product-catalog-table th, .product-catalog-table td { padding: 8px 4px; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.product-catalog-table td.client-name { font-size: 12px; }
.product-catalog-table th { overflow-wrap: normal; }
.product-catalog-table .production-input { min-width: 0; max-width: 100%; padding: 5px 3px; font-size: 12px; }
.product-catalog-table select.production-input { appearance: none; padding-right: 13px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%23526178' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 3px center; }
.product-catalog-table .button { width: 100%; min-width: 0; min-height: 32px; padding: 5px 3px; font-size: 12px; white-space: nowrap; }
@media (pointer: coarse), (max-width: 1100px) {
  .product-catalog-table .production-input, .product-catalog-table .button { min-height: 44px; }
}
.catalog-feedback { margin: 0; padding: 0 22px 8px; font-size: 12px; color: #2463eb; }
.catalog-feedback:empty { display: none; }
.catalog-feedback.is-error { color: #b72f44; }
.material-catalog-card { margin-top: 20px; }

.item-product-line .item-completion-select { flex:0 0 104px; width:104px; min-width:0; height:28px; padding:3px; border:1px solid #d8e1ec; border-radius:5px; background:#fff; color:#34475e; font:inherit; font-size:11px; }
.production-table .material-cell { overflow-wrap:anywhere; }

.production-table .item-worker select { width:64px; }

/* Odcień bloku jest liczony po aktualnie wyświetlonych zamówieniach, także dla wierszy rowspan. */
.production-table .order-block-0>td{background:#fff}
.production-table .order-block-1>td{background:#eff6fc}
.production-table .order-block-1 .sticky-order,.production-table .order-block-1 .sticky-client{background:#eff6fc}
.dashboard-status{max-width:100%;width:210px;min-height:36px;padding:6px;border:1px solid #d6e0ee;border-radius:6px;background:#fff;color:#34475e;font:inherit;font-size:12px}
.dashboard-feedback:empty{display:none}.dashboard-feedback{font-size:13px}
@media(pointer:coarse){.dashboard-status{min-height:44px}}

.material-stock-table{width:100%;table-layout:fixed;min-width:620px}.material-stock-table th,.material-stock-table td{border-right:1px solid #cfdae8;padding:10px 12px}.material-stock-table th:last-child,.material-stock-table td:last-child{border-right:0}.material-stock-table th:first-child{width:29%}.material-stock-table th:nth-child(2){width:17%}.material-stock-table th:nth-child(3){width:24%}.stock-cell{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.stock-cell .button{padding:6px 8px;min-height:36px}.stock-cell strong{white-space:nowrap}
@media(pointer:coarse){.stock-cell .button{min-height:44px}}

.process-grid{grid-template-columns:repeat(auto-fit,minmax(100px,1fr))}.timeline{grid-template-columns:repeat(auto-fit,minmax(90px,1fr))}
