:root {
  --bg: #090d14;
  --surface: #101722;
  --border: #263244;
  --text-1: #f4f7fb;
  --text-2: #a9b6c8;
  --accent: #38bdf8;
  --success: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 34rem),
    var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-header,
.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(38, 50, 68, 0.72);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 17px;
}

.eyebrow,
.stat-label,
.subtle,
.muted,
.form-note {
  color: var(--text-2);
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.num,
time,
td:nth-child(4),
.stat-card strong {
  font-variant-numeric: tabular-nums;
}

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

.date-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  background: rgba(16, 23, 34, 0.72);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card,
.stat-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16, 23, 34, 0.9);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.stat-card {
  padding: 16px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.stat-card.success strong {
  color: var(--success);
}

.stat-card.warn strong {
  color: var(--warn);
}

.stat-card.danger strong {
  color: var(--danger);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  padding: 16px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 16px;
  align-items: end;
}

label,
.file-input {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #0b111b;
  color: var(--text-1);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.check-field {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
}

.check-field.compact {
  align-self: end;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0b111b;
  color: var(--text-1);
  font-size: 0.92em;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #02131d;
}

.btn-secondary {
  border-color: var(--border);
  background: #172131;
  color: var(--text-1);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn[disabled] {
  cursor: progress;
  opacity: 0.72;
  transform: none;
}

.btn.is-loading::after {
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  content: "";
  animation: spin 700ms linear infinite;
}

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

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

th {
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td > .subtle,
td:nth-child(4) span {
  display: block;
  margin-top: 4px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 132px 88px 88px 64px;
  gap: 8px;
  align-items: end;
}

.edit-grid input {
  min-height: 34px;
  padding: 6px 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.pill.expired {
  background: rgba(251, 113, 133, 0.16);
  color: #fecdd3;
}

.pill.needs_chase {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

.pill.compliant {
  background: rgba(52, 211, 153, 0.16);
  color: #bbf7d0;
}

.issues,
.preview {
  display: block;
  max-width: 320px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 13px;
}

.preview:not(:empty) {
  padding: 8px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
}

.upload-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  color: var(--text-2);
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-1);
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.history-item p {
  color: var(--text-2);
}

@media (max-width: 960px) {
  .stats-grid,
  .work-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .app-header,
  .history-item {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .stats-grid,
  .work-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
