:root {
  --ink: #12233D;
  --ink-soft: #4C5C72;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --line: #D8DEE4;
  --accent: #2FA6A2;
  --accent-ink: #0F1B2D;
  --status-active: #2E8B57;
  --status-terminated: #C4453B;
  --status-pending: #C98A2C;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.shell {
  display: grid;
  grid-template-columns: 216px 1fr;
  height: 100vh;
}

.sidenav {
  background: var(--accent-ink);
  color: #DCE6EE;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 20px;
}

.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--accent);
  display: inline-block;
  border-radius: 2px;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.nav-item {
  text-align: left;
  background: none;
  border: none;
  color: #AEBBC9;
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 9px 10px;
  border-radius: 3px;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav-item.is-active {
  background: rgba(47, 166, 162, 0.16);
  color: #fff;
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.content {
  padding: 32px 40px 64px;
  max-width: 1200px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view { display: none; }
.view.is-active { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.view-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.view-header p {
  margin: 0 0 24px;
  color: var(--ink-soft);
  max-width: 60ch;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.stat-cell {
  background: var(--surface);
  padding: 18px 20px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.stat-label {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-top: 2px;
}

.upload-panel { margin-bottom: 24px; }

.dropzone {
  border: 1px dashed var(--line);
  background: var(--surface);
  padding: 28px;
  text-align: center;
  border-radius: 4px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: #EAF6F5;
}

.dropzone-label {
  margin: 0 0 12px;
  color: var(--ink-soft);
}

.file-input { font-family: var(--sans); font-size: 13px; }

.upload-result {
  margin-top: 14px;
  text-align: left;
  font-size: 13px;
}

.upload-result .ok { color: var(--status-active); }
.upload-result .warn { color: var(--status-pending); }
.upload-result .err { color: var(--status-terminated); }

.upload-result pre {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  max-height: 160px;
  overflow: auto;
  text-align: left;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.table-toolbar input, .table-toolbar select,
.extract-form select, .extract-form button {
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
}

.member-search { flex: 1; }

.extract-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.extract-form button {
  background: var(--accent-ink);
  color: #fff;
  border-color: var(--accent-ink);
  cursor: pointer;
}

.extract-form button:hover { background: #1a3050; }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: auto;
  background: var(--surface);
  flex: 1;
  min-height: 0;
}

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

thead th {
  text-align: left;
  padding: 9px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #EEF1F3;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12.5px;
}

tbody tr:hover { background: #F7FBFB; cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
}

.badge-active { background: #E4F3EB; color: var(--status-active); }
.badge-terminated { background: #FBEAE8; color: var(--status-terminated); }
.badge-pending, .badge-audit { background: #FBF1DF; color: var(--status-pending); }
.badge-completed { background: #E4F3EB; color: var(--status-active); }
.badge-failed { background: #FBEAE8; color: var(--status-terminated); }
.badge-processing, .badge-completed_with_errors { background: #FBF1DF; color: var(--status-pending); }
.badge-critical, .badge-open, .badge-rejected { background: #FBEAE8; color: var(--status-terminated); }
.badge-warning, .badge-queued_for_resubmission, .badge-partial { background: #FBF1DF; color: var(--status-pending); }
.badge-info, .badge-accepted { background: #E7EEF6; color: #2C5C8F; }
.badge-resolved, .badge-resubmitted { background: #E4F3EB; color: var(--status-active); }
.badge-ignored { background: #ECEEF1; color: var(--ink-soft); }

.mini-btn {
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 7px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.mini-btn:hover { background: var(--bg); }

.cell-wrap { white-space: normal; }

.ack-block {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11.5px;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}


.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.overlay.is-open { display: flex; }

.overlay-panel {
  background: var(--surface);
  width: min(600px, 90vw);
  max-height: 80vh;
  overflow: auto;
  border-radius: 6px;
  padding: 24px;
  position: relative;
}

.overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  font-size: 13px;
  margin: 16px 0 20px;
}

.detail-grid dt { color: var(--ink-soft); }
.detail-grid dd { margin: 0; font-family: var(--mono); }

.detail-section-title {
  font-size: 13px;
  font-weight: 650;
  margin: 20px 0 8px;
  color: var(--ink);
}

@media (max-width: 720px) {
  .shell { display: flex; flex-direction: column; }
  .sidenav { flex-direction: row; overflow-x: auto; padding: 10px; flex: 0 0 auto; }
  .brand { display: none; }
  .content { padding: 20px; flex: 1; min-height: 0; }
}
