:root {
  --bg: #f4efe7;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffdf9;
  --line: #d8c8b7;
  --line-strong: #a98f78;
  --text: #2c261f;
  --muted: #6d6254;
  --accent: #99582a;
  --accent-soft: #f1dfcc;
  --accent-strong: #6f3e1a;
  --success: #356859;
  --warning: #a96700;
  --danger: #8a3030;
  --shadow: 0 18px 40px rgba(82, 55, 24, 0.08);
  --radius: 20px;
  --mono: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  --sans: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(223, 193, 160, 0.4), transparent 28%),
    linear-gradient(135deg, #f7f1e7 0%, #f0e5d6 42%, #efe7dd 100%);
}

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

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid rgba(169, 143, 120, 0.35);
  background: rgba(253, 249, 242, 0.78);
  backdrop-filter: blur(18px);
  min-height: 100vh;
  overflow: hidden;
}

.brand,
.toolbar,
.hero-card,
.reader-panel,
.review-panel,
.assignment-card {
  border: 1px solid rgba(169, 143, 120, 0.3);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand,
.toolbar,
.hero-card,
.reader-panel,
.review-panel {
  padding: 22px;
}

.brand {
  padding: 24px 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
}

.brand h1,
.hero-card h2,
h3 {
  margin: 0;
}

.brand h1 {
  font-size: 28px;
  line-height: 1.1;
}

.brand-copy,
.muted,
.hero-meta {
  margin: 10px 0 0;
  color: var(--muted);
}

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

.toolbar-grid,
.toolbar-actions,
.assignment-actions,
.detail-layout,
.section-title-row,
.experiment-item-top,
.experiment-item-meta,
.assignment-strip,
.hero-card {
  display: flex;
  align-items: center;
}

.toolbar-grid,
.assignment-actions {
  gap: 10px;
}

.toolbar-grid > .field {
  flex: 1;
}

.toolbar-actions {
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.ghost-button {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 12px 14px;
  background: linear-gradient(135deg, #9e5f2e 0%, #7f451a 100%);
  color: #fffaf5;
  box-shadow: 0 12px 24px rgba(127, 69, 26, 0.18);
}

.secondary-button,
.ghost-button {
  padding: 11px 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ghost-button.active-filter {
  background: linear-gradient(135deg, rgba(153, 88, 42, 0.18), rgba(153, 88, 42, 0.1));
  box-shadow: inset 0 0 0 1px rgba(153, 88, 42, 0.35);
}

.list-header,
.section-title-row {
  justify-content: space-between;
}

.list-header {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.experiment-list {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding-right: 2px;
  min-height: 0;
  flex: 1;
  max-height: calc(100vh - 430px);
}

.experiment-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.95);
  color: inherit;
  text-align: left;
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(80, 57, 28, 0.06);
}

.experiment-item:hover,
.experiment-item.active {
  border-color: rgba(153, 88, 42, 0.55);
  background: #fffdf9;
}

.exp-id {
  font-size: 15px;
}

.exp-description {
  margin: 10px 0;
  line-height: 1.45;
}

.experiment-item-meta {
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.decision-badge,
.assignment-badge,
.ownership-badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #ece4db;
  color: var(--muted);
}

.assignment-strip {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.assignee-name {
  color: var(--muted);
}

.decision-approved,
.assignment-done {
  background: rgba(53, 104, 89, 0.15);
  color: var(--success);
}

.decision-needs_revision,
.assignment-assigned {
  background: rgba(169, 103, 0, 0.15);
  color: var(--warning);
}

.decision-rejected {
  background: rgba(138, 48, 48, 0.14);
  color: var(--danger);
}

.assignment-in_review {
  background: rgba(111, 62, 26, 0.16);
  color: var(--accent-strong);
}

.content {
  padding: 24px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.hero-card {
  justify-content: space-between;
  gap: 16px;
}

.hero-card h2 {
  font-size: 32px;
  line-height: 1.1;
}

.detail-layout {
  align-items: stretch;
  gap: 22px;
  min-width: 0;
}

.reader-panel {
  flex: 1.5;
  min-width: 0;
  display: grid;
  gap: 16px;
}

.review-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  align-self: flex-start;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.assignment-card {
  padding: 18px;
}

.assignment-form {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.assignment-note-field {
  grid-column: 1 / -1;
}

.assignment-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.file-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-tab {
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.84);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
}

.file-tab.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.markdown-view {
  min-height: 60vh;
  max-height: calc(100vh - 330px);
  border-radius: 18px;
  border: 1px solid rgba(169, 143, 120, 0.25);
  background: rgba(255, 255, 255, 0.6);
  padding: 24px;
  overflow: auto;
  line-height: 1.65;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.markdown-view h1,
.markdown-view h2,
.markdown-view h3,
.markdown-view h4 {
  margin-top: 1.6em;
  margin-bottom: 0.55em;
  line-height: 1.25;
}

.markdown-view h1:first-child,
.markdown-view h2:first-child,
.markdown-view h3:first-child {
  margin-top: 0;
}

.markdown-view pre,
.markdown-view code {
  font-family: var(--mono);
}

.markdown-view pre {
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: #2d241d;
  color: #f8efe4;
}

.markdown-view p code,
.markdown-view li code,
.history-card code {
  padding: 0 4px;
  border-radius: 6px;
  background: #ece4db;
}

.markdown-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.markdown-view th,
.markdown-view td {
  border: 1px solid rgba(169, 143, 120, 0.4);
  padding: 10px 12px;
  vertical-align: top;
}

.markdown-view blockquote {
  margin: 16px 0;
  padding-left: 16px;
  border-left: 4px solid var(--line-strong);
  color: var(--muted);
}

.review-form,
.score-grid,
.history-list {
  display: grid;
  gap: 14px;
}

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

.history-section {
  border-top: 1px solid rgba(169, 143, 120, 0.32);
  padding-top: 18px;
}

.history-card {
  border-radius: 16px;
  border: 1px solid rgba(169, 143, 120, 0.25);
  background: rgba(255, 251, 245, 0.7);
  padding: 14px;
}

.history-card p {
  margin: 8px 0 0;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.empty-history {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(169, 143, 120, 0.35);
  }

  .experiment-list {
    max-height: 360px;
  }

  .detail-layout {
    flex-direction: column;
  }

  .review-panel {
    width: 100%;
    max-height: none;
  }

  .markdown-view {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-grid,
  .assignment-form,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .hero-card h2 {
    font-size: 24px;
  }

  .assignment-actions {
    justify-content: stretch;
  }
}
