:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --muted: #6c757d;
  --primary: #0d6efd;
  --primary-h: #0b5ed7;
  --danger: #dc3545;

  --red-bg: #f8d7da;
  --red-text: #842029;
  --green-bg: #d1e7dd;
  --green-text: #0f5132;
  --blue-bg: #cfe2ff;
  --blue-text: #084298;
  --yellow-bg: #fff3cd;
  --yellow-text: #664d03;
  --gray-bg: #e2e3e5;
  --gray-text: #41464b;
  --purple-bg: #e0cffc;
  --purple-text: #432874;

  --mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  --sans:
    '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', sans-serif;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.15);
  --header-h: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #1a1a2e;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.header-title {
  font-size: 16px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-line {
  font-size: 12px;
  opacity: 0.75;
}
.status-line.err {
  color: #f8a5a5;
  opacity: 1;
}

.filters-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 190;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px 12px;
}

.focus-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 2px solid #f1b0b7;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff4f5, #fffdf6);
  box-shadow: var(--shadow);
}

.focus-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.focus-banner-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-text);
}

.focus-banner-text {
  max-width: 760px;
  line-height: 1.45;
}

.focus-banner-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.default-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.default-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.default-chip-alert {
  border-color: #f1b0b7;
  background: #ffe3e6;
  color: var(--red-text);
}

.default-chip-bot {
  border-color: #9ec5fe;
  background: #e7f1ff;
  color: var(--blue-text);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-form-sm {
  padding: 10px 0 4px;
}

.filter-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-input,
.filter-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--sans);
  background: var(--bg);
  min-width: 130px;
}
.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.btn {
  height: 30px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-h);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg);
}
.btn-inv {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.btn-inv:hover {
  background: rgba(255, 255, 255, 0.2);
}
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
}
.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
}
.btn-next {
  display: block;
  margin: 16px auto;
}

.main {
  padding: 16px 24px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #f1f3f5;
  text-align: left;
  padding: 8px 12px;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: #f8f9fa;
}
.data-table tr.row-failed td {
  background: #fff5f5;
}
.data-table tr.row-failed:hover td {
  background: #ffe9eb;
}
.data-table tr.row-renovate td:first-child,
.data-table tr.row-renovate td:nth-child(2) {
  border-left: 3px solid #9ec5fe;
}
.data-table tr.row-eligible td {
  box-shadow: inset 0 0 0 9999px rgba(25, 135, 84, 0.03);
}

.td-time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.td-project {
  max-width: 180px;
  word-break: break-all;
}
.td-num {
  text-align: center;
}
.td-center {
  text-align: center;
}
.td-actions {
  white-space: nowrap;
}
.td-actions > * {
  margin-right: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-red {
  background: var(--red-bg);
  color: var(--red-text);
}
.badge-green {
  background: var(--green-bg);
  color: var(--green-text);
}
.badge-blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}
.badge-yellow {
  background: var(--yellow-bg);
  color: var(--yellow-text);
}
.badge-gray {
  background: var(--gray-bg);
  color: var(--gray-text);
}
.badge-purple {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.code-tag {
  display: inline-block;
  padding: 1px 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}
.code-tag.action {
  background: var(--yellow-bg);
  border-color: #ffc107;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.state-box {
  padding: 48px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}
.state-box.err {
  color: var(--danger);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}
.drawer-overlay.hidden {
  display: none;
}

.drawer {
  width: min(680px, 92vw);
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-title {
  font-size: 15px;
  font-weight: 600;
}

.drawer-filters {
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}

.job-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.remediation-card {
  border-color: #b6d4fe;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0 8px;
}

.job-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 14px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
}
.job-name {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 13px;
}

.job-card-body {
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
}
.detail-key {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 64px;
}

.trace-block {
  margin-top: 6px;
  border-left: 3px solid var(--border);
  padding-left: 10px;
}
.trace-block pre {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 110px;
  overflow-y: auto;
}

@media (max-width: 960px) {
  .focus-banner {
    flex-direction: column;
  }

  .filters-bar,
  .main,
  .header {
    padding-left: 16px;
    padding-right: 16px;
  }
}
