/* tables.css - wydzielone style aplikacji. */

.table-scroll,
.overflow-x-auto {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
}

table,
.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
    font-size: var(--table-font-size);
}

.table-panel {
    border-color: var(--border);
}

.table-panel .table-scroll {
    background: var(--surface);
}

.table-panel .table-scroll,
.table-card {
    border-top: 1px solid var(--border);
}

.compact-table,
.mobile-card-table {
    min-width: 0;
}

thead {
    background: var(--surface-muted);
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    color: var(--muted);
    font-size: var(--status-font-size);
    font-weight: 950;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
}

td {
    border-bottom: 1px solid var(--border);
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    vertical-align: middle;
}

tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

tbody tr:hover {
    background: var(--primary-soft);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.table-link {
    display: inline-flex;
    min-height: calc(var(--button-height) - .3rem);
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 108, 73, .18);
    background: var(--primary-soft);
    padding: .36rem .58rem;
    color: var(--primary-dark);
    font-size: var(--small-font-size);
    font-weight: 900;
}

.table-link:hover {
    background: var(--success-soft);
}

.table-card {
    overflow: hidden;
}

.table-search,
.table-limit,
.form-control {
    width: 100%;
}

.sow-row,
.sale-row,
.event-row,
.settlement-row,
.bulk-event-row,
.delivery-row {
    scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

.delete-cell {
    text-align: center;
}

.chronology-note,
.sales-filter-bar {
    margin-bottom: var(--section-gap);
}

.remove-row-btn,
.copy-sow,
.ingredient-checkbox {
    flex: 0 0 auto;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}

.today-task-table {
    table-layout: fixed;
}

.today-task-table th:first-child,
.today-task-table td:first-child {
    width: 6.5rem;
}

.today-task-table th:nth-child(3),
.today-task-table td:nth-child(3) {
    width: 8rem;
}

.today-task-table th:last-child,
.today-task-table td:last-child {
    width: 9rem;
}

.today-task-checkbox {
    width: 1.55rem;
    height: 1.55rem;
    min-width: 1.55rem;
    accent-color: var(--primary);
}

.today-task-row.is-selected {
    background: var(--success-soft);
}

.today-task-title {
    display: grid;
    gap: .25rem;
}

.today-task-title strong,
.today-task-title small {
    min-width: 0;
}

.today-task-title small {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.35;
}

.today-task-result {
    width: 100%;
    min-width: 8rem;
}

.today-task-submit {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto;
    gap: var(--grid-gap);
    align-items: end;
    padding: var(--panel-padding);
}

.today-task-submit label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: var(--small-font-size);
    font-weight: 900;
}

.today-task-submit textarea {
    min-height: 3.8rem;
}

.today-task-submit button {
    align-self: stretch;
}

.link-button-danger {
    display: inline-flex;
    min-height: calc(var(--button-height) - .3rem);
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius);
    background: var(--danger-soft);
    padding: .36rem .58rem;
    color: var(--danger);
    font-size: var(--small-font-size);
    font-weight: 900;
}

.link-button-danger:hover {
    background: var(--danger-soft);
}

.muted-small {
    color: var(--muted);
    font-size: var(--small-font-size);
    font-weight: 750;
}

.empty-table,
.empty-state {
    padding: var(--panel-padding);
    color: #8594a6;
    font-weight: 800;
    text-align: center;
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state p + .button,
.empty-state h3 + p {
    margin-top: .6rem;
}


.wide-table,
.settlement-table,
.bulk-event-table,
.delivery-form-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.wide-table th,
.wide-table td,
.settlement-table th,
.settlement-table td,
.bulk-event-table th,
.bulk-event-table td,
.delivery-form-table th,
.delivery-form-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.wide-table th:first-child,
.wide-table td:first-child,
.settlement-table th:first-child,
.settlement-table td:first-child,
.bulk-event-table th:first-child,
.bulk-event-table td:first-child,
.delivery-form-table th:first-child,
.delivery-form-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
    box-shadow: 1px 0 0 var(--border);
}

.wide-table th:first-child,
.settlement-table th:first-child,
.bulk-event-table th:first-child,
.delivery-form-table th:first-child {
    z-index: 3;
    background: var(--surface-muted);
}

.wide-table td:first-child,
.settlement-table td:first-child,
.bulk-event-table td:first-child,
.delivery-form-table td:first-child {
    background: var(--surface);
}

.settlement-table input,
.settlement-table select,
.bulk-event-table input,
.bulk-event-table select,
.bulk-event-table textarea,
.delivery-form-table input,
.delivery-form-table select {
    width: 100%;
    min-width: 8ch;
    max-width: none;
    min-height: calc(var(--control-height) - .05rem);
    padding-inline: .6rem;
}

.settlement-table input[type="checkbox"],
.bulk-event-table input[type="checkbox"],
.delivery-form-table input[type="checkbox"] {
    width: 1.15rem;
    min-width: 1.15rem;
}

.settlement-table input[name$="-line_no"] {
    min-width: 5ch;
}

.settlement-table input[name$="-quantity"] {
    min-width: 8ch;
}

.settlement-table input[name$="-weight"],
.settlement-table input[name$="-avg_weight"] {
    min-width: 12ch;
}

.settlement-table input[name$="-avg_meatiness"],
.settlement-table input[name$="-price_per_kg"] {
    min-width: 10ch;
}

.settlement-table input[name$="-net_value"],
.settlement-table input[name$="-vat_value"],
.settlement-table input[name$="-gross_value"] {
    min-width: 13ch;
}

.settlement-table .numeric-cell input {
    text-align: right;
}

.mass-input-inline {
    display: grid;
    grid-template-columns: minmax(8ch, 1fr) 4.5rem;
    gap: .3rem;
    align-items: center;
    min-width: 15rem;
}

.mass-input-inline .mass-unit-select {
    min-width: 4.5rem;
}

.settlement-table input[name$="-meat_class"] {
    min-width: 7ch;
}

.settlement-table .import-warning-row {
    background: var(--warning-soft);
}

.settlement-table .import-warning-row td:first-child {
    background: var(--warning-soft);
}

.bulk-event-table input[name$="-sow_ear_tag"] {
    min-width: 12ch;
}

.bulk-event-table input[type="date"] {
    min-width: 13ch;
}

.bulk-event-table select[name$="-event_type"],
.bulk-event-table select[name$="-vaccine_name"] {
    min-width: 18ch;
}

.bulk-cell-with-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}


.is-hidden-by-table-manager {
    display: none !important;
}
