:root {
  --paper: #090c0f;
  --linen: #f6efe5;
  --panel: rgba(18, 23, 27, 0.9);
  --panel-soft: rgba(24, 31, 36, 0.76);
  --ink: #f7f0e7;
  --ink-soft: rgba(247, 240, 231, 0.74);
  --muted: rgba(247, 240, 231, 0.56);
  --line: rgba(247, 240, 231, 0.12);
  --line-strong: rgba(247, 240, 231, 0.22);
  --ember: #f0783d;
  --ember-deep: #ffb28c;
  --pine: #61a991;
  --green: #53d28f;
  --green-soft: rgba(83, 210, 143, 0.12);
  --blue: #88b8ff;
  --gold: #f2ca70;
  --danger: #ff8c7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --display: "Fraunces", Georgia, serif;
  --body: "Manrope", system-ui, sans-serif;
  --accent: "Syne", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(240, 120, 61, 0.18), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(83, 210, 143, 0.12), transparent 26%),
    linear-gradient(180deg, #080b0e 0%, var(--paper) 48%, #101418 100%);
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.admin-shell {
  width: min(1480px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-hero,
.auth-panel,
.event-rail,
.workspace,
.action-panel,
.metric,
.match-card,
.evidence-panel,
.reflection-card {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 8px;
}

.eyebrow {
  font-family: var(--accent);
  color: var(--ember-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.7rem, 6vw, 5.8rem);
}

h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
}

h3 {
  font-size: 1rem;
}

.hero-copy,
.panel-header p,
.auth-panel p,
.action-panel p {
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 48rem;
}

.session-panel {
  min-width: 240px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--ink-soft);
}

.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #a3988d;
}

.status-dot.live {
  background: var(--green);
}

.auth-panel {
  margin-top: 1rem;
  padding: 1.4rem;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1fr);
  gap: 1.4rem;
  align-items: end;
}

.auth-form,
.event-form,
.lab-controls {
  display: grid;
  gap: 0.85rem;
}

.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.inline-form.narrow {
  max-width: 320px;
}

label,
.lab-controls label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 0.86rem 0.9rem;
}

input::placeholder,
textarea::placeholder {
  color: rgba(247, 240, 231, 0.36);
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(201, 94, 36, 0.2);
  border-color: rgba(240, 120, 61, 0.62);
}

.button-primary,
.button-secondary,
.button-danger,
.icon-button,
.tab-button,
.text-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  padding: 0.75rem 1rem;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.button-primary {
  background: var(--ember);
  color: #160b06;
}

.button-secondary {
  background: rgba(97, 169, 145, 0.12);
  color: #bce9d8;
  border-color: rgba(97, 169, 145, 0.28);
}

.button-danger {
  background: rgba(255, 140, 122, 0.12);
  color: var(--danger);
  border-color: rgba(255, 140, 122, 0.22);
}

.text-button {
  background: transparent;
  color: var(--ember-deep);
  padding: 0.35rem 0;
  min-height: 0;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.3rem;
  color: var(--linen);
  background: var(--ember);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.message {
  margin-top: 1rem;
  border: 1px solid rgba(47, 106, 78, 0.18);
  background: rgba(47, 106, 78, 0.1);
  color: #bce9d8;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  line-height: 1.5;
}

.message.error {
  color: var(--danger);
  border-color: rgba(151, 55, 42, 0.2);
  background: rgba(151, 55, 42, 0.1);
}

.admin-app {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.event-rail,
.workspace {
  border-radius: 8px;
}

.event-rail {
  position: sticky;
  top: 1rem;
  padding: 1rem;
}

.rail-header,
.panel-header,
.action-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.event-list,
.stack-list,
.match-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.event-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.9rem;
}

.event-button.active {
  border-color: rgba(240, 120, 61, 0.54);
  background: rgba(240, 120, 61, 0.12);
}

.event-button strong,
.event-button span {
  display: block;
}

.event-button strong {
  font-size: 0.98rem;
}

.event-button span,
.meta,
.pill,
.evidence-panel p,
.reflection-card p,
.empty {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.workspace {
  padding: 1rem;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.tab-button {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.tab-button.active {
  background: rgba(97, 169, 145, 0.2);
  color: #d8fff0;
  border-color: rgba(97, 169, 145, 0.4);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.summary-grid.tight {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.metric {
  border-radius: 8px;
  padding: 1rem;
  box-shadow: none;
}

.metric strong {
  display: block;
  font-size: 1.45rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
}

.event-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.action-panel {
  margin-top: 1rem;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: none;
}

.action-panel.compact {
  align-items: center;
}

.lab-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}

.match-card {
  border-radius: 8px;
  padding: 1rem;
  box-shadow: none;
}

.match-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.score-badge {
  min-width: 94px;
  text-align: center;
  border-radius: 8px;
  color: #08100c;
  background: var(--green);
  padding: 0.75rem;
}

.score-badge strong,
.score-badge span {
  display: block;
}

.score-badge strong {
  font-size: 1.35rem;
}

.score-badge span {
  font-size: 0.72rem;
  color: rgba(8, 16, 12, 0.68);
}

.chip-row,
.score-grid,
.evidence-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.pill,
.score-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.38rem 0.62rem;
  gap: 0.35rem;
}

.score-chip strong {
  color: var(--gold);
}

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

.evidence-panel {
  border-radius: 8px;
  box-shadow: none;
  padding: 0.85rem;
}

.evidence-panel.wide {
  grid-column: 1 / -1;
}

.match-card-clean {
  display: grid;
  gap: 0.95rem;
}

.clean-evidence-grid {
  gap: 0.75rem;
}

.reason-row .pill {
  color: #d8fff0;
  border-color: rgba(83, 210, 143, 0.22);
}

.value-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.value-column {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.value-column h4,
.reflection-source-set h4 {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value-token {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.58rem 0.65rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.04);
}

.value-token.shared {
  color: #dfffea;
  border-color: rgba(83, 210, 143, 0.55);
  background: var(--green-soft);
}

.value-token em,
.level-pill em,
.evidence-item span,
.congruence-score span,
.evidence-meta {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.value-overlap-summary {
  margin-top: 0.75rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.level-pill {
  display: grid;
  gap: 0.18rem;
  border: 1px solid rgba(136, 184, 255, 0.34);
  border-radius: 8px;
  padding: 0.68rem;
  background: rgba(136, 184, 255, 0.08);
}

.evidence-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.evidence-item,
.source-answer {
  display: grid;
  gap: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.035);
}

.congruence-score {
  display: inline-grid;
  gap: 0.1rem;
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid rgba(83, 210, 143, 0.32);
  border-radius: 8px;
  background: var(--green-soft);
}

.congruence-score strong {
  font-size: 1.35rem;
  color: var(--green);
}

.reflection-source-set {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.fact-strip {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(242, 202, 112, 0.24);
  border-radius: 8px;
  background: rgba(242, 202, 112, 0.08);
}

.review-box {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.review-actions .active {
  background: var(--ember);
  color: var(--linen);
}

.reflection-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  margin-top: 1rem;
}

.reflection-card {
  border-radius: 8px;
  padding: 1rem;
  box-shadow: none;
}

.reflection-card blockquote {
  margin: 0.75rem 0 0;
  padding-left: 0.85rem;
  border-left: 3px solid var(--ember);
  color: var(--ink-soft);
  line-height: 1.6;
}

.note-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.note-form .inline-form {
  align-items: stretch;
}

@media (max-width: 1060px) {
  .admin-app,
  .auth-panel,
  .reflection-grid {
    grid-template-columns: 1fr;
  }

  .event-rail {
    position: static;
  }

  .event-form,
  .lab-controls,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .value-matrix,
  .level-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-shell {
    width: min(100% - 1rem, 1480px);
    padding-top: 0.5rem;
  }

  .admin-hero,
  .rail-header,
  .panel-header,
  .action-panel,
  .match-card-header,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .event-form,
  .lab-controls,
  .summary-grid,
  .summary-grid.tight,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .session-panel {
    min-width: 0;
    justify-content: flex-start;
  }
}
