/*
 * OD admin table density
 * Cíl: datově hutnější Filament tabulky jen v admin panelu.
 */

.fi-ta-content-ctn {
    scrollbar-gutter: stable;
}

.fi-ta-header-cell {
    padding-block: 0.45rem !important;
    padding-inline: 0.5rem !important;
}

.fi-ta-header-cell:first-of-type {
    padding-inline-start: 0.75rem !important;
}

.fi-ta-header-cell:last-of-type {
    padding-inline-end: 0.75rem !important;
}

.fi-ta-cell {
    padding-block: 0.35rem !important;
    padding-inline: 0.5rem !important;
}

.fi-ta-cell:first-of-type {
    padding-inline-start: 0.75rem !important;
}

.fi-ta-cell:last-of-type {
    padding-inline-end: 0.75rem !important;
}

.fi-ta-checkbox,
.fi-ta-color,
.fi-ta-icon,
.fi-ta-image,
.fi-ta-select,
.fi-ta-text,
.fi-ta-text-input,
.fi-ta-toggle {
    padding-block: 0.35rem !important;
    padding-inline: 0.5rem !important;
}

.fi-ta-content-ctn .fi-input-wrp {
    min-height: 1.9rem;
}

.fi-ta-content-ctn .fi-input,
.fi-ta-content-ctn .fi-select-input,
.fi-ta-content-ctn select {
    min-height: 1.9rem;
}

.fi-ta-content-ctn .fi-input,
.fi-ta-content-ctn .fi-select-input {
    padding-block: 0.25rem !important;
    padding-inline-start: 0.5rem !important;
}

.fi-ta-content-ctn .fi-input {
    padding-inline-end: 0.5rem !important;
}

.fi-ta-content-ctn .fi-select-input {
    padding-inline-end: 1.75rem !important;
}

.fi-ta-content-ctn .fi-select-input div[x-ref="select"],
.fi-ta-content-ctn .fi-select-input .fi-select-input-btn {
    min-height: 1.9rem;
}

.fi-ta-content-ctn .fi-select-input .fi-select-input-btn {
    padding-block: 0.25rem !important;
    padding-inline-start: 0.5rem !important;
    padding-inline-end: 1.75rem !important;
}

.fi-ta-content-ctn .fi-ta-actions {
    gap: 0.25rem;
}

.od-business-records-table {
    --od-table-sticky-top: 4rem;
    --od-business-records-client-col-width: 8rem;
    --od-business-records-product-col-width: 5.25rem;
    --od-business-records-institution-col-width: 5.5rem;
    --od-business-records-contract-col-width: 5.25rem;
    --od-business-records-amount-col-width: 6.25rem;
    --od-business-records-points-col-width: 5.1rem;
    --od-business-records-commission-col-width: 5.25rem;
    --od-business-records-date-col-width: 9.5rem;
    --od-business-records-month-col-width: 4.25rem;
    --od-business-records-month-action-col-width: 2rem;
    --od-business-records-milestone-col-width: 4.5rem;
    --od-business-records-cell-inline-padding: 0.25rem;
    --od-business-records-sticky-cell-bg: rgb(255 255 255);
    --od-business-records-sticky-cell-hover-bg: rgb(249 250 251);
    --od-business-records-sticky-header-bg: rgb(249 250 251);
    --od-business-records-sticky-divider: rgb(209 213 219);
}

.dark .od-business-records-table {
    --od-business-records-sticky-cell-bg: rgb(17 24 39);
    --od-business-records-sticky-cell-hover-bg: rgb(31 41 55);
    --od-business-records-sticky-header-bg: rgb(17 24 39);
    --od-business-records-sticky-divider: rgb(55 65 81);
}

.od-business-records-table .fi-ta-header-cell,
.od-business-records-table .fi-ta-cell {
    padding-inline: var(--od-business-records-cell-inline-padding) !important;
}

.od-business-records-table .fi-ta-checkbox,
.od-business-records-table .fi-ta-color,
.od-business-records-table .fi-ta-icon,
.od-business-records-table .fi-ta-image,
.od-business-records-table .fi-ta-select,
.od-business-records-table .fi-ta-text,
.od-business-records-table .fi-ta-text-input,
.od-business-records-table .fi-ta-toggle {
    padding-inline: var(--od-business-records-cell-inline-padding) !important;
}

.od-business-records-table .fi-input-wrp,
.od-business-records-table .fi-input,
.od-business-records-table .fi-select-input,
.od-business-records-table select {
    min-height: 1.75rem;
}

.od-business-records-table .fi-input,
.od-business-records-table .fi-select-input {
    padding-block: 0.18rem !important;
    padding-inline-start: 0.375rem !important;
}

.od-business-records-table .fi-input {
    padding-inline-end: 0.375rem !important;
}

.od-col-client {
    width: var(--od-business-records-client-col-width) !important;
    min-width: var(--od-business-records-client-col-width) !important;
}

.od-col-product {
    width: var(--od-business-records-product-col-width) !important;
    min-width: var(--od-business-records-product-col-width) !important;
}

.od-col-institution {
    width: var(--od-business-records-institution-col-width) !important;
    min-width: var(--od-business-records-institution-col-width) !important;
}

.od-col-contract {
    width: var(--od-business-records-contract-col-width) !important;
    min-width: var(--od-business-records-contract-col-width) !important;
}

.od-col-amount {
    width: var(--od-business-records-amount-col-width) !important;
    min-width: var(--od-business-records-amount-col-width) !important;
}

.od-col-points {
    width: var(--od-business-records-points-col-width) !important;
    min-width: var(--od-business-records-points-col-width) !important;
}

.od-col-commission {
    width: var(--od-business-records-commission-col-width) !important;
    min-width: var(--od-business-records-commission-col-width) !important;
    white-space: nowrap;
}

.od-col-date {
    width: var(--od-business-records-date-col-width) !important;
    min-width: var(--od-business-records-date-col-width) !important;
}

.od-col-month {
    width: var(--od-business-records-month-col-width) !important;
    min-width: var(--od-business-records-month-col-width) !important;
    white-space: nowrap;
}

.od-col-month-action {
    width: var(--od-business-records-month-action-col-width) !important;
    min-width: var(--od-business-records-month-action-col-width) !important;
    padding-inline: 0.1rem !important;
    text-align: center;
}

.od-business-records-table .od-col-month-action .fi-ta-icon {
    justify-content: center;
    padding-inline: 0 !important;
}

.od-business-records-table .od-col-month-action .fi-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.od-col-month-action--clickable {
    cursor: pointer;
}

.od-col-month-action--disabled {
    opacity: 0.45;
    pointer-events: none;
}

.od-business-records-table .fi-ta-table :is(th, td).od-col-client,
.od-business-records-table .fi-ta-table :is(th, td).od-col-product {
    position: sticky !important;
    background: var(--od-business-records-sticky-cell-bg);
    background-clip: padding-box;
}

.od-business-records-table .fi-ta-table :is(th, td).od-col-client {
    left: 0;
    z-index: 12;
}

.od-business-records-table .fi-ta-table :is(th, td).od-col-product {
    left: var(--od-business-records-client-col-width);
    z-index: 11;
    box-shadow: 1px 0 0 var(--od-business-records-sticky-divider);
}

.od-business-records-table .fi-ta-table > thead :is(th).od-col-client,
.od-business-records-table .fi-ta-table > thead :is(th).od-col-product,
.od-business-records-table .od-sticky-table-header .fi-ta-table > thead :is(th).od-col-client,
.od-business-records-table .od-sticky-table-header .fi-ta-table > thead :is(th).od-col-product {
    z-index: 16;
    background: var(--od-business-records-sticky-header-bg);
}

.od-business-records-table .fi-ta-table > thead :is(th).od-col-client,
.od-business-records-table .od-sticky-table-header .fi-ta-table > thead :is(th).od-col-client {
    z-index: 17;
}

.od-business-records-table .fi-ta-table > tbody > tr:hover > :is(td).od-col-client,
.od-business-records-table .fi-ta-table > tbody > tr:hover > :is(td).od-col-product {
    background: var(--od-business-records-sticky-cell-hover-bg);
}

/*
 * Filament input wrapper uvnitř buněk.
 * Toto je důležitější než width() na column API.
 */
.od-business-records-table .od-col-product {
    --od-business-records-field-width: var(--od-business-records-product-col-width);
}

.od-business-records-table .od-col-institution {
    --od-business-records-field-width: var(--od-business-records-institution-col-width);
}

.od-business-records-table .od-col-contract {
    --od-business-records-field-width: var(--od-business-records-contract-col-width);
}

.od-business-records-table .od-col-amount {
    --od-business-records-field-width: var(--od-business-records-amount-col-width);
}

.od-business-records-table .od-col-points {
    --od-business-records-field-width: var(--od-business-records-points-col-width);
}

.od-business-records-table .od-col-date {
    --od-business-records-field-width: var(--od-business-records-date-col-width);
}

.od-business-records-table :is(
    .od-col-product,
    .od-col-institution,
    .od-col-contract,
    .od-col-amount,
    .od-col-points,
    .od-col-date
) :is(.fi-ta-text-input, .fi-ta-col, .fi-input-wrp, .fi-input-wrp-input, .fi-input, input) {
    box-sizing: border-box;
    width: min(100%, var(--od-business-records-field-width)) !important;
    min-width: 0 !important;
    max-width: min(100%, var(--od-business-records-field-width)) !important;
    inline-size: min(100%, var(--od-business-records-field-width)) !important;
    min-inline-size: 0 !important;
    max-inline-size: min(100%, var(--od-business-records-field-width)) !important;
}

.od-business-records-table :is(
    .od-col-product,
    .od-col-institution,
    .od-col-contract,
    .od-col-amount,
    .od-col-points,
    .od-col-date
) .fi-input-wrp > * {
    min-width: 0 !important;
    min-inline-size: 0 !important;
}

.od-sticky-table-header {
    position: fixed;
    top: var(--od-table-sticky-top);
    z-index: 25;
    overflow: hidden;
    border-bottom: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}

.dark .od-sticky-table-header {
    border-bottom-color: rgb(55 65 81);
    background: rgb(17 24 39);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

.od-sticky-table-header[hidden] {
    display: none;
}

.od-sticky-table-header__table {
    min-width: 100%;
    table-layout: fixed;
    will-change: transform;
}

.od-sticky-table-header .fi-ta-table > thead > tr {
    background: rgb(249 250 251);
}

.dark .od-sticky-table-header .fi-ta-table > thead > tr {
    background: rgb(17 24 39);
}

.od-sticky-table-header th[data-od-sticky-sortable="true"] {
    cursor: pointer;
}

.od-sticky-table-scrollbar {
    position: sticky;
    bottom: 0;
    z-index: 18;
    height: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid rgb(229 231 235);
    background: rgb(255 255 255);
}

.dark .od-sticky-table-scrollbar {
    border-top-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

.od-sticky-table-scrollbar[hidden] {
    display: none;
}

.od-sticky-table-scrollbar__inner {
    height: 1px;
}

.od-milestone-cell {
    width: var(--od-business-records-milestone-col-width) !important;
    min-width: var(--od-business-records-milestone-col-width) !important;
    padding: 0.15rem !important;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
}

.od-milestone-cell .fi-ta-col {
    display: flex;
    width: 100%;
    min-height: 1.85rem;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.od-milestone-cell .fi-ta-text {
    padding: 0 !important;
}

.od-milestone-cell__content {
    display: flex;
    width: 100%;
    min-width: 0;
    justify-content: center;
}

.od-milestone-pill {
    display: inline-flex;
    width: 2.5rem;
    min-width: 2.5rem;
    min-height: 1.7rem;
    align-items: center;
    justify-content: center;
    border: 1px solid;
    border-radius: 0.45rem;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease,
        box-shadow 120ms ease,
        transform 120ms ease;
}

.od-milestone-pill__mark {
    display: inline-flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    transform: translateY(-0.02em);
}

.od-milestone-cell--clickable {
    cursor: pointer;
}

.od-milestone-cell--clickable .od-milestone-pill:hover {
    box-shadow: 0 0 0 2px rgb(34 197 94 / 0.24);
    transform: translateY(-1px);
}

.od-milestone-cell--disabled {
    opacity: 0.72;
}

.od-milestone-cell--complete {
    background: transparent !important;
}

.od-milestone-pill--complete {
    border-color: rgb(21 128 61);
    background: rgb(22 163 74);
    color: rgb(255 255 255);
}

.dark .od-milestone-cell--complete {
    background: transparent !important;
}

.dark .od-milestone-pill--complete {
    border-color: rgb(74 222 128 / 0.7);
    background: rgb(22 101 52);
    color: rgb(220 252 231);
}

.od-milestone-cell--pending {
    background: transparent;
}

.od-milestone-pill--pending {
    border-color: rgb(209 213 219);
    background: rgb(243 244 246);
    color: rgb(75 85 99);
}

.dark .od-milestone-cell--pending {
    background: transparent;
}

.dark .od-milestone-pill--pending {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
    color: rgb(209 213 219);
}

.od-quick-create-business-record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.od-quick-create-business-record__schema {
    min-width: 0;
}

@media (max-width: 64rem) {
    .od-quick-create-business-record {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 42rem) {
    .od-quick-create-business-record .fi-btn {
        width: 100%;
    }
}

/* Sticky header clones Filament sortable headers; hide copied Livewire loading spinners. */
.od-sticky-table-header .fi-loading-indicator {
    display: none !important;
}
