/* Model pages (requirements, object pages, matrix, impact, variants) and relation roles. */

/* Counters in the toolbar that filter the list, like the tiles of the project overview */
.model-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html:root .model-filters button {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: var(--scs-control-h-s);
  padding: 4px 12px;
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-m);
  background: var(--scs-surface);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
  font-weight: 500;
  box-shadow: none;
}

.model-filters strong {
  color: var(--scs-ink);
  font-size: var(--scs-text-m);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

html:root .model-filters button:hover {
  border-color: var(--scs-accent-line);
  background: var(--scs-accent-soft);
}

html:root .model-filters button[aria-pressed='true'] {
  border-color: var(--scs-accent);
  background: var(--scs-accent-soft);
  color: var(--scs-ink);
  box-shadow: inset 0 0 0 1px var(--scs-accent);
}

.model-filters button[aria-pressed='true'] strong {
  color: var(--scs-accent);
}

.model-filters .tone-gap strong {
  color: var(--scs-danger);
}

.model-filters .tone-warn strong {
  color: var(--scs-warn);
}

/* Pickers in the toolbar: a label and the current choice in one chip */
.chip-select,
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
}

html:root .chip-select select {
  width: auto;
  max-width: 360px;
  min-height: var(--scs-control-h-s);
  height: var(--scs-control-h-s);
  padding: 0 28px 0 12px;
  border: 1px solid var(--scs-accent-line);
  border-radius: 999px;
  background-color: var(--scs-accent-soft);
  color: var(--scs-ink);
  font-size: var(--scs-text-s);
  font-weight: 600;
}

html:root .chip-toggle {
  min-height: var(--scs-control-h-s);
  padding: 0 12px;
  border: 1px solid var(--scs-line);
  border-radius: 999px;
  background: var(--scs-surface);
  color: var(--scs-ink-2);
  cursor: pointer;
}

html:root .chip-toggle:has(input:checked) {
  border-color: var(--scs-accent-line);
  background: var(--scs-accent-soft);
  color: var(--scs-ink);
  font-weight: 600;
}

.chip-toggle input {
  margin: 0;
}

/* A list in the page card: table, then a quiet footer with the count */
.model-table-scroll {
  overflow-x: auto;
}

.model-list-footer {
  margin: 0;
  padding: 10px var(--scs-space-4);
  border-top: 1px solid var(--scs-line-2);
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
}

.requirements-table td.model-list-empty,
.trace-matrix td.model-list-empty {
  padding: var(--scs-space-4);
  color: var(--scs-ink-3);
  text-align: center;
}

/* Requirements catalog */
.requirements-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--scs-text-m);
}

.requirements-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--scs-line);
  background: var(--scs-surface-2);
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
  font-weight: 600;
  text-align: left;
}

/* 6.0: widths follow the column order since the selection column (5.0):
   1 selection, 2 ID, 3 title (takes the rest), 4 group (6.1), 5 status, 6 tags,
   7 source, 8 relations, 9 edit. */
.requirements-table th:nth-child(2) {
  width: 120px;
}

.requirements-table :is(th, td):first-child {
  padding-left: var(--scs-space-4);
}

.requirements-table :is(th, td):last-child {
  padding-right: var(--scs-space-4);
}
.requirements-table th:nth-child(4) {
  width: 140px;
}
.requirements-table th:nth-child(5) {
  width: 130px;
}
.requirements-table th:nth-child(6) {
  width: 140px;
}
.requirements-table th:nth-child(7) {
  width: 150px;
}
.requirements-table th:nth-child(8) {
  width: 140px;
}
.requirements-table th:nth-child(9) {
  width: 64px;
}

.requirements-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--scs-line-2);
  vertical-align: top;
}

.requirements-table tbody tr:hover {
  background: var(--scs-surface-2);
}

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

html:root :is(.req-id, .object-link) {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--scs-accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.req-id {
  font-family: var(--scs-font-mono);
  font-size: var(--scs-text-s);
  font-weight: 600;
}

html:root :is(.req-id, .object-link):hover {
  color: var(--scs-accent-hover);
  text-decoration: underline;
}

.req-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-left: calc(var(--req-depth, 0) * 16px);
}

.req-title strong {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-title span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.req-status {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid var(--scs-line);
  border-radius: 999px;
  background: var(--scs-surface-2);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.req-status[data-status='review'] {
  border-color: var(--scs-warn-line);
  background: var(--scs-warn-soft);
  color: var(--scs-warn);
}
.req-status[data-status='approved'] {
  border-color: var(--scs-ok-line);
  background: var(--scs-ok-soft);
  color: var(--scs-ok);
}
.req-status[data-status='obsolete'] {
  color: var(--scs-ink-3);
  text-decoration: line-through;
}

.req-external {
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
  overflow-wrap: anywhere;
}

a.req-external {
  color: var(--scs-accent);
}

.req-links {
  min-height: 0;
  padding: 2px 8px;
  font-size: var(--scs-text-s);
}

.req-actions button {
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
}

.req-empty {
  max-width: 560px;
  margin: var(--scs-space-6) auto;
  text-align: center;
}

.req-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--scs-space-3);
}

.req-form .wide,
.req-form .req-reference {
  grid-column: 1 / -1;
}

.req-reference {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--scs-space-2) var(--scs-space-3);
  margin: 0;
  padding: var(--scs-space-3);
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-m);
}

.req-reference legend {
  padding: 0 var(--scs-space-1);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
  font-weight: 600;
}

.req-reference small {
  grid-column: 1 / -1;
  color: var(--scs-ink-3);
}

/* Object page: icon, name, ID, status and baseline state in the heading, tabs, then cards */
/* #app: outranks the list toolbar grid (ux_unified.css 14.), else an empty white bar stays. */
html:root #app .table-toolbar:has(#table-actions:empty):has(.table-tools[hidden]) {
  display: none;
}

html:root #view-title:has(.view-title-icon) {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-title-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-l);
  background: var(--scs-surface);
  color: var(--scs-accent);
}

.view-title-icon svg {
  width: 24px;
  height: 24px;
}

.object-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.object-meta-kind,
.object-meta-time {
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
}

#object-baseline-state:empty {
  display: none;
}

.object-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border: 1px solid var(--scs-line);
  border-radius: 999px;
  background: var(--scs-surface-2);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.object-state.ok {
  border-color: var(--scs-ok-line);
  background: var(--scs-ok-soft);
  color: var(--scs-ok);
}

.object-state.warn {
  border-color: var(--scs-warn-line);
  background: var(--scs-warn-soft);
  color: var(--scs-warn);
}

.object-state.ok::before,
.object-state.warn::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.object-tabs {
  display: flex;
  gap: 22px;
  padding: 0 var(--scs-space-4);
  overflow-x: auto;
  border-bottom: 1px solid var(--scs-line);
}

html:root .object-tabs button {
  flex: none;
  min-height: 0;
  padding: 12px 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--scs-ink-2);
  font-size: var(--scs-text-m);
  font-weight: 500;
  box-shadow: none;
}

html:root .object-tabs button:hover {
  color: var(--scs-ink);
}

html:root .object-tabs button.active {
  border-bottom-color: var(--scs-accent);
  color: var(--scs-ink);
  font-weight: 650;
}

.object-tabs button span {
  margin-left: 2px;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
  font-weight: 500;
}

.object-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: var(--scs-space-4);
  align-items: start;
  padding: var(--scs-space-4);
}

.object-page.single {
  grid-template-columns: minmax(0, 1fr);
}

.object-column {
  display: grid;
  gap: var(--scs-space-4);
  min-width: 0;
}

.object-compact-table td {
  vertical-align: middle;
}

.object-compact-table td:first-child {
  width: 1%;
  white-space: nowrap;
}

.object-compact-table td:last-child {
  width: 1%;
  text-align: right;
}

html:root .object-relations-table .id-chip {
  margin: 0;
}

.object-usage-table td small {
  display: block;
}

.object-card {
  min-width: 0;
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-l);
  background: var(--scs-surface);
  box-shadow: var(--scs-shadow-1);
}

.object-card > header {
  display: flex;
  align-items: center;
  padding: 10px var(--scs-space-4);
  border-bottom: 1px solid var(--scs-line-2);
  background: var(--scs-surface-2);
  border-radius: var(--scs-radius-l) var(--scs-radius-l) 0 0;
}

.object-card > header > .object-card-note {
  margin-left: auto;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
}

.object-card-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.object-card-note + .object-card-actions {
  margin-left: var(--scs-space-3);
}

html:root .object-card-actions button {
  min-height: 0;
  padding: 3px 10px;
  font-size: var(--scs-text-s);
}

.object-card h3 {
  display: flex;
  align-items: center;
  gap: var(--scs-space-2);
  margin: 0;
  color: var(--scs-ink);
  font-size: var(--scs-text-m);
  font-weight: 600;
}

.object-card > :not(header) {
  margin: var(--scs-space-3) var(--scs-space-4);
}

.object-card > .object-table-scroll {
  margin: 0;
}

.object-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--scs-surface-3);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-xs);
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.object-attrs {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 0;
  font-size: var(--scs-text-m);
}

.object-attrs dt,
.object-attrs dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--scs-line-2);
}

.object-attrs dt {
  padding-right: var(--scs-space-4);
  color: var(--scs-ink-3);
}

.object-attrs dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.object-attrs dt:nth-last-of-type(1),
.object-attrs dd:last-child {
  border-bottom: 0;
}

.object-longtext {
  margin: 0;
  white-space: pre-wrap;
}

.object-table-scroll {
  overflow-x: auto;
}

.object-relations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--scs-text-m);
}

.object-relations-table th {
  padding: 8px 12px;
  background: var(--scs-surface);
  border-bottom: 1px solid var(--scs-line);
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
  font-weight: 600;
  text-align: left;
}

.object-relations-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--scs-line-2);
  vertical-align: top;
}

.object-relations-table tbody tr:last-child td {
  border-bottom: 0;
}

.object-relations-table td small {
  display: block;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
}

.object-role {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--scs-radius-s);
  background: var(--scs-accent-soft);
  color: var(--scs-accent);
  font-size: var(--scs-text-s);
  font-weight: 600;
  white-space: nowrap;
}

html:root .object-via {
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
}

.object-row-actions {
  width: 44px;
  text-align: right;
}

.object-row-actions button {
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
}

.object-notes {
  display: grid;
  gap: var(--scs-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.object-notes li {
  display: grid;
  gap: 2px;
  padding-bottom: var(--scs-space-2);
  border-bottom: 1px solid var(--scs-line-2);
}

.object-notes li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.object-notes p {
  margin: 0;
  color: var(--scs-ink-2);
  font-size: var(--scs-text-s);
  white-space: pre-wrap;
}

.object-notes small {
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
}

.object-notes .note-done .object-link {
  color: var(--scs-ink-3);
  text-decoration: line-through;
}

.object-baselines:empty {
  display: none;
}

.note-object {
  min-height: 0;
  margin-left: auto;
  padding: 1px 8px;
  font-size: var(--scs-text-xs);
}

/* Relation roles dialog */
.role-head,
.role-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr) 32px;
  gap: var(--scs-space-2);
  align-items: center;
}

.role-head {
  margin-top: var(--scs-space-3);
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
  font-weight: 600;
}

#relation-role-rows {
  display: grid;
  gap: var(--scs-space-2);
  margin: var(--scs-space-2) 0;
}

.role-row button {
  width: 32px;
  min-height: 0;
  height: 32px;
  padding: 0;
}

.role-builtins summary {
  cursor: pointer;
  color: var(--scs-ink-2);
}

@media (max-width: 1100px) {
  .object-page {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .view-title-icon {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 700px) {
  .req-form,
  .req-reference {
    grid-template-columns: minmax(0, 1fr);
  }

  .requirements-table th:nth-child(4),
  .requirements-table td:nth-child(4) {
    display: none;
  }
}

/* Sorting and filtering of the traceability lists (list_tools.js). The column headers sort
   like those of the editor tables; the bar above filters from six rows on. */
.object-relations-table th:has(> .list-sort) {
  padding: 0;
}

.object-relations-table .list-sort {
  justify-content: flex-start;
  padding: 8px 12px;
  font-weight: 600;
  white-space: nowrap;
}

.object-relations-table th[aria-sort='ascending'],
.object-relations-table th[aria-sort='descending'] {
  background: var(--scs-accent-soft);
  color: var(--scs-accent);
}

.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--scs-space-2);
  padding: var(--scs-space-2) var(--scs-space-4);
  border-bottom: 1px solid var(--scs-line-2);
}

.object-card > .list-tools {
  margin: 0;
}

.list-tools :is(input, select, button) {
  min-height: 30px;
  height: 30px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: var(--scs-text-s);
}

.list-tools-query {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 320px;
}

.list-tools-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-s);
}

.list-tools-field select {
  max-width: 190px;
}

/* The sort choice only appears where the column headers are hidden (narrow relation tables). */
.list-tools-sort {
  display: none;
}

.list-tools-count {
  margin-left: auto;
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
  white-space: nowrap;
}

.list-tools-empty {
  flex-basis: 100%;
  margin: 0;
}

.object-relations-table tr[hidden][hidden] {
  display: none;
}

@container (max-width: 720px) {
  .list-tools:has(+ .object-table-scroll .relation-rows) .list-tools-sort {
    display: inline-flex;
  }
}

/* 4.8.0: requirements of the base system, shown at an instance; never coverage. */
.object-inherited-row > td {
  opacity: 0.68;
}

/* 6.0: objects named in a requirement */
.req-mentions {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}
.req-mentions[hidden] {
  display: none;
}
.req-mention-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.req-mention-list small {
  color: var(--scs-ink-3);
  margin-left: 4px;
}

/* 6.4: colour of an effect chain on its object page. */
.object-chain-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid var(--scs-line);
  border-radius: 4px;
  vertical-align: -2px;
}

/* 6.13: effect chains of an interface; the via table follows under its own heading. */
.object-card-chains > h4 {
  margin-top: var(--scs-space-4);
  margin-bottom: var(--scs-space-2);
  font-size: var(--scs-text-s);
  color: var(--scs-ink-2);
}
.interface-chains-table td small {
  display: block;
  color: var(--scs-ink-3);
}
.interface-chains-assigned {
  margin: 0;
  padding: 0;
  list-style: none;
}
.interface-chains-assigned li + li {
  margin-top: 4px;
}
.interface-chains-table .interface-chains-assigned small {
  display: inline;
  margin-left: 6px;
}

/* 6.13: Freigabestand in the diagram heading, the interface register and the page "Freigaben". */
.approval-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}
.approval-changed-mark {
  color: var(--scs-warn);
  font-size: 10px;
  vertical-align: 1px;
}
.approvals-table .select-cell {
  width: 32px;
  text-align: center;
}
