:root {
  color-scheme: light;
  --bg: #eef3f2;
  --ink: #111c1a;
  --muted: #5d6d68;
  --surface: #ffffff;
  --border: #d4dedb;
  --accent: #007864;
  --accent-strong: #005847;
  --blue: #285c8f;
  --gold: #9b6a00;
  --rose: #a43a2c;
  --shadow: 0 18px 42px rgba(22, 38, 34, 0.12);
  --shadow-soft: 0 10px 24px rgba(22, 38, 34, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 120, 100, 0.16), rgba(40, 92, 143, 0.10) 42%, rgba(155, 106, 0, 0.08)),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 22px 16px;
}

.workspace {
  max-width: min(1760px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border: 1px solid rgba(62, 99, 128, 0.55);
  border-bottom: 3px solid var(--accent);
  border-radius: 7px;
  padding: 18px 22px;
  background: #101826;
  color: #f8fbff;
  box-shadow: 0 14px 32px rgba(7, 15, 27, 0.22);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.imc-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(104, 196, 232, 0.72);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(28, 132, 171, 0.9), rgba(14, 52, 82, 0.94)),
    #12324a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 12px 26px rgba(0, 0, 0, 0.24);
  line-height: 1;
}

.imc-mark strong {
  font-size: 1.25rem;
  color: #ffffff;
}

.imc-mark span {
  margin-top: -8px;
  color: #ffd28a;
  font-size: 0.68rem;
  font-weight: 950;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(91, 119, 153, 0.72);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(19, 30, 48, 0.86);
  color: #e8eef7;
  font-weight: 900;
  cursor: pointer;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #2bd66f;
  box-shadow: 0 0 0 4px rgba(43, 214, 111, 0.14);
}

.status-chip:hover,
.status-chip:focus-visible {
  border-color: rgba(133, 192, 230, 0.9);
  background: rgba(28, 58, 86, 0.98);
  color: #ffffff;
}

.status-chip.is-checking .status-dot {
  background: #8fb5d8;
  box-shadow: 0 0 0 4px rgba(143, 181, 216, 0.18);
}

.status-chip.is-warning {
  border-color: rgba(255, 204, 102, 0.82);
}

.status-chip.is-warning .status-dot {
  background: #ffbf3f;
  box-shadow: 0 0 0 4px rgba(255, 191, 63, 0.2);
}

.status-chip.is-error {
  border-color: rgba(255, 133, 118, 0.86);
}

.status-chip.is-error .status-dot {
  background: #ff6458;
  box-shadow: 0 0 0 4px rgba(255, 100, 88, 0.2);
}

.eyebrow {
  margin: 0 0 6px;
  color: #aebdd1;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-flex;
  margin-right: 8px;
  border: 1px solid rgba(255, 210, 138, 0.65);
  border-radius: 999px;
  padding: 3px 9px;
  color: #ffd28a;
}

.subtitle {
  margin: 6px 0 0;
  color: #aebdd1;
  font-size: 1rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.mode-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 4px 0 18px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.tab-button {
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: var(--ink);
  color: #fff;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.command-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto minmax(150px, 240px) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.team-row {
  grid-template-columns: auto minmax(260px, 1fr) auto 96px auto 96px auto;
}

.days-control {
  display: grid;
  grid-template-columns: minmax(128px, 1fr) minmax(84px, 0.62fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.days-control input[hidden] {
  display: none;
}

.days-control select,
.days-control input {
  width: 100%;
}

.group-combobox {
  position: relative;
  min-width: 0;
}

.group-combobox input[type="search"] {
  width: 100%;
}

.group-options {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(12, 30, 34, 0.2);
}

.group-option {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.group-option:hover,
.group-option.active {
  background: rgba(0, 120, 100, 0.1);
}

.group-option.empty {
  color: var(--muted);
  cursor: default;
}

.pbi-row {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto minmax(190px, 1fr) auto minmax(150px, 0.8fr) auto;
  align-items: center;
}

.pbi-row label {
  align-self: center;
}

.pbi-row input,
.pbi-row select {
  min-width: 150px;
}

#pbiTextFilter {
  grid-column: 2 / -1;
  min-width: 260px;
}

.pbi-row label[for="pbiTextFilter"] {
  grid-column: 1;
  grid-row: 2;
}

#pbiTextFilter {
  grid-row: 2;
}

.pbi-row label[for="pbiSystemFilter"] {
  grid-column: 1;
  grid-row: 1;
}

#pbiSystemFilter {
  grid-column: 2;
  grid-row: 1;
}

.pbi-row label[for="pbiSortBy"] {
  grid-column: 3;
  grid-row: 1;
}

#pbiSortBy {
  grid-column: 4;
  grid-row: 1;
}

.pbi-row label[for="pbiSortDirection"] {
  grid-column: 5;
  grid-row: 1;
}

#pbiSortDirection {
  grid-column: 6;
  grid-row: 1;
}

#refreshOpenProblemsButton {
  grid-column: 7;
  grid-row: 1;
  justify-self: stretch;
}

.pbi-check-row {
  grid-template-columns: auto minmax(260px, 1fr) auto minmax(96px, 120px) auto;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.relation-lookup {
  margin-bottom: 18px;
}

.relation-copy {
  max-width: 780px;
}

.relation-copy h2 {
  margin-bottom: 6px;
}

.help-content {
  display: grid;
  gap: 10px;
  max-width: 920px;
}

.help-content p {
  margin: 0;
}

.help-content h3 {
  margin: 8px 0 0;
  font-size: 1rem;
}

.help-glossary {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(280px, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.help-glossary dt {
  color: var(--ink);
  font-weight: 950;
}

.help-glossary dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.ignored-list {
  display: grid;
  gap: 10px;
}

.ignored-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.ignored-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.settings-card {
  display: grid;
  gap: 14px;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(160px, 220px);
  gap: 12px 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(238, 243, 242, 0.62);
}

.number-with-unit {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.number-with-unit input {
  width: 100%;
}

.number-with-unit span,
.settings-note {
  color: var(--muted);
  font-weight: 750;
}

.settings-note {
  margin: 0;
}

label {
  color: var(--muted);
  font-weight: 850;
}

input,
select {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:focus,
select:focus {
  outline: 3px solid rgba(0, 120, 100, 0.18);
  border-color: var(--accent);
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 950;
  cursor: help;
}

.help-dot::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 4;
  width: 260px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-soft);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: none;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.help-dot:hover::after,
.help-dot:focus-visible::after {
  opacity: 1;
}

button {
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 120, 100, 0.18);
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  box-shadow: none;
}

button.secondary:hover {
  background: #edf7f4;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 120, 100, 0.18);
}

.button-link:hover {
  background: var(--accent-strong);
}

.button-link.secondary {
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  box-shadow: none;
}

.button-link.secondary:hover {
  background: #edf7f4;
}

.topbar button.secondary,
.topbar .button-link.secondary {
  min-height: 38px;
  border-color: rgba(62, 143, 177, 0.82);
  background: rgba(19, 30, 48, 0.92);
  color: #e8eef7;
  box-shadow: none;
}

.topbar button.secondary:hover,
.topbar .button-link.secondary:hover {
  background: rgba(28, 58, 86, 0.98);
  color: #ffffff;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
  gap: 18px;
}

.panel,
.template-section,
.cluster-card,
.metric,
.runtime-drawer {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.panel,
.template-section,
.runtime-drawer {
  padding: 18px;
}

.status-panel {
  min-height: 185px;
  border-top: 4px solid var(--accent);
}

.runtime-drawer {
  margin-bottom: 16px;
}

.panel-header,
.cluster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 3px 12px;
  background: #e8efed;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.high {
  background: #d8f2eb;
  color: var(--accent-strong);
}

.badge.medium {
  background: #fff1ce;
  color: var(--gold);
}

.badge.low {
  background: #ffe1dc;
  color: var(--rose);
}

.status-text {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.12;
  font-weight: 900;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.data-list {
  display: grid;
  grid-template-columns: minmax(128px, 0.34fr) 1fr;
  gap: 10px 14px;
  margin: 0;
}

.data-list.compact {
  grid-template-columns: 128px 1fr;
}

.data-list dt {
  color: var(--muted);
  font-weight: 900;
}

.data-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.evidence-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 22px;
}

.evidence-list li {
  padding-left: 4px;
}

.evidence-list strong {
  display: block;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 16px;
}

.metric-button {
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.metric-button:hover,
.metric-button:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 12px 26px rgba(0, 120, 100, 0.13);
  transform: translateY(-1px);
}

.metric-button.active {
  border-color: var(--accent);
  background: #eef8f5;
}

.metric span {
  display: block;
  font-size: 2.1rem;
  font-weight: 950;
  color: var(--ink);
}

.metric p {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.pbi-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.pbi-metrics .metric {
  min-height: 94px;
  padding: 14px 16px;
}

.pbi-metrics .metric span {
  font-size: 1.9rem;
}

.pbi-metrics .metric p {
  font-size: 0.88rem;
  line-height: 1.2;
}

.closed-review-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.closed-review-workbench {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(380px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.closed-review-workbench > .pbi-detail-panel {
  position: sticky;
  top: 14px;
  align-self: start;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.compact-command-row {
  width: auto;
  min-width: min(620px, 100%);
}

.closed-problems-row {
  grid-template-columns: auto minmax(280px, 1fr) auto 96px auto 96px auto minmax(150px, 220px) auto 120px auto;
}

.closed-problems-summary-row {
  margin: 8px 0 12px;
}

.closed-problems-table {
  width: 100%;
  min-width: 980px;
}

.closed-problems-table th:nth-child(1),
.closed-problems-table td:nth-child(1) {
  width: 150px;
}

.closed-problems-table th:nth-child(2),
.closed-problems-table td:nth-child(2) {
  width: auto;
}

.closed-problems-table th:nth-child(3),
.closed-problems-table td:nth-child(3) {
  width: 260px;
}

.closed-problems-table th:nth-child(4),
.closed-problems-table td:nth-child(4) {
  width: 150px;
}

.closed-problems-table th:nth-child(5),
.closed-problems-table td:nth-child(5) {
  width: 130px;
}

.closed-problems-table .pbi-id-cell a {
  color: var(--accent-strong);
  font-weight: 950;
  text-decoration: none;
}

.closed-problems-table .pbi-id-cell a:hover {
  text-decoration: underline;
}

.closed-problems-table .numeric-cell {
  text-align: right;
  font-weight: 950;
  color: var(--accent-strong);
}

.closed-review-table tr.active td {
  background: #eef8f5;
}

.closed-review-table .warning-cell {
  color: #9a5b00;
  font-weight: 950;
}

.related-incidents-block {
  margin-top: 14px;
}

.related-incidents-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.cluster-board {
  display: grid;
  gap: 14px;
}

.cluster-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.cluster-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--muted);
}

.cluster-card.relate::before {
  background: var(--accent);
}

.cluster-card.create::before {
  background: var(--blue);
}

.cluster-card.watch::before {
  background: var(--gold);
}

.cluster-recommendation {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 800;
}

.cluster-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.template-section {
  margin-top: 18px;
}

.output-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pbi-quick-result {
  margin-bottom: 18px;
}

.duplicate-match-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.duplicate-match-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.duplicate-match-card h3 {
  margin: 0;
  font-size: 1rem;
}

.pbi-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
  gap: 18px;
  margin-bottom: 18px;
}

.process-panel {
  margin-bottom: 18px;
}

.process-search-row {
  margin: 12px 0 14px;
}

.process-search-row input {
  min-width: min(520px, 100%);
}

.process-phase-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.process-phase-card {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.process-phase-card:hover,
.process-phase-card:focus-visible,
.process-phase-card.active {
  border-color: var(--accent);
  background: #eef8f5;
  outline: none;
}

.process-phase-card.active {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.process-phase-card span {
  color: var(--accent-strong);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 950;
}

.process-phase-card strong {
  color: var(--muted);
  font-size: 0.9rem;
}

.process-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
}

.process-list {
  display: grid;
  gap: 8px;
  max-height: 640px;
  overflow: auto;
}

.process-list-item {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 0;
  border-color: var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.process-list-item:hover,
.process-list-item.active {
  border-color: var(--accent);
  background: #eef8f5;
}

.process-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.process-list-item p {
  margin: 0;
  font-weight: 850;
}

.process-list-item small {
  color: var(--muted);
  line-height: 1.35;
}

.process-score {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e8f1ef;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 950;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-button {
  min-height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  box-shadow: none;
}

.queue-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.detail-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 14px;
  background: #d8f2eb;
  color: var(--accent-strong);
  font-weight: 950;
}

.pbi-detail-title {
  margin: 0 0 14px;
  font-weight: 900;
}

.pbi-latest-note {
  margin: 14px 0 0;
  max-height: 130px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.45;
}

.snooze-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.snooze-actions .muted {
  flex-basis: 100%;
}

.pbi-overview {
  padding: 0;
  overflow: hidden;
}

.pbi-activity-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 12px 18px;
  padding: 16px 18px;
  margin-bottom: 22px;
}

.pbi-activity-panel .panel-header {
  margin: 0;
}

.pbi-activity-panel .panel-header h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.pbi-activity-panel .panel-header .muted {
  margin: 0;
  font-size: 0.9rem;
}

.activity-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.checkbox-control {
  color: var(--ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.inline-control select {
  width: auto;
  min-width: 116px;
  min-height: 38px;
}

.activity-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.activity-options {
  grid-column: 2;
  justify-self: end;
  align-self: start;
  margin-top: -2px;
}

.activity-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-items: start;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: none;
}

.activity-card:hover,
.activity-card.active {
  border-color: var(--accent);
  background: #eef8f5;
  color: var(--ink);
}

.activity-card span {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 950;
}

.activity-card strong {
  display: block;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
}

.activity-list-panel {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.activity-list-panel .panel-header {
  margin-bottom: 10px;
}

.activity-list-panel h3 {
  margin: 0;
}

.activity-list {
  overflow: auto;
}

.activity-detail-panel {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.activity-detail-panel .panel-header {
  margin-bottom: 12px;
}

.activity-detail-panel h3 {
  margin: 0;
}

.activity-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.activity-table th,
.activity-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.activity-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.activity-table tbody tr {
  cursor: pointer;
}

.activity-table tbody tr:hover td {
  background: #eef8f5;
}

.activity-table .pbi-id-cell {
  color: var(--accent-strong);
  font-weight: 950;
  white-space: nowrap;
}

.activity-table td:nth-child(2) {
  font-weight: 800;
}

.problem-info-block {
  margin: 8px 0 4px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(238, 243, 242, 0.62);
}

.problem-info-block h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.problem-info-block p {
  margin: 0;
  line-height: 1.45;
}

.pbi-overview .panel-header {
  margin: 0;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
}

.pbi-table {
  width: max(100%, 1380px);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
  table-layout: fixed;
}

.pbi-table th,
.pbi-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.pbi-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf9;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.sort-header {
  display: inline;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-transform: inherit;
  box-shadow: none;
}

.sort-header:hover,
.sort-header:focus-visible,
.sort-header.active {
  background: transparent;
  color: var(--accent-strong);
  outline: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pbi-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.pbi-table th:nth-child(1),
.pbi-table td:nth-child(1) {
  width: 120px;
}

.pbi-table th:nth-child(2),
.pbi-table td:nth-child(2) {
  width: 112px;
}

.pbi-table th:nth-child(3),
.pbi-table td:nth-child(3) {
  width: 150px;
}

.pbi-table th:nth-child(4),
.pbi-table td:nth-child(4) {
  width: 100px;
}

.pbi-table th:nth-child(5),
.pbi-table td:nth-child(5) {
  width: 240px;
}

.pbi-table th:nth-child(6),
.pbi-table td:nth-child(6) {
  width: 330px;
}

.pbi-table th:nth-child(7),
.pbi-table td:nth-child(7) {
  width: 300px;
}

.pbi-table th:nth-child(8),
.pbi-table td:nth-child(8) {
  width: 230px;
}

.light-pbi-table {
  width: max(100%, 1320px);
}

.light-pbi-table th:nth-child(1),
.light-pbi-table td:nth-child(1) {
  width: 130px;
}

.light-pbi-table th:nth-child(2),
.light-pbi-table td:nth-child(2) {
  width: 150px;
}

.light-pbi-table th:nth-child(3),
.light-pbi-table td:nth-child(3) {
  width: 330px;
}

.light-pbi-table th:nth-child(4),
.light-pbi-table td:nth-child(4) {
  width: 130px;
}

.light-pbi-table th:nth-child(5),
.light-pbi-table td:nth-child(5) {
  width: 260px;
}

.light-pbi-table th:nth-child(6),
.light-pbi-table td:nth-child(6) {
  width: 170px;
}

.light-pbi-table th:nth-child(7),
.light-pbi-table td:nth-child(7) {
  width: 150px;
}

.light-pbi-table th:nth-child(8),
.light-pbi-table td:nth-child(8) {
  width: 120px;
}

.light-pbi-table .pbi-id-cell {
  color: var(--accent-strong);
  font-weight: 950;
  white-space: nowrap;
}

.light-workbench {
  grid-template-columns: 1fr;
}

.section-label {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pbi-row-item {
  cursor: pointer;
}

.pbi-row-item:hover td,
.pbi-row-item.selected td {
  background: #eef8f5;
}

.pbi-row-item.signal-critical td:first-child {
  box-shadow: inset 5px 0 0 var(--rose);
}

.pbi-row-item.signal-warning td:first-child {
  box-shadow: inset 5px 0 0 var(--gold);
}

.pbi-row-item.signal-ok td:first-child {
  box-shadow: inset 5px 0 0 var(--accent);
}

.pbi-row-item.signal-snoozed td {
  color: var(--muted);
  background: #f6f8f7;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.2;
  white-space: nowrap;
}

.signal-pill.critical {
  background: #ffe1dc;
  color: var(--rose);
}

.signal-pill.warning {
  background: #fff1ce;
  color: var(--gold);
}

.signal-pill.ok {
  background: #d8f2eb;
  color: var(--accent-strong);
}

.signal-pill.snoozed {
  background: #e8efed;
  color: var(--muted);
}

.pbi-table td:nth-child(3) {
  color: var(--accent-strong);
  font-weight: 950;
  white-space: nowrap;
}

.pbi-table td:nth-child(4) {
  font-weight: 900;
}

.pbi-table td:nth-child(6) {
  font-weight: 800;
}

.pbi-table td:nth-child(5) {
  color: var(--muted);
}

.cell-subline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.pbi-table:not(.light-pbi-table) td:nth-child(2) {
  font-size: 0.82rem;
  white-space: nowrap;
}

.light-pbi-table td:nth-child(2) {
  color: var(--accent-strong);
  font-weight: 950;
  white-space: nowrap;
}

.light-pbi-table td:nth-child(3),
.light-pbi-table td:nth-child(4),
.light-pbi-table td:nth-child(6) {
  color: inherit;
  font-weight: inherit;
}

.light-pbi-table td:nth-child(3) {
  line-height: 1.35;
  overflow-wrap: normal;
  white-space: normal;
  word-break: normal;
}

.light-pbi-table td:nth-child(4),
.light-pbi-table td:nth-child(5),
.light-pbi-table td:nth-child(6),
.light-pbi-table td:nth-child(7) {
  overflow-wrap: normal;
  word-break: normal;
}

.light-pbi-table td:nth-child(8) {
  color: var(--muted);
}

.closed-problems-table td:nth-child(2),
.closed-problems-table td:nth-child(3),
.closed-problems-table td:nth-child(4) {
  color: inherit;
  font-weight: inherit;
}

.closed-problems-table .numeric-cell {
  color: var(--accent-strong);
  font-weight: 950;
  text-align: right;
}

.closed-problems-table {
  table-layout: fixed;
  width: 100%;
}

.closed-problems-table th:nth-child(1),
.closed-problems-table td:nth-child(1) {
  width: 160px;
}

.closed-problems-table th:nth-child(2),
.closed-problems-table td:nth-child(2) {
  width: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.closed-problems-table th:nth-child(3),
.closed-problems-table td:nth-child(3) {
  width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.closed-problems-table th:nth-child(4),
.closed-problems-table td:nth-child(4) {
  width: 150px;
  white-space: nowrap;
}

.closed-problems-table th:nth-child(5),
.closed-problems-table td:nth-child(5) {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

.pbi-reminder-button {
  min-width: 78px;
  width: 100%;
  padding: 0 8px;
}

.worklog-cell {
  display: -webkit-box;
  max-height: 6.2em;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.empty-cell {
  padding: 28px !important;
  color: var(--muted);
  font-weight: 800;
  text-align: center !important;
}

pre {
  min-height: 260px;
  max-height: 560px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid #20312e;
  border-radius: 7px;
  padding: 16px;
  background: #101817;
  color: #f4fbf8;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

pre.inline-template {
  min-height: 180px;
  max-height: 380px;
}

.backend-wait[hidden] {
  display: none;
}

.backend-wait {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 38, 0.26);
  backdrop-filter: blur(3px);
}

.backend-wait-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: min(340px, 92vw);
  border: 1px solid rgba(0, 120, 100, 0.28);
  border-radius: 8px;
  padding: 24px 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.backend-wait-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #d8f2eb;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: backend-wait-spin 0.85s linear infinite;
}

.backend-wait p {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

@keyframes backend-wait-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  .command-row,
  .team-row,
  .pbi-check-row,
  .settings-grid,
  .settings-form,
  .result-grid,
  .metric-strip,
  .pbi-activity-panel,
  .pbi-workbench,
  .closed-problems-row,
  .closed-review-workbench {
    grid-template-columns: 1fr;
  }

  .activity-options {
    grid-column: 1;
    margin-top: 0;
  }


  .pbi-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  #pbiTextFilter,
  #pbiSystemFilter,
  #pbiSortBy,
  #pbiSortDirection,
  #refreshOpenProblemsButton {
    width: 100%;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

.relation-assessment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.relation-assessment-table th,
.relation-assessment-table td {
  padding: 0.65rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #d6e4df;
  overflow-wrap: anywhere;
}

.relation-assessment-table th:first-child {
  width: 35%;
}
