/* Mentat page: the look of the Copperpod platform (cream page, white cards, dark-brown buttons). */
:root {
  --bg: #fdf8f3;
  --card: #ffffff;
  --line: #eee6dc;
  --line-strong: #e0d4c6;
  --text: #1f1d1a;
  --muted: #7a726a;
  --brand: #6e4a12;
  --brand-hover: #5a3c0d;
  --brand-soft: #f4ece2;
  --tan: #a38978;
  --ok: #2f7a4b;
  --warn: #9a6a00;
  --bad: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 2px 10px rgba(60, 40, 20, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
.muted { color: var(--muted); }
em { font-style: normal; color: var(--muted); font-weight: 400; }

.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 120px; }
.page-head h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.page-head h1 sup { font-size: 10px; font-weight: 600; margin-left: 1px; }
.page-head .sub { margin: 4px 0 22px; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Start */
.start { display: grid; grid-template-columns: 1fr 300px; gap: 28px; padding: 24px; }
.start-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 600; }
input, textarea, select {
  font: inherit; color: inherit; width: 100%;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fffdfb;
  padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--tan); box-shadow: 0 0 0 3px rgba(163, 137, 120, .18); }
.hint { color: var(--muted); font-size: 12.5px; min-height: 1em; }
.hint.good { color: var(--ok); }
.error { color: var(--bad); margin: 0; }
.fold { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.fold summary { cursor: pointer; font-weight: 600; list-style: none; }
.fold summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--muted); transition: transform .15s; }
.fold[open] summary::before { transform: rotate(90deg); }
.fold textarea { margin-top: 10px; }
.actions { display: flex; justify-content: flex-start; }

.recent { border-left: 1px solid var(--line); padding-left: 24px; min-width: 0; }
.recent h2 { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 2px 0 12px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.recent-list a { display: block; text-decoration: none; color: inherit; padding: 9px 10px; border-radius: 8px; }
.recent-list a:hover { background: var(--brand-soft); }
.recent-list .r-main { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-list .r-sub { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.recent-list .r-sub span { white-space: nowrap; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; border-radius: 999px; padding: 8px 18px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text); transition: background .15s, border-color .15s, opacity .15s;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--brand-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }

/* Pills */
.pill { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill.wait { background: #fff3d6; color: var(--warn); }
.pill.done { background: #e4f3e9; color: var(--ok); }
.pill.bad { background: #fde7e5; color: var(--bad); }

/* Run */
.back { display: inline-block; margin: 0 0 12px; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--brand); }
.run-head { padding: 20px 24px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.run-title h2 { margin: 0; font-size: 18px; }
.run-title p { margin: 2px 0 0; }
.run-actions { display: flex; gap: 6px; align-items: flex-start; }
.steps { grid-column: 1 / -1; list-style: none; margin: 18px 0 6px; padding: 0; display: flex; }
.steps li { flex: 1; position: relative; text-align: center; color: var(--muted); font-size: 12.5px; padding-top: 22px; }
.steps li::before {
  content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--line-strong); z-index: 1;
}
.steps li::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--line-strong); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--brand); border-color: var(--brand); }
.steps li.done::after, .steps li.current::after { background: var(--brand); }
.steps li.current { color: var(--brand); font-weight: 650; }
.steps li.current::before { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(110, 74, 18, .15); }
.steps li.current.waiting::before { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(154, 106, 0, .15); }
.steps li.current.waiting { color: var(--warn); }
.activity { grid-column: 1 / -1; margin: 10px 0 0; color: var(--muted); display: flex; gap: 8px; align-items: center; min-height: 20px; }
.activity .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-in-out infinite; flex: none; }
.activity .when { color: #a59d95; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.banner { margin-top: 14px; padding: 12px 16px; border-radius: 10px; background: var(--brand-soft); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.banner.bad { background: #fde7e5; color: var(--bad); }
.banner.wait { background: #fff3d6; }

/* Review page */
.review { margin-top: 14px; padding: 24px 28px 28px; }
.review > h2 { margin: 0 0 6px; font-size: 18px; }
.prose { overflow-wrap: break-word; }
/* Tables fit the page (1 Dec 2026): every column wraps; long words and links break instead of widening the page.
   Only short first cells (an element id like [1.2]) stay on one line. */
.prose td:first-child { min-width: 3.5em; }
.prose th, .prose td { overflow-wrap: anywhere; word-break: break-word; }
.prose a { overflow-wrap: anywhere; }
.prose h3 { overflow-wrap: anywhere; color: var(--text); }
/* Each element of the results page as its own block. */
.prose h2 + h3, .prose h3 { padding-top: 12px; border-top: 1px solid var(--line); }
.prose h2 { font-size: 16px; margin: 26px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.prose h2:first-child { border-top: 0; padding-top: 0; margin-top: 8px; }
.prose h3 { font-size: 14.5px; margin: 20px 0 8px; }
.prose h4, .prose h5 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); }
.prose p { margin: 8px 0; }
.prose ul, .prose ol { margin: 6px 0 10px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--tan); background: #fcf8f4; border-radius: 0 8px 8px 0; }
.prose blockquote p { margin: 4px 0; }
.prose code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f6f1eb; padding: 1px 5px; border-radius: 4px; }
.prose pre { background: #f6f1eb; padding: 12px; border-radius: 8px; overflow: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; display: block; }
.table-wrap { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; max-width: 100%; font-size: 13px; }
.prose th { text-align: left; background: #faf5ef; font-weight: 650; color: #5b5047; white-space: nowrap; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: #fffcf8; }
.small-prose { font-size: 13.5px; max-height: 38vh; overflow: auto; padding-right: 4px; }
.small-prose h2:first-child { display: none; }

/* Decision bar, pinned at the bottom while a review waits */
.decide { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(60, 40, 20, .06); z-index: 20; }
.decide-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; flex-direction: column; gap: 10px; }
.decide-buttons { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.choice { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.choice select { width: auto; min-width: 260px; max-width: 100%; font-weight: 400; }

/* Finish */
.finish { margin-top: 14px; padding: 26px 28px; }
.finish h2 { margin: 0 0 6px; font-size: 18px; }
.finish .lead { margin: 0 0 18px; }
.finish h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; }
.todo { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.todo li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: grid; grid-template-columns: 74px 1fr; gap: 2px 12px; }
.todo .el { font-weight: 650; grid-row: span 2; }
.todo .what { color: var(--muted); font-size: 13px; }

/* Popups */
.modal { position: fixed; inset: 0; background: rgba(40, 28, 16, .35); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 14px; width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(40, 28, 16, .25); display: flex; flex-direction: column; gap: 14px; }
.modal-card.narrow { width: min(420px, 100%); }
.modal-card h2 { margin: 0; font-size: 18px; }
.modal-card p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.upload { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: #fcf8f4; border-radius: 10px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: #fff; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { display: none; }
.drop.has { color: var(--text); font-weight: 600; }

@media (max-width: 820px) {
  .start { grid-template-columns: 1fr; }
  .recent { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .row { grid-template-columns: 1fr; }
  .steps li { font-size: 0; }
  .steps li.current { font-size: 12px; }
}

/* Feedback on the chart */
.fb { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 4px; }
.fb .hint { margin: 0 0 12px; }
.fb-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.fb-list > li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.fb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-tag { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.fb-tag.usable { background: #e8f3ec; color: var(--ok); }
.fb-tag.small_edits { background: #fbf1dc; color: var(--warn); }
.fb-tag.major_rework { background: #fbe9e7; color: var(--bad); }
.fb-text { margin: 8px 0 0; white-space: pre-wrap; }
.fb-notes { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.fb-notes li { display: grid; grid-template-columns: 74px 1fr; gap: 12px; }
.fb-notes .fb-text, .fb-notes .el { margin: 0; }
.fb-notes .el, .fb-element .el { font-weight: 650; }
.fb-form { display: flex; flex-direction: column; gap: 16px; }
.fb-verdict { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.fb-verdict legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.fb-choice { position: relative; cursor: pointer; }
.fb-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fb-choice span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); }
.fb-choice:hover span { background: var(--brand-soft); }
.fb-choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.fb-choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(163, 137, 120, .35); }
.fb-elements { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.fb-element { display: grid; grid-template-columns: 74px 1fr; gap: 4px 12px; }
.fb-element .el { grid-row: span 2; padding-top: 2px; }
.fb-claim { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-foot { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.fb-name { width: 260px; }
.fb-foot .hint { flex: 1; margin: 0 0 10px; }

/* Sign-in and the signed-in account */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.signin { max-width: 420px; margin: 40px auto; padding: 32px; text-align: center; }
.signin h2 { margin: 0 0 6px; font-size: 18px; }
.signin .btn { margin-top: 14px; }
.account a { font-weight: 600; text-decoration: none; }
.email-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; text-align: left; }
.email-form .btn { margin-top: 0; }

/* Admin dashboard */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.admin-card { padding: 22px 24px; min-width: 0; }
.admin-card.wide { grid-column: 1 / -1; }
.admin-card h2 { margin: 0 0 14px; font-size: 16px; }
.admin-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile-v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-k { font-size: 12px; color: var(--muted); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.admin-table select { width: auto; padding: 4px 8px; }
.role { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.role.owner { background: var(--brand); color: #fff; }
.role.admin { background: #fbf1dc; color: var(--warn); }
.add-person { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.add-person input { flex: 1; min-width: 220px; }
.add-person select { width: auto; }
@media (max-width: 820px) { .admin-grid { grid-template-columns: 1fr; } }
.decide-hint { margin-right: auto; }
