:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #24746b;
  --accent-strong: #155b55;
  --amber: #b7791f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.userbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
}

.userbar .button {
  min-height: 34px;
}

.auth-page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(520px, 100%);
}

.auth-form {
  margin-top: 16px;
}

.workspace {
  display: grid;
  gap: 24px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

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

h2 {
  margin-bottom: 10px;
  font-size: 28px;
}

h3 {
  margin-bottom: 14px;
  font-size: 18px;
}

h4 {
  margin-bottom: 8px;
  font-size: 15px;
}

.actions,
.form-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
}

.button.secondary {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent-strong);
}

.intro {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 24px;
  align-items: stretch;
}

.intro p {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
}

.status-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-panel {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 20px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
}

.status-panel span:last-child {
  color: var(--muted);
}

.warning-panel {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fff8f6;
}

.inline-warning {
  margin-top: 18px;
  border-left: 4px solid var(--amber);
  background: #fffaf0;
  padding: 12px 14px;
}

.inline-warning ul {
  margin-top: 8px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-head p {
  margin-bottom: 0;
}

.layout,
.grid,
.details {
  display: grid;
  gap: 16px;
}

.layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

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

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

.panel {
  padding: 20px;
}

.span-all,
.span-2 {
  grid-column: 1 / -1;
}

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

.task-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.task-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.task-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.task-list a {
  color: var(--accent-strong);
  font-weight: 700;
}

.task-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

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

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

.field span {
  color: var(--ink);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(36, 116, 107, 0.18);
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.form-actions {
  margin-top: 20px;
}

.data-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.data-list.compact {
  grid-template-columns: repeat(4, auto minmax(40px, 1fr));
  margin-top: 18px;
}

.data-list dt {
  color: var(--muted);
  font-weight: 700;
}

.data-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.data-list.meta-list {
  margin-top: 18px;
  grid-template-columns: minmax(110px, 0.18fr) minmax(0, 1fr);
}

.preline {
  white-space: pre-line;
}

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

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.ranked-list {
  padding-left: 0;
  list-style: none;
}

.ranked-list li {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.ranked-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 10px;
}

.chips small {
  color: var(--muted);
}

.parse-result {
  display: grid;
  gap: 18px;
}

.structure-section {
  display: grid;
  gap: 12px;
}

.final-brief {
  border-top: 3px solid var(--accent);
  padding-top: 24px;
}

.text-check-panel textarea {
  min-height: 260px;
}

.brief-section {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.brief-section:first-of-type {
  padding-top: 0;
}

.brief-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.no-text-section {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fffafa;
}

.parse-error {
  border-color: rgba(180, 35, 24, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.badge.good {
  background: #e5f3ed;
  color: #17633c;
}

.badge.warning {
  background: #fff5d8;
  color: #7a5200;
}

.badge.bad {
  background: #fde9e7;
  color: var(--danger);
}

.heading-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li + li {
  margin-top: 8px;
}

li small {
  display: block;
  margin-top: 2px;
}

@media (max-width: 820px) {
  .topbar,
  .intro {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .layout,
  .grid,
  .details,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-list li,
  .data-list,
  .data-list.compact,
  .heading-columns,
  .metrics {
    display: grid;
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
  }
}
