:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-raised: #fbfcfe;
  --surface-muted: #f3f6fa;
  --text: #202833;
  --muted: #657286;
  --line: #d4dce7;
  --line-strong: #b8c4d3;
  --accent: #0f6b78;
  --accent-strong: #0a4f59;
  --accent-soft: #e6f4f6;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --danger-line: #f0b8b2;
  --warn: #9a5b00;
  --warn-bg: #fff7e6;
  --warn-line: #e8c37f;
  --ok: #25734d;
  --ok-bg: #edf8f1;
  --ok-line: #a8d7bd;
  --info: #315f99;
  --info-bg: #eef5ff;
  --info-line: #b8ccea;
  --shadow: 0 12px 28px rgba(21, 31, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f7f9fc 0, var(--bg) 260px),
    var(--bg);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: #111c27;
  color: #fff;
  border-bottom: 1px solid #071016;
  box-shadow: 0 2px 12px rgba(10, 18, 28, 0.22);
}

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

.brand {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.scope {
  color: #b9c6d3;
  font-size: 13px;
}

.top-nav,
.top-nav form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.nav-link {
  border: 1px solid #40566a;
  border-radius: 6px;
  padding: 5px 8px;
  color: #d8e2ea;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  border-color: #6f879d;
  text-decoration: none;
}

.user-pill {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #40566a;
  border-radius: 6px;
  padding: 5px 8px;
  color: #d8e2ea;
  font-size: 13px;
}

.app-main {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.messages {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 12px 22px 0;
}

.message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(21, 31, 45, 0.05);
}

.message.success {
  border-color: var(--ok-line);
  color: var(--ok);
  background: var(--ok-bg);
}

.message.error {
  border-color: var(--danger-line);
  color: var(--danger);
  background: var(--danger-bg);
}

.page-head,
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-title-block {
  min-width: 0;
}

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  max-width: 1120px;
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.muted,
.row-sub {
  color: var(--muted);
}

.row-sub {
  margin-top: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 650;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.primary-button:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.secondary-button {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #b8d5da;
}

.ghost-button {
  color: #fff;
  background: transparent;
  border-color: #40566a;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(21, 31, 45, 0.05);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px 220px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.filters input,
.filters select,
.login-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
}

.filters input:focus,
.filters select:focus,
.login-form input:focus,
.xml-editor:focus {
  outline: 2px solid rgba(15, 107, 120, 0.28);
  border-color: var(--accent);
}

.table-shell,
.panel-section,
.audit-panel,
.login-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.table-shell {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-muted);
  text-transform: uppercase;
}

.data-table th:first-child,
.data-table td:first-child {
  width: 42%;
}

.data-table.compact {
  table-layout: auto;
}

.data-table.compact th,
.data-table.compact td {
  padding: 8px;
  font-size: 13px;
}

.row-title {
  display: inline-block;
  max-width: 100%;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.status-pill,
.problem-count,
.ok-count,
.severity-chip,
.audit-total {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
}

.problem-count,
.severity-chip-error {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.severity-chip-warning {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.ok-count,
.severity-chip-info {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.source-failed_audit {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.source-ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.source-status-history {
  color: var(--muted);
  border-color: var(--line);
  background: #fff;
}

.source-status-history.source-failed_audit {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.detail-back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 38px;
  margin-bottom: 14px;
  border: 1px solid #b8d5da;
  border-radius: 7px;
  padding: 7px 12px;
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 6px 14px rgba(21, 31, 45, 0.06);
}

.detail-back-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.meta-line span {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  overflow-wrap: anywhere;
}

.action-stack {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.left-rail {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding-bottom: 8px;
}

.audit-panel,
.quick-sources-panel {
  padding: 14px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.compact-title-row {
  margin-bottom: 10px;
}

.panel-title-row h2,
.panel-subtitle {
  margin: 0;
}

.panel-subtitle {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  margin-bottom: 10px;
}

.audit-total {
  color: var(--info);
  border-color: var(--info-line);
  background: var(--info-bg);
}

.finding {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}

.severity-error {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, var(--danger-bg), #fff 42%);
}

.severity-warning {
  border-left-color: var(--warn);
  background: linear-gradient(90deg, var(--warn-bg), #fff 42%);
}

.severity-info {
  border-left-color: var(--info);
  background: linear-gradient(90deg, var(--info-bg), #fff 42%);
}

.finding-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.finding-code {
  min-width: 0;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.finding-message {
  margin: 8px 0;
  max-height: 118px;
  overflow: auto;
  color: #2d3746;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.finding-anchor {
  font-size: 13px;
}

.finding-anchor a {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-links {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.file-links a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: var(--surface-raised);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.version-list {
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.version-list li {
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.work-surface {
  min-width: 0;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tab-row a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(21, 31, 45, 0.05);
}

.panel-section {
  padding: 14px;
  margin-bottom: 16px;
  min-width: 0;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.editor-head h2 {
  margin: 0;
}

.xml-editor {
  display: block;
  width: 100%;
  min-height: 520px;
  max-height: 820px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdff;
  color: #17202b;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
}

.preview-frame {
  display: block;
  width: 100%;
  height: 780px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
}

.correction-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch;
}

.correction-editor,
.correction-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-raised);
}

.correction-editor {
  margin: 0;
}

.split-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}

.split-pane-head h3 {
  margin: 0;
  font-size: 14px;
}

.correction-split .xml-editor {
  min-height: 420px;
  height: 48vh;
  max-height: none;
}

.split-preview-frame {
  min-height: 720px;
  height: 78vh;
  max-height: none;
}

.login-shell {
  min-height: calc(100vh - 110px);
  display: grid;
  place-items: center;
}

.login-form {
  width: min(420px, 100%);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .left-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }

}

@media (max-width: 980px) {
  .filters,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .page-head,
  .detail-head {
    display: block;
  }

  .action-stack {
    justify-content: flex-start;
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 14px;
  }

  .scope {
    display: none;
  }

  .app-main,
  .messages {
    padding-left: 12px;
    padding-right: 12px;
  }

  .data-table {
    min-width: 760px;
  }

  .editor-head {
    display: block;
  }

  .editor-head .primary-button,
  .editor-head .secondary-button {
    margin-top: 8px;
  }
}

/* Detail cockpit redesign */
.detail-head-redesign {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(15, 107, 120, 0.12), rgba(255, 255, 255, 0.94) 38%),
    var(--surface);
}

.detail-head-redesign::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), #c27a20);
}

.act-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.act-kicker span {
  border: 1px solid rgba(15, 107, 120, 0.2);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.hero-actions {
  flex: 0 0 360px;
  display: grid;
  gap: 9px;
  justify-items: end;
}

.hero-actions form {
  margin: 0;
}

.review-status-form {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.review-status-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.review-status-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.status-lock-note {
  grid-column: 1 / -1;
  margin: -1px 0 0;
  padding: 7px 8px;
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  color: var(--warn);
  background: var(--warn-bg);
  font-size: 12px;
  font-weight: 650;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.summary-card {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 31, 45, 0.05);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.summary-card.tone-critical {
  border-color: var(--danger-line);
  background: linear-gradient(135deg, var(--danger-bg), #fff 58%);
}

.summary-card.tone-warning {
  border-color: var(--warn-line);
  background: linear-gradient(135deg, var(--warn-bg), #fff 58%);
}

.summary-card.tone-info {
  border-color: var(--info-line);
  background: linear-gradient(135deg, var(--info-bg), #fff 58%);
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.workflow-step {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.workflow-step span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.workflow-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
}

.workflow-done {
  color: var(--ok);
}

.workflow-done .workflow-dot {
  border-color: var(--ok);
  background: var(--ok);
}

.workflow-current {
  color: var(--accent-strong);
}

.workflow-current .workflow-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 120, 0.12);
}

.redesigned-grid {
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
}

.cockpit-panel {
  padding: 0;
  overflow: hidden;
}

.cockpit-panel > .panel-title-row,
.cockpit-panel > .panel-subtitle,
.cockpit-panel > .compact-files {
  margin-left: 14px;
  margin-right: 14px;
}

.cockpit-panel > .panel-title-row {
  padding-top: 14px;
}

.panel-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.audit-groups {
  display: grid;
  gap: 8px;
  padding: 0 14px;
}

.audit-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.audit-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  list-style: none;
}

.audit-group summary::-webkit-details-marker {
  display: none;
}

.audit-group summary strong {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  font-size: 12px;
}

.audit-group-error summary {
  background: var(--danger-bg);
  color: var(--danger);
}

.audit-group-warning summary {
  background: var(--warn-bg);
  color: var(--warn);
}

.audit-group-info summary {
  background: var(--info-bg);
  color: var(--info);
}

.audit-group-body {
  padding: 10px;
  border-top: 1px solid var(--line);
}

.finding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.anchor-button {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.anchor-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.muted-anchor {
  color: var(--muted);
}

.empty-inline {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.compact-files {
  padding-bottom: 14px;
}

.real-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 242, 246, 0.92);
  backdrop-filter: blur(8px);
}

.tab-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.tab-button:hover {
  border-color: var(--accent);
}

.tab-button.is-active {
  color: #fff;
  border-color: var(--accent-strong);
  background: var(--accent);
}

.tab-panel[hidden] {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(240px, 0.85fr);
  gap: 14px;
}

.next-action-panel {
  grid-row: span 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(15, 107, 120, 0.11), rgba(255, 255, 255, 0) 52%),
    #fff;
}

.next-action-panel h2 {
  margin: 6px 0 8px;
  font-size: 22px;
}

.next-action-panel p {
  margin: 0 0 14px;
  color: #354254;
  max-width: 62ch;
}

.next-action-error {
  border-color: var(--danger-line);
  background:
    linear-gradient(135deg, var(--danger-bg), rgba(255, 255, 255, 0) 54%),
    #fff;
}

.next-action-warning {
  border-color: var(--warn-line);
  background:
    linear-gradient(135deg, var(--warn-bg), rgba(255, 255, 255, 0) 54%),
    #fff;
}

.next-action-ok {
  border-color: var(--ok-line);
  background:
    linear-gradient(135deg, var(--ok-bg), rgba(255, 255, 255, 0) 54%),
    #fff;
}

.eyebrow {
  display: inline-flex;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.next-action-buttons,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.overview-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.status-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.status-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.status-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.status-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.status-list dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.job-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.source-card {
  min-height: 138px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.source-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.source-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.source-card span {
  display: block;
  color: #3a4655;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-card-missing {
  background: var(--surface-muted);
  color: var(--muted);
}

.source-missing {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.publication-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(280px, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.publication-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.publication-card-ready {
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.publication-card-blocked {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.publication-card h2,
.publication-history h2 {
  margin: 4px 0 12px;
}

.publication-reason,
.issue-list {
  margin: 12px 0 0;
  color: #334155;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.issue-list {
  padding-left: 18px;
}

.issue-list li + li {
  margin-top: 5px;
}

.publication-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.publication-file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.publication-file-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-muted);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.publication-message-row td {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 12px;
}

.history-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1fr);
  gap: 16px;
}

.richer-list {
  padding-left: 0;
  list-style: none;
}

.richer-list li {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) minmax(80px, auto);
  gap: 8px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.richer-list em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-style: normal;
}

.data-table.compact th:first-child,
.data-table.compact td:first-child {
  width: auto;
}

@media (max-width: 1180px) {
  .hero-actions {
    flex-basis: 100%;
    justify-items: start;
  }

  .detail-head-redesign {
    display: grid;
  }

  .review-status-form {
    max-width: 620px;
  }

  .summary-strip,
  .workflow-strip,
  .overview-layout,
  .publication-layout,
  .history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .redesigned-grid {
    grid-template-columns: 1fr;
  }

  .review-status-form {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-strip {
    gap: 10px;
  }

  .status-list div,
  .richer-list li {
    grid-template-columns: 1fr;
  }

  .source-card {
    display: grid;
  }
}

/* List workspace redesign */
.list-head {
  background:
    linear-gradient(90deg, rgba(17, 28, 39, 0.08), rgba(255, 255, 255, 0.94) 46%),
    var(--surface);
}

.list-head .eyebrow {
  margin-bottom: 4px;
}

.list-head h1 {
  max-width: 920px;
}

.list-summary {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.type-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(21, 31, 45, 0.04);
}

.type-chip strong {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.type-chip span,
.type-chip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.type-chip em {
  color: var(--danger);
}

.list-filters {
  grid-template-columns: minmax(220px, 1.15fr) minmax(145px, 0.72fr) minmax(165px, 0.78fr) minmax(110px, 0.45fr) minmax(140px, 0.62fr) minmax(180px, 0.9fr) minmax(150px, 0.68fr) minmax(150px, 0.68fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(21, 31, 45, 0.04);
  overflow-x: auto;
}

.list-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.list-filters label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  align-self: end;
  min-width: max-content;
}

.ghost-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.ghost-filter:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  text-decoration: none;
}

.list-workspace {
  margin-top: 12px;
}

.registry-filters {
  grid-template-columns: minmax(220px, 340px) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(21, 31, 45, 0.04);
}

.registry-layout,
.batch-import-layout {
  display: grid;
  gap: 14px;
}

.registry-table td:last-child {
  max-width: 520px;
  overflow-wrap: anywhere;
}

.batch-import-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.batch-import-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.batch-import-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.batch-import-form input[type="text"],
.batch-import-form input[type="number"],
.batch-import-form input[type="file"],
.batch-import-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
}


.wide-field {
  grid-column: span 2;
}

.upload-import-form .wide-field:first-of-type,
.file-upload-field,
.server-import-form .wide-field:first-of-type,
.server-import-form label:nth-of-type(5) {
  grid-column: span 3;
}

.file-upload-field input[type="file"] {
  min-height: 42px;
  padding-top: 8px;
}

.file-upload-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.import-panel {
  position: relative;
  overflow: hidden;
}

.import-panel-primary {
  border-color: #b8d5da;
  background:
    linear-gradient(135deg, rgba(15, 107, 120, 0.08), rgba(255, 255, 255, 0) 48%),
    #fff;
}

.import-jobs-table td:nth-child(1),
.import-jobs-table td:nth-child(2) {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.batch-card-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.batch-status-filter {
  grid-template-columns: minmax(220px, 340px) auto;
  align-items: end;
}

.batch-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

.batch-dashboard-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 31, 45, 0.05);
}

.batch-priority-high,
.batch-priority-urgent {
  border-left-color: var(--warn);
}

.batch-dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.batch-dashboard-head h2 {
  margin: 4px 0 4px;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.batch-dashboard-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.batch-dashboard-head > strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 17px;
}

.batch-dashboard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.batch-dashboard-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.batch-dashboard-stats strong {
  color: var(--text);
}

.batch-dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-line {
  grid-column: 1 / -1;
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.list-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 16px rgba(21, 31, 45, 0.04);
}

.list-view-bar > div:first-child {
  display: grid;
  gap: 2px;
}

.list-view-bar strong {
  font-size: 15px;
}

.list-view-tabs {
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.queue-layout {
  display: grid;
  gap: 10px;
}

.act-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
  gap: 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 13px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 31, 45, 0.05);
}

.act-card-error {
  border-left-color: var(--danger);
}

.act-card-warning {
  border-left-color: var(--warn);
}

.act-card-info {
  border-left-color: var(--info);
}

.act-card-ok {
  border-left-color: var(--ok);
}

.act-card-kicker,
.act-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.act-card-kicker span,
.act-card-meta span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.type-badge {
  color: var(--accent-strong);
  font-weight: 900;
}

.act-card-title {
  display: block;
  margin: 7px 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.act-card-title:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.act-card-status {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 7px;
}

.severity-line {
  display: flex;
  gap: 5px;
}

.severity-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.severity-mini-error {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.severity-mini-warning {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.severity-mini-info {
  color: var(--info);
  border-color: var(--info-line);
  background: var(--info-bg);
}

.queue-action {
  display: inline-flex;
  justify-content: center;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 850;
}

.queue-action:hover {
  text-decoration: none;
}

.queue-action-error {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.queue-action-warning {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.queue-action-info {
  color: var(--info);
  border-color: var(--info-line);
  background: var(--info-bg);
}

.queue-action-ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.monitor-grid,
.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 12px;
}

.year-stack {
  display: grid;
  gap: 16px;
}

.year-section {
  display: grid;
  gap: 10px;
}

.year-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-raised);
}

.year-heading h2 {
  margin: 0;
  font-size: 18px;
}

.year-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.monitor-card,
.batch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 31, 45, 0.05);
}

.monitor-card-head,
.batch-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.monitor-card h2,
.batch-card h2 {
  margin: 4px 0 3px;
  font-size: 20px;
}

.monitor-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.monitor-card-head > strong,
.batch-card-head > strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 18px;
}

.monitor-progress {
  height: 8px;
  margin: 12px 0;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.monitor-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--ok));
}

.monitor-facts,
.batch-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.monitor-facts span,
.batch-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.batch-stats strong {
  color: var(--text);
}

.monitor-acts,
.batch-preview-list {
  display: grid;
  gap: 6px;
}

.monitor-acts a,
.batch-preview-list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.batch-preview-list a {
  display: block;
  overflow-wrap: anywhere;
}

.monitor-acts a:hover,
.batch-preview-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.monitor-acts span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.monitor-acts strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.monitor-acts em {
  justify-self: end;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

@media (max-width: 980px) {
  .list-summary,
  .registry-filters,
  .batch-status-filter,
  .batch-import-form {
    grid-template-columns: 1fr;
  }

  .wide-field,
  .upload-import-form .wide-field:first-of-type,
  .file-upload-field,
  .server-import-form .wide-field:first-of-type,
  .server-import-form label:nth-of-type(5) {
    grid-column: 1 / -1;
  }

  .list-filters {
    grid-template-columns: 220px 160px 180px 120px 150px 210px 165px 165px auto;
  }

  .filter-actions {
    justify-content: flex-end;
  }

  .form-actions {
    justify-content: flex-start;
  }

  .list-view-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .act-card {
    grid-template-columns: 1fr;
  }

  .act-card-status {
    justify-items: start;
  }

  .monitor-grid,
  .batch-grid {
    grid-template-columns: 1fr;
  }
}


/* SQL file registry */
.file-registry-filters {
  grid-template-columns: minmax(180px, 220px) minmax(190px, 240px) minmax(240px, 1fr) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(21, 31, 45, 0.04);
  overflow-x: auto;
}

.file-registry-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.file-registry-filters label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.file-registry-layout,
.document-files-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.document-files-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-raised);
}

.compact-editor-head {
  margin-bottom: 0;
}

.compact-editor-head h3 {
  margin: 0;
  font-size: 15px;
}

.document-files-table-shell,
.file-registry-table {
  min-width: 0;
}

.file-registry-table th:first-child,
.file-registry-table td:first-child,
.document-files-table th:first-child,
.document-files-table td:first-child {
  min-width: 260px;
}

.file-registry-table td,
.document-files-table td {
  vertical-align: middle;
}

.file-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.file-status-linked {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.file-status-unassigned {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.file-status-missing {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.file-status-ignored {
  color: var(--muted);
  background: var(--surface-muted);
}

.file-row-unassigned td:first-child {
  border-left: 4px solid var(--warn);
}

.file-row-missing td:first-child {
  border-left: 4px solid var(--danger);
}

.hash-inline {
  display: inline-block;
  max-width: 120px;
  color: #304050;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.compact-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

@media (max-width: 980px) {
  .file-registry-filters {
    grid-template-columns: minmax(180px, 220px) minmax(190px, 240px) minmax(240px, 1fr) auto;
  }
}


/* User administration */
.user-admin-layout {
  display: grid;
  gap: 14px;
}

.user-form {
  display: grid;
  gap: 12px;
}

.user-create-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  align-items: end;
}

.user-update-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  align-items: end;
}

.user-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.user-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.user-form input,
.user-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
}

.user-active-line {
  align-self: center;
}

.user-card-list {
  display: grid;
  gap: 12px;
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.user-card-disabled {
  background: var(--surface-muted);
}

.user-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.user-card-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
}

.user-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .user-create-form,
  .user-update-form {
    grid-template-columns: 1fr;
  }
}
