:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --panel: #1c1d20;
  --panel-2: #202227;
  --panel-3: #26282e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f4f6;
  --muted: #a1a1aa;
  --accent: #11c5b2;
  --success-bg: rgba(17, 197, 178, 0.12);
  --partial-bg: rgba(245, 158, 11, 0.12);
  --error-bg: rgba(244, 63, 94, 0.12);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(17, 197, 178, 0.08), transparent 18%),
    radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.06), transparent 22%),
    var(--bg);
}

body.login-locked {
  overflow: hidden;
}

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

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.shell--locked {
  display: none;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top center, rgba(17, 197, 178, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.08), transparent 26%),
    rgba(10, 10, 11, 0.98);
}

.login-gate--hidden {
  display: none;
}

.login-gate__panel {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(35, 36, 40, 0.98), rgba(20, 21, 24, 0.98));
  box-shadow: var(--shadow);
}

.login-gate__kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-gate__panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
}

.login-gate__copy {
  margin: 10px 0 22px;
  color: var(--muted);
}

.login-gate__form {
  display: grid;
  gap: 12px;
}

.login-gate__error {
  min-height: 20px;
  margin: 2px 0 0;
  color: #fb7185;
  font-size: 0.9rem;
}

.sidebar {
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  background: rgba(12, 12, 13, 0.96);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f4f4f5;
  color: #111827;
  font-weight: 800;
}

.brand-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-heading {
  margin: 0 6px;
  color: #71717a;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-link {
  display: flex;
  width: 100%;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #d4d4d8;
  text-align: left;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.workspace {
  padding: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-card,
.status-panel,
.filter-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(35, 36, 40, 0.96), rgba(25, 26, 29, 0.96));
  box-shadow: var(--shadow);
}

.hero-card,
.status-panel,
.filter-card {
  padding: 18px;
  margin-bottom: 14px;
}

.table-card {
  padding: 14px 14px 10px;
}

.hero-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -50px -70px auto;
  width: 240px;
  height: 240px;
  background:
    radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.95), transparent 36%),
    radial-gradient(circle at 70% 35%, rgba(251, 146, 60, 0.72), transparent 30%),
    radial-gradient(circle at 50% 70%, rgba(236, 72, 153, 0.5), transparent 28%);
  filter: blur(10px);
  opacity: 0.78;
  pointer-events: none;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-stat {
  min-width: 220px;
  margin-left: auto;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(15, 15, 16, 0.42);
  backdrop-filter: blur(6px);
}

.hero-stat-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.hero-actions--panelled {
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  min-width: min(100%, 760px);
}

.action-panel,
.selection-panel {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(15, 15, 16, 0.42);
  backdrop-filter: blur(6px);
}

.action-panel {
  flex: 0 1 auto;
}

.selection-panel {
  flex: 1 1 220px;
  min-width: 220px;
}

.action-panel__label,
.selection-panel__label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-panel__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.selection-panel__value {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.hero-stat-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stat-value {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1;
  font-weight: 800;
}

.hero-card.compact::after {
  opacity: 0.32;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card h2,
.section-head h3 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.05;
}

.hero-copy {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: #128277;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.action-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 16px;
  background: rgba(17, 197, 178, 0.14);
  color: #d7fffa;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.action-button:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: not-allowed;
}

.action-button--add {
  min-width: 78px;
}

.action-button--secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.hero-action-copy {
  margin: 0;
  width: 100%;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.inline-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-input--compact {
  gap: 10px;
  white-space: nowrap;
}

.inline-input--compact span {
  font-size: 0.88rem;
  font-weight: 600;
}

.inline-input input {
  width: 78px;
  padding: 8px 10px;
}

.inline-input--compact input[type="checkbox"] {
  width: auto;
  margin: 0;
}

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

.inline-actions--stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.match-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
  margin-top: 8px;
}

.match-editor__input,
.match-editor__select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 9px 10px;
}

.match-editor__select option {
  color: #111827;
  background: #f8fafc;
}

.human-validated-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.human-validated-badge--on {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
  color: #dbeafe;
}

.human-validated-badge--off {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.status-copy {
  margin: 0 0 18px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-grid .metric-card {
  min-height: 78px;
}

.metric-card {
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel-2);
}

.metric-card--complete {
  background: linear-gradient(180deg, rgba(17, 197, 178, 0.12), rgba(17, 197, 178, 0.05));
}

.metric-card--partial {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.13), rgba(245, 158, 11, 0.04));
}

.metric-card--error {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.14), rgba(244, 63, 94, 0.05));
}

.metric-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-value {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  font-weight: 700;
}

.small-metric {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

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

.filter-field {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #e4e4e7;
  font-weight: 600;
}

select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-3);
  color: var(--text);
}

input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-3);
  color: var(--text);
}

input::placeholder {
  color: var(--muted);
}

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

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

.table-more-actions {
  display: flex;
  justify-content: center;
  padding: 12px 8px 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: #a1a1aa;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: #f4f4f5;
  line-height: 1.3;
}

.table-link {
  color: #7dd3fc;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.thumb-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.thumb-preview {
  display: block;
  width: 104px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  object-fit: cover;
}

.inline-details {
  min-width: 220px;
}

.inline-details summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #7dd3fc;
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.inline-details summary::after {
  content: "▾";
  color: var(--muted);
  text-decoration: none;
}

.inline-details[open] summary::after {
  content: "▴";
}

.checkpoint-details {
  display: block;
}

.checkpoint-details__table {
  margin-top: 8px;
  min-width: 520px;
}

.checkpoint-details__table table {
  width: 100%;
  border-collapse: collapse;
}

.checkpoint-details__table th,
.checkpoint-details__table td {
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.inline-list {
  margin: 10px 0 0;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
  color: var(--muted);
}

.inline-list li {
  margin-bottom: 4px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-pill--complete {
  background: var(--success-bg);
  color: #6ee7d8;
}

.status-pill--partial {
  background: var(--partial-bg);
  color: #fbbf24;
}

.status-pill--error {
  background: var(--error-bg);
  color: #fb7185;
}

.table-subtle {
  color: var(--muted);
  font-size: 0.84rem;
  word-break: break-all;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 860px) {
  .workspace {
    padding: 16px;
  }

  .hero-card,
  .status-panel,
  .filter-card,
  .table-card {
    border-radius: 18px;
  }

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

  .hero-actions--panelled {
    min-width: 0;
  }

  .action-panel__row {
    flex-wrap: wrap;
  }

  .metric-grid,
  .compact-grid,
  .filters,
  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}
