/*
 * conflicts.css — a Finish from the device the server would not apply, set against what the
 * system holds (Patterns/Konflikte).
 *
 * <div class="app-conflict">
 *   <div class="app-conflict-compare">[card: table: Angabe, Gerät, System]</div>
 *   <div class="app-conflict-side">[card: Grund, Gesendet; the note]</div>
 * </div>
 *
 * One column under a region of 960, the comparison first; from 960 eight and four columns,
 * the two cards starting and ending on one line.
 *
 * The comparison is read across, Gerät against System, so it stays a table at every width:
 * below a region of 560 it keeps its header and its three columns, each as wide as its words
 * need, instead of turning into list rows. A value wraps rather than ending in an ellipsis,
 * since a cut value would hide the very difference the table is there to show: a cell keeps
 * the control's 8px above and below its line, so a row is 40 with one line and grows by a
 * line's 20. The first column names the value, in muted text.
 */
@layer components {
    .app-conflict {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--app-space-grid-row) var(--app-space-gutter-narrow);
    }

    .app-conflict-compare,
    .app-conflict-side {
        display: flex;
        flex-direction: column;
        min-inline-size: 0;
    }

    .app-conflict-compare > .app-card,
    .app-conflict-side > .app-card {
        flex: 1 1 auto;
    }

    .app-conflict-compare .app-table-cell {
        padding: var(--app-space-control-y) var(--app-space-cell-x);
        white-space: normal;
        overflow-wrap: break-word;
    }

    .app-conflict-compare .app-table-cell:first-child {
        color: var(--app-color-text-muted);
    }

    @container app-region (width >= 560px) {
        .app-conflict {
            column-gap: var(--app-space-gutter-wide);
        }
    }

    @container app-region (width >= 960px) {
        .app-conflict {
            grid-template-columns: repeat(12, minmax(0, 1fr));
        }

        .app-conflict-compare {
            grid-column: span 8;
        }

        .app-conflict-side {
            grid-column: span 4;
        }
    }

    /* Below a region of 560 the one table turns rows into list rows; this one stays a table. */
    @container app-region (width < 560px) {
        .app-conflict-compare .app-table-grid {
            display: table;
            table-layout: auto;
        }

        .app-conflict-compare .app-table-grid > thead {
            display: table-header-group;
        }

        .app-conflict-compare .app-table-grid > tbody {
            display: table-row-group;
        }

        .app-conflict-compare .app-table-grid > tbody > tr {
            display: table-row;
            padding: 0;
            box-shadow: none;
        }

        .app-conflict-compare .app-table-header[data-width] {
            inline-size: auto;
        }

        .app-conflict-compare .app-table-grid > tbody > tr > .app-table-cell {
            display: table-cell;
            block-size: var(--app-control-height);
            padding: var(--app-space-control-y) var(--app-space-cell-x);
            color: var(--app-color-text);
            box-shadow: inset 0 calc(-1 * var(--app-border-width)) 0 var(--app-color-line);
        }

        .app-conflict-compare .app-table-grid > tbody > tr > .app-table-cell:first-child {
            color: var(--app-color-text-muted);
        }
    }
}
