:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #f9faf6;
  --ink: #1f2723;
  --muted: #657069;
  --line: #d9ded6;
  --green: #2f7d59;
  --blue: #3a6f92;
  --amber: #a8751d;
  --red: #a14a3a;
  --violet: #6b5b95;
  --shadow: 0 18px 40px rgba(31, 39, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(58, 111, 146, 0.08), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.actions,
.card-actions,
.section-head,
.score-head,
.score-labels,
.signal-top {
  display: flex;
  align-items: center;
}

.actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.small-button,
.primary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
}

.icon-button {
  width: 48px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

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

.metric-strip article,
.panel,
.input-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.metric-strip article {
  min-height: 92px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-strip span,
label,
.meta,
.tag-row,
.fact,
.judgement,
.result-count {
  color: var(--muted);
}

.metric-strip strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.input-panel,
.panel {
  padding: 18px;
}

.input-panel {
  position: sticky;
  top: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  line-height: 1.3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 10px 11px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58, 111, 146, 0.14);
}

.field-grid,
.toolbar,
.insight-grid {
  display: grid;
  gap: 12px;
}

.field-grid {
  grid-template-columns: 1fr 1fr;
}

.score-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.score-head,
.score-labels {
  justify-content: space-between;
}

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

.score-head strong {
  min-width: 34px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e7efe9;
  color: var(--green);
}

input[type="range"] {
  padding: 0;
  margin: 14px 0 8px;
  accent-color: var(--green);
}

.score-labels {
  color: var(--muted);
  font-size: 12px;
}

.board {
  display: grid;
  gap: 16px;
}

.toolbar {
  grid-template-columns: minmax(240px, 1.2fr) repeat(3, minmax(130px, 0.45fr));
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.insight-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
}

.bar-list {
  display: grid;
  gap: 11px;
}

.bar-item {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ec;
}

.bar-fill {
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--blue);
}

.brief {
  display: grid;
  gap: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.brief strong {
  color: var(--ink);
}

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

.signal-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.signal-card.verified {
  border-left-color: var(--green);
}

.signal-card.developing {
  border-left-color: var(--blue);
}

.signal-card.noise {
  border-left-color: var(--red);
}

.signal-top {
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.strength {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7efe9;
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}

.meta {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  font-size: 12px;
}

.tag-row span,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 4px 8px;
}

.fact,
.judgement {
  margin-top: 12px;
  line-height: 1.55;
}

.judgement {
  color: var(--ink);
}

.card-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  padding: 24px;
}

@media (max-width: 980px) {
  .workspace,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }

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

  .search-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 16px;
  }

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

  .actions {
    justify-content: flex-start;
  }

  .metric-strip,
  .toolbar,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .bar-item {
    grid-template-columns: 78px minmax(0, 1fr) 28px;
  }
}
