:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #61716b;
  --paper: #f5f2e8;
  --panel: #fffdf7;
  --line: #d9d1c1;
  --green: #1f6b5d;
  --green-dark: #164a41;
  --rust: #a24f35;
  --yellow: #e6ba50;
  --blue: #4c6e96;
  --shadow: 0 18px 48px rgba(24, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(31, 107, 93, 0.08) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(180deg, rgba(76, 110, 150, 0.07) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--paper);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.research-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.admin-rail {
  position: sticky;
  top: 22px;
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 2px solid var(--ink);
  background: rgba(255, 253, 247, 0.95);
  box-shadow: var(--shadow);
}

.rail-brand {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rust);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
}

h3 {
  font-size: 1.25rem;
}

.rail-nav,
.rail-links,
.check-list,
.model-list {
  display: grid;
  gap: 10px;
}

.rail-item,
.rail-links a {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.78);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  text-decoration: none;
}

.rail-item.is-active {
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
}

.admin-main {
  min-width: 0;
}

.research-panel {
  display: none;
  padding: 22px;
  border: 2px solid var(--ink);
  background: rgba(255, 253, 247, 0.95);
  box-shadow: var(--shadow);
}

.research-panel.is-active {
  display: block;
}

.panel-heading,
.card-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.card-header {
  margin-bottom: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--ink);
  background: #f7ecc8;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.metric-grid,
.dashboard-grid,
.settings-grid,
.evaluation-grid,
.run-grid,
.library-grid,
.export-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.dashboard-grid,
.evaluation-grid,
.run-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.library-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.export-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.panel-card,
.screenshot-tile {
  border: 1px solid var(--ink);
  background: #fffaf0;
}

.metric-card,
.panel-card {
  padding: 16px;
}

.metric-card span,
.screenshot-tile span,
.score-band span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.8rem;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

dt,
label {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

dd {
  margin: 0;
  color: var(--green);
  font-weight: 900;
  text-align: right;
}

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

input,
select {
  width: 100%;
  margin-top: 7px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.panel-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  font-weight: 900;
}

.primary-button {
  background: var(--green);
  color: #fffdf7;
  box-shadow: 4px 4px 0 var(--ink);
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  background: var(--panel);
  color: var(--ink);
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.data-table {
  display: grid;
  margin-top: 16px;
  border: 1px solid var(--ink);
}

.table-row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 0.7fr 1fr;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-head {
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
}

.screenshot-tile {
  overflow: hidden;
}

.screenshot-tile.is-selected {
  box-shadow: 6px 6px 0 var(--ink);
}

.screenshot-tile img {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  object-fit: cover;
}

.screenshot-tile div {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.model-list span {
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 850;
}

.progress-shell {
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--panel);
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
}

.score-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.export-card {
  margin-top: 14px;
}

pre {
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  background: #18231f;
  color: #fffdf7;
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .research-shell,
  .metric-grid,
  .dashboard-grid,
  .settings-grid,
  .evaluation-grid,
  .run-grid,
  .library-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .admin-rail {
    position: static;
  }

  .rail-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .research-shell {
    padding: 14px;
  }

  .panel-heading,
  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rail-nav,
  .provider-grid,
  .table-row {
    grid-template-columns: 1fr;
  }
}
