:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #607087;
  --line: #dce3eb;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --navy: #10233f;
  --blue: #1f64d4;
  --blue-dark: #164da4;
  --green: #13835b;
  --green-soft: #eaf7f1;
  --amber: #9a6410;
  --amber-soft: #fff6df;
  --red: #b42333;
  --red-soft: #fff0f1;
  --shadow: 0 16px 42px rgba(20, 33, 52, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-soft);
  color: var(--ink);
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.header-inner, .page-shell, .site-footer {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-size: 0.9rem;
  letter-spacing: 0;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.restricted-label { color: var(--muted); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.page-shell { padding: 52px 0 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 28px; }
.page-heading > div:first-child { max-width: 780px; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; color: var(--navy); font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; color: var(--navy); font-size: 1.45rem; letter-spacing: -0.025em; }
h3 { color: var(--navy); }
.lead { margin-bottom: 0; color: var(--muted); font-size: 1.06rem; max-width: 760px; }

.worker-status {
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.worker-status div { display: grid; gap: 2px; }
.worker-status strong { font-size: 0.88rem; }
.worker-status span:not(.status-dot) { color: var(--muted); font-size: 0.78rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa7b7; }
.worker-status.healthy .status-dot { background: var(--green); }
.worker-status.unhealthy .status-dot { background: var(--red); }

.policy-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}
.policy-strip div { display: grid; gap: 5px; padding: 20px 22px; }
.policy-strip div + div { border-left: 1px solid var(--line); }
.policy-strip strong { color: var(--navy); font-size: 0.88rem; }
.policy-strip span { color: var(--muted); font-size: 0.86rem; }

.worker-evidence-details {
  margin: -10px 0 28px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.worker-evidence-details summary { padding: 13px 16px; color: var(--navy); cursor: pointer; font-size: 0.82rem; font-weight: 750; }
.worker-evidence-list { display: grid; gap: 8px; padding: 0 16px 16px; }
.worker-row { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); font-size: 0.76rem; }
.worker-row > div:not(.capability-list) { display: grid; gap: 3px; }
.worker-row code { overflow-wrap: anywhere; }
.capability-list { color: var(--muted); }

.filters-panel, .records-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.filters-panel { padding: 24px; margin-bottom: 28px; }
.records-section { padding: 24px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-title-row .eyebrow { margin-bottom: 4px; }
.result-meta { margin: 0; color: var(--muted); font-size: 0.86rem; }

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr 1fr 1fr auto;
  align-items: end;
  gap: 14px;
}
label { display: grid; gap: 7px; color: #324158; font-size: 0.78rem; font-weight: 750; }
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(31, 100, 212, 0.2); outline-offset: 1px; border-color: var(--blue); }

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 15px;
  font-weight: 750;
}
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: #cbd5e1; background: white; color: var(--navy); }
.button.secondary:hover { background: #f0f4f8; }
.button.small { min-height: 36px; padding: 7px 12px; font-size: 0.84rem; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.summary-card { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.summary-card strong { display: block; color: var(--navy); font-size: 1.55rem; line-height: 1; margin-bottom: 7px; }
.summary-card span { color: var(--muted); font-size: 0.78rem; }

.records-list { display: grid; gap: 12px; }
.record { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.record[open] { border-color: #b9c7d8; }
.record-summary { list-style: none; display: grid; grid-template-columns: minmax(170px, 0.8fr) minmax(280px, 1.4fr) 1fr 1fr auto; gap: 18px; align-items: center; padding: 18px; cursor: pointer; }
.record-summary::-webkit-details-marker { display: none; }
.record-summary:hover { background: #fafbfd; }
.summary-item { min-width: 0; }
.summary-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.7rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.summary-value { display: block; overflow: hidden; color: var(--ink); font-size: 0.87rem; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.record-chevron { color: var(--muted); font-size: 1.2rem; transition: transform 0.15s ease; }
.record[open] .record-chevron { transform: rotate(90deg); }

.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: 0.72rem; font-weight: 800; text-transform: capitalize; }
.badge.complete, .badge.converted, .badge.destroyed { background: var(--green-soft); color: var(--green); }
.badge.failed, .badge.quarantined, .badge.deletion_overdue, .badge.conversion_overdue { background: var(--red-soft); color: var(--red); }
.badge.pending, .badge.running, .badge.deletion_in_progress, .badge.conversion_in_progress { background: var(--amber-soft); color: var(--amber); }

.record-details { border-top: 1px solid var(--line); background: #fbfcfe; padding: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-field { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.detail-field span { display: block; color: var(--muted); font-size: 0.7rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-field code, .detail-field strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 0.78rem; }
.steps-title { margin: 0 0 10px; font-size: 0.95rem; }
.steps-table-wrap { overflow-x: auto; }
.steps-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.steps-table th { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.05em; text-align: left; text-transform: uppercase; }
.steps-table th, .steps-table td { padding: 10px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.steps-table code { overflow-wrap: anywhere; }
.evidence-toggle { border: 0; background: none; color: var(--blue); padding: 0; font-weight: 750; }
.evidence-box { margin: 8px 0 0; max-width: 620px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #101827; color: #dce7f7; padding: 12px; white-space: pre-wrap; word-break: break-word; font: 0.72rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.integrity { font-weight: 750; color: var(--green); }
.integrity.missing { color: var(--amber); }
.integrity + code { display: block; margin-top: 5px; max-width: 180px; color: var(--muted); font-size: 0.66rem; overflow-wrap: anywhere; }

.alert, .empty-state { padding: 20px; border-radius: 9px; text-align: center; }
.alert.error { margin-bottom: 18px; background: var(--red-soft); color: var(--red); }
.empty-state { border: 1px dashed #cbd5e1; background: var(--surface-soft); }
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.load-more-row { display: flex; justify-content: center; padding-top: 20px; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 36px; color: var(--muted); font-size: 0.78rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 36px 20px; background: #edf1f6; }
.login-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1.15fr 0.85fr; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 24px 70px rgba(20, 33, 52, 0.14); }
.login-context { padding: 56px; background: var(--navy); color: white; }
.login-context .brand { margin-bottom: 72px; color: white; }
.login-context .brand-mark { background: white; color: var(--navy); }
.login-context .eyebrow { color: #8eb9ff; }
.login-context h1 { color: white; font-size: clamp(2.4rem, 5vw, 4.5rem); }
.login-context .lead { color: #c9d5e6; }
.security-note { margin-top: 48px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,0.18); }
.security-note p { margin: 7px 0 0; color: #aebed3; font-size: 0.87rem; }
.login-card { align-self: center; padding: 50px 46px; }
.login-card h2 { margin-bottom: 8px; font-size: 1.8rem; }
.login-card > p { color: var(--muted); }
.login-card form { display: grid; gap: 14px; margin-top: 26px; }
.login-card .button { margin-top: 6px; }
.form-error { margin: 0; color: var(--red); font-size: 0.82rem; }
.fine-print { margin: 20px 0 0; color: var(--muted); font-size: 0.75rem; }

@media (max-width: 1000px) {
  .filters-grid { grid-template-columns: repeat(3, 1fr); }
  .record-summary { grid-template-columns: 1fr 1.4fr 1fr auto; }
  .record-summary .completed-column { display: none; }
  .detail-grid, .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .header-inner, .page-shell, .site-footer { width: min(100% - 24px, 1220px); }
  .page-shell { padding-top: 32px; }
  .page-heading { display: grid; align-items: start; }
  .worker-status { width: 100%; }
  .policy-strip { grid-template-columns: 1fr; }
  .policy-strip div + div { border-left: 0; border-top: 1px solid var(--line); }
  .filters-grid { grid-template-columns: 1fr; }
  .record-summary { grid-template-columns: 1fr auto; }
  .record-summary .summary-item:not(:first-child) { display: none; }
  .detail-grid, .summary-grid { grid-template-columns: 1fr; }
  .worker-row { grid-template-columns: 1fr; }
  .site-footer { display: grid; }
  .login-shell { grid-template-columns: 1fr; }
  .login-context { padding: 36px 30px; }
  .login-context .brand { margin-bottom: 44px; }
  .login-card { padding: 36px 30px; }
}
