/* The action header has the same opaque surface as the rest of the header,
   including columns added by Tabledit and fixed columns in scrollable tables. */
.app-theme .table > thead > tr {
    --app-table-header-background: var(--color-table-header, #f1f3f5);
    background-color: var(--app-table-header-background);
}
.app-theme .table > thead > tr > :last-child,
.app-theme .table > thead > tr > .tabledit-toolbar-column {
    background-color: var(--app-table-header-background) !important;
}

/* Business states belong to compact badges, never a full row/cell fill.
   See AGENTS.md and docs/tableaux-et-badges.md. */
.app-theme .table > tbody > tr { --app-table-row-background: var(--color-surface, #fff); }
.app-theme .table-striped > tbody > tr:nth-of-type(odd) { --app-table-row-background: var(--color-background, #f5f6f8); }
.app-theme .table > tbody > tr:is(.table-success,.table-danger,.table-warning,.table-info,.table-primary,.table-secondary,.success,.danger,.warning,.info,.bg-success,.bg-danger,.bg-warning,.bg-info),
.app-theme .table > tbody > tr:is(.table-success,.table-danger,.table-warning,.table-info,.table-primary,.table-secondary,.success,.danger,.warning,.info,.bg-success,.bg-danger,.bg-warning,.bg-info) > :is(th,td),
.app-theme .table > tbody > tr > :is(th,td):is(.table-success,.table-danger,.table-warning,.table-info,.table-primary,.table-secondary,.success,.danger,.warning,.info,.bg-success,.bg-danger,.bg-warning,.bg-info) {
    background-color: var(--app-table-row-background) !important;
    background-image: none !important;
    color: var(--color-text);
}
.app-theme .app-table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--color-background, #f5f6f8);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: normal;
    vertical-align: middle;
}
.app-theme .app-table-badge--success { background: var(--color-success-light); color: var(--color-success-dark); }
.app-theme .app-table-badge--warning { background: var(--color-warning-light); color: var(--color-warning-dark); }
.app-theme .app-table-badge--danger { background: var(--color-primary-light); color: var(--color-primary-dark); }
.app-theme .app-table-badge--info, .app-theme .app-table-badge--neutral { background: var(--color-background); color: var(--color-text-secondary); }

/* A cell with its own surface (in particular a sticky action cell) used to
   conceal the row hover. Paint the state on each cell, not only on the row. */
.app-theme .table-striped > tbody > tr:nth-of-type(odd) > :last-child {
    background-color: var(--color-background, #f5f6f8);
}
.app-theme .table-hover > tbody > tr:hover > :is(th, td) {
    background-color: var(--color-background, #f5f6f8) !important;
}
.app-theme .table-hover > tbody > tr:focus-within > :is(th, td) {
    background-color: var(--color-background, #f5f6f8) !important;
}

/* A row opens its explicitly designated detail action; controls remain independent. */
.app-detail-row { cursor: pointer; }
.app-detail-row:focus-visible { outline:2px solid var(--color-primary,#c51920); outline-offset:-2px; }
.app-detail-row :is(input,select,textarea,[contenteditable=true]) { cursor:auto; }

/* Catalogue: a small, uncropped preview shares the article's existing photo. */
#table_article .catalog-photo-cell { width:64px; min-width:64px; padding:8px 10px; vertical-align:middle; }
.catalog-photo-thumb { display:flex; align-items:center; justify-content:center; width:44px; height:44px; overflow:hidden; border:1px solid var(--color-border,#e5e8ed); border-radius:7px; background:#fff; }
.catalog-photo-thumb img { display:block; width:100%; height:100%; min-width:0; min-height:0; max-width:100%; max-height:100%; object-fit:contain; padding:3px; box-sizing:border-box; }
.catalog-photo-thumb img[hidden] { display:none; }
.catalog-photo-thumb>.fa { display:none; }
.catalog-photo-thumb.is-missing { background:var(--color-background,#f5f6f8); color:var(--color-text-secondary,#758094); }
.catalog-photo-thumb.is-missing>.fa { display:block; font-size:17px; }
#table_article .catalog-unit-note { margin-top:4px; }
#table_article .tabledit-edit-mode .catalog-unit-note { display:none!important; }
@media(max-width:767px) { #table_article .catalog-photo-cell { padding:8px; width:60px; min-width:60px; } }
