/* GA function lists (docs/ga-function-lists.md): arrangement of the function matrix only.
   Controls, buttons, dialogs and tables use the shared UI foundation. */
.gaSelection .mhomeFormColumns { max-width: 760px; }
.gaNotice p, .gaWarning { color: #92400e; }
.gaWarning { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 8px 12px; }
.gaPanel { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-block: 12px; }
.gaPanel .mhomeActions > button { width: auto; margin-top: 0; }
.gaPanel ul { margin: 6px 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.gaFacts { margin-block: 8px 12px; }
.gaFacts dt { overflow-wrap: anywhere; }
.gaListRemark { max-width: 960px; }
.gaCheck { display: flex; align-items: center; gap: 6px; }
.gaCheck input { width: auto; }
.gaListRemark textarea { width: 100%; }
dialog.gaWideDialog { --dialog-target-width: 1300px; }
.gaWideDialog .gatewayTableWrapper { min-width: 0; max-width: 100%; overflow: auto; }
.gaCatalogGroup { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-block: 10px; min-width: 0; }
.gaCatalogGroup table input { min-width: 90px; width: 100%; }

.gaMatrixToolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 12px 8px; }
.gaMatrixToolbar > select { flex: 0 1 260px; width: auto; min-width: 0; }
.gaMatrixToolbar > button { flex: 0 0 auto; width: auto; margin-top: 0; }
.gaMatrixToolbar input[type=search] { min-width: 200px; flex: 1 1 220px; max-width: 360px; width: auto; }
.gaMatrixToolbar .gaQuantity { width: 72px; }
.gaToolbarLabel { font-weight: 600; }
.gaSelectionCount, .gaLegend { color: #64748b; font-size: 12px; }
.gaLegend { flex-basis: 100%; }

/* Both directions scroll inside the wrapper; header row and identification columns stay visible. */
.gaMatrixWrapper { overflow: auto; max-height: max(320px, calc(100dvh - 300px)); border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.gaMatrix { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.gaMatrix th, .gaMatrix td { border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px 6px; background: #fff; vertical-align: middle; }
/* Header and footer stick as a whole: no per-row offsets that depend on rendered row heights. */
.gaMatrix thead { position: sticky; top: 0; z-index: 3; }
.gaMatrix tfoot { position: sticky; bottom: 0; z-index: 3; }
.gaMatrix thead th { background: #f9fafb; font-weight: 600; text-align: left; }
.gaMatrix thead tr:first-child th { height: 30px; }
.gaMatrix .gaGroup { text-align: center; background: #eef2f7; white-space: nowrap; }
.gaMatrix .gaCode { padding: 2px; height: 88px; vertical-align: bottom; }
.gaCodeButton { width: auto; margin: 0; writing-mode: vertical-rl; transform: rotate(180deg); background: none; border: 0; padding: 4px 2px; font: inherit; font-weight: 600; color: #287db5; cursor: pointer; max-height: 84px; overflow: hidden; }
.gaNormative .gaCodeButton { color: #263746; }
.gaMatrix .gaId { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.gaMatrix .gaSticky { position: sticky; z-index: 1; }
.gaMatrix :is(thead, tfoot) .gaSticky { z-index: 4; }
.gaMatrix .gaSticky1 { left: 0; width: 96px; min-width: 96px; max-width: 96px; }
.gaMatrix .gaSticky2 { left: 96px; width: 150px; min-width: 150px; max-width: 150px; }
.gaMatrix .gaSticky3 { left: 246px; width: 200px; min-width: 200px; max-width: 200px; box-shadow: 2px 0 0 #cbd5e1; }
.gaMatrix .gaCell { width: 30px; min-width: 30px; text-align: center; font-weight: 600; cursor: cell; user-select: none; }
.gaMatrix .gaCell.gaNotApplicable { color: #64748b; background: #f1f5f9; }
.gaMatrix .gaCell.gaAssigned { color: #1d4ed8; }
.gaMatrix .gaCell.gaDirty { background: #fef9c3; }
.gaMatrix .gaCell.gaSelected { background: #bfdbfe; box-shadow: inset 0 0 0 2px #287db5; }
.gaMatrix .gaRemark input { min-width: 180px; width: 100%; }
.gaMatrix .gaManual { max-width: none; overflow: visible; }
.gaMatrix .gaManual input, .gaMatrix .gaManual select { min-width: 120px; width: 100%; }
.gaMatrix .gaManual.gaDirty { background: #fef9c3; }
.gaMatrix .gaManual input[aria-invalid="true"] { border-color: #b91c1c; }
.gaMatrix .gaId.gaSumLabel { font-weight: 600; }
.gaMatrix .gaStatus { white-space: nowrap; }
.gaMatrix .gaStatus button { width: auto; margin: 0 0 0 6px; }
.gaMatrix tr.gaInvalid td { color: #94a3b8; }
.gaMatrix tr.gaInvalid .gaCell { cursor: not-allowed; }
.gaMatrix tr.gaChanged .gaId { background: #fffbeb; }
.gaOpen { color: #64748b; font-style: italic; }
.gaMatrix tfoot td { background: #e7eaee; font-weight: 600; white-space: nowrap; }
.gaMatrix tfoot td:first-child { z-index: 5; }
.gaMatrix .gaSum { text-align: center; }
.gaMatrix .gaSumLabel { white-space: nowrap; overflow: visible; }

/* Small screens: only the equipment and datapoint designations stay fixed. */
@media (max-width: 760px) {
    .gaFacts { grid-template-columns: minmax(0,1fr); }
    .gaFacts dt { font-weight: 600; }
    .gaMatrix .gaSticky3 { position: static; box-shadow: none; }
    .gaMatrix .gaSticky1 { width: 72px; min-width: 72px; max-width: 72px; }
    .gaMatrix .gaSticky2 { left: 72px; width: 110px; min-width: 110px; max-width: 110px; box-shadow: 2px 0 0 #cbd5e1; }
    .gaMatrixWrapper { max-height: max(280px, calc(100dvh - 220px)); }
}
