:root {
  --ink: #111827;
  --muted: #5f6877;
  --paper: #f7f8f3;
  --surface: rgba(255, 255, 250, 0.9);
  --surface-strong: rgba(255, 255, 250, 0.98);
  --line: rgba(17, 24, 39, 0.14);
  --line-strong: rgba(17, 24, 39, 0.24);
  --green: #2d6a4f;
  --blue: #294c7a;
  --amber: #9a5b13;
  --red: #9b3434;
  --slate: #334155;
  --shadow: 0 24px 70px rgba(17, 24, 39, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(41, 76, 122, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(45, 106, 79, 0.08), transparent 42%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.ear-shell {
  display: grid;
  gap: 22px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 52px);
}

.page-header,
.paper-panel,
.source-health-panel,
.workflow-panel,
.queue-panel,
.experiment-panel,
.cadence-panel,
.contract-panel,
.notes-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 250, 0.95), rgba(255, 255, 250, 0.77)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.page-header,
.workflow-panel,
.source-health-panel,
.queue-panel,
.experiment-panel,
.cadence-panel,
.contract-panel,
.notes-panel {
  display: grid;
  gap: 20px;
  padding: clamp(18px, 3vw, 30px);
}

.top-nav,
.tab-row,
.note-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.top-nav a,
.paper-source a,
.tab-row button,
.note-form button,
.secondary-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: rgba(255, 255, 250, 0.72);
  font-size: 0.84rem;
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
}

.top-nav a,
.paper-source a,
.tab-row button,
.secondary-button {
  padding: 0 12px;
}

.top-nav a:hover,
.paper-source a:hover,
.tab-row button:hover,
.note-form button:hover,
.secondary-button:hover,
.tab-row button.active {
  border-color: rgba(41, 76, 122, 0.34);
  background: var(--surface-strong);
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: clamp(18px, 4vw, 42px);
  align-items: end;
}

.title-row > * {
  min-width: 0;
}

.kicker,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 1050px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 5rem);
  line-height: 0.98;
  word-break: break-word;
}

h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  line-height: 1.12;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.statement {
  max-width: 980px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  font-weight: 650;
  line-height: 1.72;
}

.runtime-panel {
  display: grid;
  gap: 8px;
  min-height: 124px;
  align-content: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.78);
}

.runtime-panel span,
.runtime-panel small,
.metric-grid span,
.paper-source span,
.decision-strip span,
.workflow-item > span,
.workflow-title-row small,
.queue-card span,
.queue-card small,
.experiment-detail span,
.experiment-detail strong,
.cadence-grid span,
.notes-list span,
.iteration-log span,
.iteration-log small,
.muted-pill {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.runtime-panel strong {
  font-size: 1.35rem;
  line-height: 1.14;
}

.metric-grid,
.decision-strip,
.queue-grid,
.cadence-grid,
.source-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-grid article,
.decision-strip article,
.source-health-grid article,
.queue-card,
.cadence-grid article,
.notes-list article,
.iteration-log article,
.experiment-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.68);
}

.metric-grid article,
.decision-strip article,
.source-health-grid article {
  display: grid;
  gap: 8px;
  min-height: 142px;
  align-content: start;
  padding: 14px;
}

.metric-grid strong,
.decision-strip strong,
.source-health-grid strong {
  font-size: 1.08rem;
}

.metric-grid p,
.decision-strip p,
.source-health-grid p,
.paper-panel p,
.workflow-item p,
.workflow-item dd,
.queue-card p,
.queue-card li,
.experiment-detail p,
.cadence-grid li,
.notes-list p,
.iteration-log p,
.disclaimer {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.source-health-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.source-health-grid article {
  min-height: 150px;
}

.source-health-grid small {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 760;
}

.source-health-grid .source-live,
.source-health-grid .source-llm {
  border-color: rgba(45, 106, 79, 0.28);
}

.source-health-grid .source-proxy,
.source-health-grid .source-partial {
  border-color: rgba(154, 91, 19, 0.28);
}

.source-health-grid .source-blocked {
  border-color: rgba(155, 52, 52, 0.24);
}

.tone-good {
  border-color: rgba(45, 106, 79, 0.24) !important;
}

.tone-warn {
  border-color: rgba(154, 91, 19, 0.28) !important;
}

.tone-watch {
  border-color: rgba(41, 76, 122, 0.24) !important;
}

.paper-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: clamp(18px, 4vw, 42px);
  padding: clamp(18px, 3vw, 30px);
  align-items: start;
}

.paper-panel > div {
  display: grid;
  gap: 12px;
}

.paper-source {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.66);
}

.paper-source strong {
  line-height: 1.25;
}

.decision-strip {
  padding: 0;
}

.section-head,
.workflow-title-row,
.queue-head,
.confidence-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.muted-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 250, 0.7);
}

.workflow-list {
  display: grid;
  gap: 12px;
}

.workflow-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.66);
}

.workflow-item > span {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(41, 76, 122, 0.22);
  border-radius: 8px;
  color: var(--blue);
  background: rgba(41, 76, 122, 0.08);
}

.workflow-item > div,
.queue-card,
.cadence-grid article,
.notes-list article,
.iteration-log article {
  display: grid;
  gap: 10px;
}

.workflow-item dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.workflow-item dt {
  color: var(--slate);
  font-size: 0.74rem;
  font-weight: 820;
  text-transform: uppercase;
}

.workflow-item dd {
  margin: 4px 0 0;
}

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

.queue-card {
  min-height: 260px;
  padding: 15px;
}

.queue-card.score-high {
  border-color: rgba(45, 106, 79, 0.28);
}

.queue-card.score-mid {
  border-color: rgba(41, 76, 122, 0.22);
}

.queue-card.score-low {
  border-color: rgba(154, 91, 19, 0.28);
}

.queue-head strong {
  display: inline-flex;
  min-width: 54px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 1.25rem;
}

.score-high .queue-head strong {
  background: var(--green);
}

.score-low .queue-head strong {
  background: var(--amber);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.queue-card ul,
.cadence-grid ul,
.evidence-list {
  display: grid;
  gap: 6px;
}

.queue-card ul,
.cadence-grid ul {
  margin: 0;
  padding-left: 18px;
}

.evidence-list {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(41, 76, 122, 0.045);
}

.evidence-list span {
  color: var(--slate);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.48;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.experiment-detail,
.cadence-grid article,
.notes-list article,
.iteration-log article {
  padding: 15px;
}

.experiment-detail strong {
  color: var(--green);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.66);
}

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

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

th {
  color: var(--slate);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

td {
  color: var(--muted);
  line-height: 1.55;
}

td code {
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  font-weight: 760;
}

.note-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto;
  align-items: end;
}

.note-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.note-form span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.note-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.84);
}

.note-form button {
  padding: 0 14px;
}

.secondary-button {
  color: var(--slate);
}

.notes-list,
.iteration-log {
  display: grid;
  gap: 10px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.disclaimer {
  padding: 8px 2px 22px;
  font-size: 0.86rem;
  text-align: center;
}

@media (max-width: 1080px) {
  .metric-grid,
  .decision-strip,
  .queue-grid,
  .cadence-grid,
  .source-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-grid,
  .paper-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .ear-shell {
    padding: 16px;
  }

  .title-row,
  .note-form {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .decision-strip,
  .queue-grid,
  .cadence-grid,
  .source-health-grid,
  .workflow-item dl {
    grid-template-columns: 1fr;
  }

  .section-head,
  .workflow-title-row,
  .queue-head,
  .confidence-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-item {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(1.8rem, 8.4vw, 2.35rem);
    line-height: 1.04;
  }
}

@media (max-width: 560px) {
  .top-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-nav a {
    min-width: 0;
    padding: 0 8px;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
  }

  .top-nav a:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
