:root {
  --bg: #eef3ef;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --text: #173027;
  --muted: #61736d;
  --line: #d8e3dc;
  --accent: #1f6f54;
  --accent-2: #184f3d;
  --warning: #d39b2e;
  --shadow: 0 10px 28px rgba(27, 52, 45, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.action-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 600;
}

.action-link:hover {
  text-decoration: none;
  background: #edf5f0;
  border-color: #bfd7ca;
}

.topbar {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 6px 0 8px;
  font-size: 30px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 840px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.nav a {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
}

.nav a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.logout-form { margin: 0; }
.nav-logout {
  padding: 8px 12px;
  color: var(--accent-2);
  background: transparent;
  border: 1px solid #b9d7cb;
}

.shell {
  width: min(1400px, calc(100% - 32px));
  margin: 18px auto 40px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-strip div,
.panel,
.flash {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.flash.error {
  color: #7c2525;
  background: #fff0ef;
  border-color: #c44a43;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell { width: min(440px, 100%); }
.login-panel {
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login-panel h1 { margin-bottom: 6px; }
.login-panel > p { color: var(--muted); }

.status-strip div {
  padding: 14px 16px;
}

.status-strip strong {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.status-strip span {
  color: var(--muted);
  font-size: 13px;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-left: 5px solid var(--accent);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

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

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

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

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

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

textarea {
  resize: vertical;
  min-height: 96px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #e8f2ec;
  color: var(--accent-2);
  border: 1px solid #b9d7cb;
}

button:hover {
  filter: brightness(0.97);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.pre-box {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  overflow: auto;
}

.work-status {
  position: sticky;
  top: 104px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  color: #173027;
  background: #fff8e7;
  border: 1px solid #e7c66d;
  border-radius: 6px;
}

.work-status span:not(.spinner) { display: block; color: var(--muted); font-size: 13px; }

.spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 3px solid #e7c66d;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.workflow-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 10px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.step:last-child { border-right: 0; }
.step span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: #3b6680;
  border-radius: 50%;
  font-weight: 700;
}
.step.active span { background: var(--accent); }
.step small { color: var(--muted); }

.primary-panel { border-top: 4px solid var(--accent); }
.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.panel h2 { margin-top: 0; }
.count-badge,
.status,
.score {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7f5;
  font-size: 12px;
  font-weight: 700;
}
.status.ready, .status.promoted, .score.high { color: #155e46; background: #e8f5ef; border-color: #a8d7c4; }
.status.review, .score.medium { color: #76540d; background: #fff6dc; border-color: #e7c66d; }
.status.rejected, .score.low { color: #8c2e2e; background: #fff0ef; border-color: #e7b2ad; }
.status.duplicate { color: #375f78; background: #edf5fa; border-color: #b6cfde; }

.seed-list {
  margin: 0;
  padding: 0;
  border: 0;
}
.seed-list legend { margin-bottom: 8px; font-weight: 700; }
.seed-management { display: grid; gap: 8px; }
.seed-management > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.seed-management span, .seed-management small { display: block; }
.seed-management small { color: var(--muted); }
.seed-management form { margin: 0; }
.check-row {
  grid-template-columns: 20px 1fr;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.check-row input { width: 16px; margin-top: 3px; }
.check-row small { display: block; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 200px auto;
  gap: 10px;
  margin: 14px 0;
}
.compact-filter { grid-template-columns: minmax(240px, 520px) auto; justify-content: start; }
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}
.pagination div { display: flex; gap: 8px; }
.pagination a {
  display: inline-block;
  padding: 7px 10px;
  color: var(--accent-2);
  background: #e8f2ec;
  border: 1px solid #b9d7cb;
  border-radius: 6px;
  font-weight: 700;
}
.table-wrap { overflow-x: auto; }
.row-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.row-actions form { margin: 0; }
.row-actions button { padding: 7px 9px; font-size: 13px; }
button.danger { color: #8c2e2e; background: #fff0ef; border: 1px solid #e7b2ad; }
.icon-link { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; }
.empty-state { padding: 22px; color: var(--muted); background: #f8faf8; border: 1px dashed #bfcfc6; border-radius: 6px; }
.button-link { display: inline-block; padding: 10px 14px; color: #fff; background: var(--accent); border-radius: 6px; font-weight: 700; }
.button-link:hover { text-decoration: none; }
.text-link { display: inline-block; margin-top: 12px; font-weight: 600; }
.status-summary { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: auto;
  }
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
  }
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workflow-band { grid-template-columns: 1fr; }
  .step { border-right: 0; border-bottom: 1px solid var(--line); }
  .step:last-child { border-bottom: 0; }
  .form-grid-4, .filter-bar { grid-template-columns: 1fr; }
}
