:root {
  --bg: #eef4f7;
  --panel: #ffffff;
  --ink: #10222b;
  --muted: #4b6471;
  --accent: #0d9488;
  --accent-2: #0f766e;
  --line: #d5e2e8;
  --warn: #b45309;
  --ok: #15803d;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(1100px 450px at 100% -10%, #c8f3ef 0%, rgba(200, 243, 239, 0) 60%),
    linear-gradient(180deg, #f3f8fb, #eaf1f5);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: min(92vw, 440px);
  background: #0b2530;
  color: #d9f9f5;
  border: 1px solid #1f3e4a;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 20px 36px rgba(17, 46, 57, 0.12);
}

.auth-card h1 {
  margin: 0;
}

.auth-card p {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 10px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-2);
}

button.ghost {
  background: #e3eef2;
  color: #17313d;
}

button.ghost:hover {
  background: #d6e7ed;
}

.error {
  color: var(--bad);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.topbar h2 {
  margin: 0;
}

.topbar small {
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-shell {
  max-width: 1300px;
  margin: 0 auto;
  padding: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

.tabs button {
  background: #e8f0f3;
  color: #14323d;
  white-space: nowrap;
}

.tabs button.active {
  background: var(--accent);
  color: #fff;
}

main {
  margin-top: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(17, 46, 57, 0.06);
}

.panel h3 {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 12px;
  background: #e5f5f2;
  color: #155e59;
  cursor: help;
}

.muted-box ol {
  margin: 8px 0 0;
  color: var(--muted);
}

.progress {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

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

.guide-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fbfeff;
}

.guide-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.guide-top b {
  font-size: 15px;
}

.guide-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}

.guide-status.done {
  background: var(--ok);
}

.guide-status.todo {
  background: var(--warn);
}

.guide-hint {
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.inline-form input,
.inline-form select {
  width: min(320px, 100%);
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfeff;
  padding: 10px;
}

.stat .k {
  color: var(--muted);
  font-size: 13px;
}

.stat .v {
  font-weight: 700;
  margin-top: 4px;
  font-size: 22px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

select[multiple] {
  min-height: 180px;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f4f9fb;
  color: #163744;
  position: sticky;
  top: 0;
  z-index: 1;
}

td code {
  font-size: 12px;
  background: #edf4f7;
  border: 1px solid #dce8ee;
  padding: 1px 5px;
  border-radius: 6px;
}

.empty {
  padding: 14px;
  color: var(--muted);
}

pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b1823;
  color: #d8f9f2;
  border-radius: 10px;
  padding: 10px;
  overflow: auto;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
}

.pill.ELIGIBLE {
  background: var(--ok);
}

.pill.REVIEW {
  background: var(--warn);
}

.pill.INELIGIBLE {
  background: var(--bad);
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pager button {
  padding: 6px 10px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
