/* Definition-of-Ready refinement, Jira deep links, and persistent repository UI. */
.jira-issue-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #2468bd;
  text-decoration: none;
  font-weight: 700;
}

.jira-issue-link:hover {
  color: #174f97;
  text-decoration: underline;
}

.jira-issue-link.btn {
  color: var(--ink-2);
  font-weight: 700;
  text-decoration: none;
}

.epic-jira-link {
  flex: none;
  font-size: 12px;
}

.subtask-jira-link { color: var(--purple); }

.dor-rate-card {
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.dor-card-title strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
}

.dor-jira-key {
  padding: 3px 7px;
  background: var(--info-dim);
  border-radius: 6px;
}

.dor-ready-copy,
.dor-no-gaps {
  margin-top: 12px;
  padding: 10px 12px;
  color: #176b5a;
  background: var(--pass-dim);
  border: 1px solid #c7eadb;
  border-radius: 8px;
  font-size: 12px;
}

.dor-gap-list {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dor-gap-item {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  gap: 8px;
  color: #53647b;
  background: #fffaf2;
  border: 1px solid #eed7ac;
  border-radius: 8px;
}

.dor-gap-item.critical {
  background: #fff4f4;
  border-color: #efc7c7;
}

.dor-gap-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: #9b6107;
  background: #fff0cf;
  border-radius: 6px;
  font-weight: 800;
}

.dor-gap-item.critical .dor-gap-icon {
  color: #ad3c3c;
  background: #fde6e6;
}

.dor-gap-item span:last-child { min-width: 0; }
.dor-gap-item strong,
.dor-gap-item small,
.dor-gap-item em { display: block; }
.dor-gap-item strong { color: var(--ink); font-size: 11px; }
.dor-gap-item small { margin-top: 3px; font-size: 10px; line-height: 1.45; }
.dor-gap-item em { margin-top: 6px; color: #6c7b8f; font-size: 9.5px; line-height: 1.45; font-style: normal; }

.dor-refinement-closed {
  margin-top: 13px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-2);
  background: #f7fafc;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  font-size: 11px;
}
.dor-refinement-closed > button { flex: none; }
.dor-refinement-closed > span { flex: 1; min-width: 0; }

.dor-refinement-editor {
  margin-top: 13px;
  padding: 14px;
  background: linear-gradient(180deg, #f8fbff, #fff);
  border: 1px solid #cddfec;
  border-radius: 10px;
}

.dor-refinement-head,
.dor-editor-footer,
.dor-modal-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dor-refinement-head strong,
.dor-refinement-head small { display: block; }
.dor-refinement-head strong { color: var(--ink); font-size: 12px; }
.dor-refinement-head small { margin-top: 3px; color: var(--ink-2); font-size: 10px; }

.dor-refinement-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dor-refinement-grid label,
.dor-context-label {
  display: grid;
  gap: 6px;
  color: #53667e;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dor-refinement-grid select,
.dor-context-label textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.dor-refinement-grid select { height: 38px; padding: 0 10px; }
.dor-context-label { margin-top: 11px; }
.dor-context-label textarea { padding: 10px 11px; resize: vertical; line-height: 1.5; }
.dor-refinement-grid select:focus,
.dor-context-label textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,170,167,.10); }

.dor-editor-footer { margin-top: 11px; }
.dor-save-status { min-height: 18px; color: var(--ink-2); font-size: 10px; }
.dor-save-status.success { color: var(--pass); }
.dor-save-status.error { color: var(--fail); }

.dor-modal-score {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.dor-modal-score strong { font-family: var(--mono); font-size: 22px; }
.dor-modal-score span { color: var(--ink-2); font-size: 12px; }

.gen-repo-status {
  margin-top: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #176b5a;
  background: linear-gradient(90deg, #eaf9f3, #f9fdfb);
  border: 1px solid #c5e8d9;
  border-radius: 10px;
}

.gen-repo-status strong,
.gen-repo-status span { display: block; }
.gen-repo-status strong { font-size: 12px; }
.gen-repo-status span { margin-top: 2px; color: #52786d; font-size: 10px; }

.generation-failures {
  margin-bottom: 12px;
  padding: 12px;
  display: grid;
  gap: 4px;
  color: #a43b3b;
  background: var(--fail-dim);
  border: 1px solid #efc6c6;
  border-radius: 9px;
  font-size: 11px;
}

.generation-failures strong { font-size: 12px; }

.repo-filter-section {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.repo-filter-label {
  margin-bottom: 7px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.repo-record-meta,
.repo-story-links {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.repo-classification-note {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 10px;
}

.repo-empty {
  padding: 30px;
  color: var(--ink-2);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
}

@media (max-width: 820px) {
  .dor-gap-list,
  .dor-refinement-grid { grid-template-columns: 1fr; }
  .dor-refinement-closed,
  .dor-editor-footer,
  .gen-repo-status { align-items: stretch; flex-direction: column; }
}


.repo-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.repo-summary-row { align-items: stretch; }
.repo-metric-grid { align-self: stretch; }
.repo-deprecated-metric { min-width: 140px; display: grid; align-content: center; }
.repo-toolbar {
  margin-top: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.repo-search-wrap { flex: 1; display: grid; gap: 6px; color: var(--ink-3); font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.repo-search-wrap input { text-transform: none; letter-spacing: 0; font-weight: 400; }
.repo-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.repo-edit-grid label { display: grid; gap: 6px; color: var(--ink-3); font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.repo-edit-grid input,
.repo-edit-grid select,
.repo-edit-grid textarea { text-transform: none; letter-spacing: 0; font-weight: 400; font-family: inherit; resize: vertical; }
.repo-story-links .jira-issue-link { margin-right: 5px; }

@media (max-width: 900px) {
  .repo-heading-actions { width: 100%; margin-left: 0 !important; justify-content: flex-start; }
  .repo-metric-grid { min-width: 0 !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repo-toolbar { align-items: stretch; flex-direction: column; }
  .repo-edit-grid { grid-template-columns: 1fr; }
  .repo-edit-grid > * { grid-column: auto !important; }
}


.jira-story-summary-link {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jira-story-summary-link:hover { color: var(--accent); text-decoration: underline; }
.jira-story-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* SAGE 5.0 compact advisory DoR list. */
.dor-recommendations {
  margin-top: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.dor-recommendations > summary {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 750;
}
.dor-recommendations > summary::-webkit-details-marker,
.dor-recommendation-row > summary::-webkit-details-marker { display: none; }
.dor-recommendations > summary small {
  color: var(--warn);
  font-size: 9px;
  font-weight: 650;
}
.dor-recommendations > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  margin-left: 4px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.dor-recommendations[open] > summary::after { transform: rotate(-135deg); }
.dor-recommendation-list { border-top: 1px solid var(--line); }
.dor-recommendation-row { border-bottom: 1px solid var(--line); }
.dor-recommendation-row:last-child { border-bottom: 0; }
.dor-recommendation-row > summary {
  min-height: 40px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.dor-recommendation-row > summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dor-recommendation-row > summary > span:last-child {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
}
.dor-rec-dot {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  color: #92600d;
  background: var(--warn-dim);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
.dor-rec-detail {
  padding: 0 42px 11px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.5;
}
.dor-rec-detail p { margin: 4px 0 0; }
.dor-rate-card.bad { border-color: var(--line); }

.gen-import-row,
.gen-import-item,
.gen-strategy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.gen-import-row strong { font-size: 12px; }
.gen-import-row p { margin: 3px 0 0; color: var(--ink-2); font-size: 10.5px; }
.gen-import-list { margin-top: 12px; display: grid; gap: 8px; }
.gen-import-item { padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.gen-import-item strong,
.gen-import-item small { display: block; }
.gen-import-item strong { font-size: 11px; }
.gen-import-item small { margin-top: 3px; color: var(--ink-2); font-size: 9px; }
.gen-strategy-row { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); align-items: end; }
.gen-strategy-row label { min-width: 300px; display: grid; gap: 5px; color: var(--ink-2); font-size: 10px; font-weight: 700; }
.gen-strategy-row select { height: 38px; }
.gen-strategy-row small { color: var(--ink-3); font-size: 9.5px; }
@media (max-width: 760px) { .gen-import-row,.gen-import-item,.gen-strategy-row { align-items: stretch; flex-direction: column; } .gen-strategy-row label { min-width: 0; width: 100%; } }

/* Repository view fills the viewport height so the grid is the only part that
   scrolls: its sticky header stays visible and its horizontal scrollbar sits
   right at the bottom of the screen instead of at the bottom of the page.
   :not([hidden]) ensures this doesn't override the [hidden] attribute's
   display:none when the repo pane isn't the active view — without it, this
   panel remained visible (as an unwanted block) at the bottom of every other
   workflow page. */
.view[data-pane="repo"]:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.view[data-pane="repo"] .fg-heading,
.view[data-pane="repo"] .repo-summary-row,
.view[data-pane="repo"] .repo-toolbar,
.view[data-pane="repo"] .repo-filter-section { flex: none; }

/* Hierarchical repository tree: Business Theme > User Story > Test Scenario.
   min-height guarantees the tree always shows close to a full page of content
   even when the theme/category filter chips push it down; if the header
   content is unusually tall the outer page scrolls to reveal the rest, but
   the tree itself still keeps growing to fill any space left over. */
#repolist {
  flex: 1;
  min-height: 65vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
/* Toggle between the flat spreadsheet grid and the Theme > Story group-by tree;
   both views share the .catchip filter-chip look for visual consistency. */
.repo-view-toggle { display: flex; gap: 6px; flex: none; }

/* Flat, sortable, Excel-style spreadsheet grid view. One row per test case;
   clicking a row expands an inline detail row (steps/expected/pre-conditions)
   below it via .repo-tree-case-body, which is shared with the tree view. */
.repo-grid-hint { font-size: 11px; color: var(--ink-3); flex: 1; }
.repo-grid-wrap { overflow: auto; }
table.repo-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.repo-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.repo-grid thead th:hover { background: var(--accent-dim); }
.repo-grid thead th.sorted { color: var(--ink); }
.repo-grid-sort { display: inline-block; width: 10px; color: #2f7de1; }
.repo-grid-actions-head { cursor: default; width: 84px; }
.repo-grid thead th.repo-grid-actions-head:hover { background: var(--panel-2); }
.repo-grid tbody td {
  padding: 7px 10px;
  border: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.repo-grid-row { cursor: pointer; }
.repo-grid-row:hover td { background: var(--accent-dim); }
.repo-grid-row.expanded td { background: var(--panel-2); }
.repo-grid-row.dep td { opacity: .55; }
.repo-grid-id { color: #2f7de1; width: 78px; }
.repo-grid-title { white-space: normal; min-width: 220px; }
.repo-grid-story { white-space: normal; }
.repo-grid-updated { color: var(--ink-2); font-size: 11px; width: 130px; }
.repo-grid-actions-cell { white-space: nowrap; width: 84px; }
.repo-grid-actions-cell .iconbtn { margin-right: 2px; }
.repo-grid-detail-row td {
  background: #fff;
  cursor: default;
  white-space: normal;
}

/* Hierarchical group-by view: Business Theme > User Story > Test Scenario. */
.repo-tree { display: flex; flex-direction: column; gap: 8px; }
.repo-tree-theme { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.repo-tree-theme-header,
.repo-tree-story-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.repo-tree-theme-header { background: var(--panel-2); font-weight: 700; }
.repo-tree-theme-header:hover,
.repo-tree-story-header:hover { background: var(--accent-dim); }
.repo-tree-theme-name { flex: 1; color: var(--ink); font-size: 13px; }
.repo-tree-theme-header .cnt,
.repo-tree-story-header .cnt {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
}
.repo-tree-chevron {
  flex: none;
  display: inline-block;
  font-size: 10px;
  color: var(--ink-3);
  transition: transform .12s ease;
}
.repo-tree-chevron.open { transform: rotate(90deg); }
.repo-tree-theme-body {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 10px 8px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.repo-tree-story { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.repo-tree-story-header { background: var(--panel-2); font-size: 12px; }
.repo-tree-story-header .repo-story-links { flex: 1; margin-top: 0; }
.repo-tree-story-body {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 10px 8px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.repo-tree-case { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.repo-tree-case.dep { opacity: .55; }
.repo-tree-case-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.repo-tree-case-id { flex: none; color: #2f7de1; font-size: 11px; }
.repo-tree-case-title { flex: 1; min-width: 160px; font-size: 12.5px; }
.repo-tree-case-actions { flex: none; margin-left: auto; display: flex; gap: 4px; }
.repo-tree-case-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.repo-tree-subhead {
  margin-bottom: 4px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.repo-tree-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink); }
.repo-tree-meta-col { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--ink-2); }
.repo-tree-meta-row b { color: var(--ink); font-weight: 650; }
.repo-tree-empty { color: var(--ink-3); font-size: 11px; font-style: italic; }

@media (max-width: 820px) {
  .repo-tree-case-body { grid-template-columns: 1fr; }
}
