:root {
  color-scheme: light;
  --ink: #17201d;
  --ink-soft: #52605a;
  --paper: #faf8f2;
  --surface: #ffffff;
  --surface-soft: #f3f1ea;
  --line: #dfddd4;
  --line-strong: #c7c3b8;
  --green: #185c47;
  --green-soft: #dff1e8;
  --amber: #9a5f0f;
  --amber-soft: #fff0ca;
  --red: #9d3434;
  --red-soft: #f9e1df;
  --blue: #345b8e;
  --blue-soft: #e8eef8;
  --highlight: #ffe997;
  --shadow: 0 18px 60px rgba(30, 38, 34, 0.09);
  --sans: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 0%, rgba(230, 185, 93, 0.12), transparent 27rem),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(52, 91, 142, 0.3);
  outline-offset: 2px;
}

a {
  color: var(--green);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(199, 195, 184, 0.8);
  background: rgba(250, 248, 242, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: white;
  background: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-copy span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reviewer-button,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

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

.reviewer-button,
.ghost-button,
.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.reviewer-button {
  max-width: 190px;
  padding: 8px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.danger-button {
  padding: 9px 17px;
  color: white;
  background: var(--ink);
}

.danger-button {
  background: var(--red);
}

.secondary-button,
.ghost-button {
  padding: 8px 15px;
}

.ghost-button {
  border-color: transparent;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
}

.shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 56px 0 88px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 360px);
  gap: 40px;
  align-items: end;
  padding: clamp(30px, 5vw, 60px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.dashboard-hero h1,
.article-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.dashboard-hero h1 {
  max-width: 720px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
}

.hero-copy {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
}

.progress-card {
  padding: 24px;
  border-radius: 22px;
  background: var(--surface-soft);
}

.progress-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 500;
}

.progress-card p {
  margin: 3px 0 18px;
  color: var(--ink-soft);
  font-size: 14px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dedbd2;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 300ms ease;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 12px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

.legend-dot.approved { background: var(--green); }
.legend-dot.changes { background: var(--red); }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 54px 0 20px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
}

.section-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.article-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.article-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 38px rgba(30, 38, 34, 0.08);
}

.card-meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.category-pill,
.status-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.category-pill,
.count-pill {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.status-pill.pending { color: var(--ink-soft); background: var(--surface-soft); }
.status-pill.approved { color: var(--green); background: var(--green-soft); }
.status-pill.changes_requested { color: var(--red); background: var(--red-soft); }

.article-card h3 {
  margin: 22px 0 12px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.article-card > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.card-comments {
  color: var(--ink-soft);
  font-size: 12px;
}

.card-arrow {
  font-size: 20px;
}

.article-shell {
  width: min(1320px, calc(100% - 36px));
  margin: 0 auto;
  padding: 38px 0 100px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 780px) 340px;
  gap: clamp(38px, 6vw, 76px);
  justify-content: center;
  align-items: start;
}

.article-hero {
  padding: 34px 0 40px;
  border-bottom: 1px solid var(--line);
}

.article-hero h1 {
  max-width: 760px;
  margin-top: 18px;
  font-size: clamp(46px, 6vw, 72px);
  line-height: 0.98;
}

.standfirst {
  max-width: 690px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.4;
}

.selection-tip {
  display: flex;
  gap: 12px;
  margin: 28px 0 10px;
  padding: 14px 16px;
  border: 1px solid #eadcae;
  border-radius: 14px;
  color: #6d551b;
  background: #fff8df;
  font-size: 13px;
  line-height: 1.45;
}

.selection-tip strong {
  white-space: nowrap;
}

.article-body {
  padding: 34px 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.72;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body table,
.article-body blockquote {
  margin: 0 0 1.25em;
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: 90px;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: -0.025em;
}

.article-body h2 {
  margin: 2.15em 0 0.7em;
  font-size: 31px;
  line-height: 1.18;
}

.article-body h3 {
  margin: 1.8em 0 0.55em;
  font-size: 23px;
  line-height: 1.25;
}

.article-body li {
  margin: 0.35em 0;
  padding-left: 0.25em;
}

.article-body strong {
  font-weight: 600;
}

.article-body a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-body blockquote {
  padding: 2px 0 2px 22px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-soft);
}

.article-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

.article-body th,
.article-body td {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--surface-soft);
}

::highlight(review-comments) {
  color: inherit;
  background: var(--highlight);
  text-decoration: underline;
  text-decoration-color: #bc8c19;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.review-rail {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 114px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.rail-card {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.rail-card-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.rail-card-header h2,
.rail-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.rail-card-header p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
}

.decision-panel {
  padding: 16px 18px 18px;
}

.decision-state {
  margin-bottom: 13px;
  padding: 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.45;
}

.decision-state.approved { color: var(--green); background: var(--green-soft); }
.decision-state.changes_requested { color: var(--red); background: var(--red-soft); }

.decision-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.decision-actions button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.approve-action { color: var(--green); background: var(--green-soft); }
.changes-action { color: var(--red); background: var(--red-soft); }

.clear-decision {
  width: 100%;
  margin-top: 9px;
  padding: 7px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.comment-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.comment-filter {
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.comment-filter.active {
  color: white;
  border-color: var(--ink);
  background: var(--ink);
}

.thread-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.empty-state {
  padding: 30px 18px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.thread {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.thread:hover,
.thread.active {
  border-color: #d1b350;
  box-shadow: 0 5px 18px rgba(38, 39, 26, 0.07);
}

.thread.resolved {
  opacity: 0.67;
}

.thread-quote {
  display: -webkit-box;
  margin: 0 0 11px;
  overflow: hidden;
  color: #6d551b;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.thread-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11px;
}

.thread-meta strong {
  font-size: 12px;
}

.thread-meta time {
  color: var(--ink-soft);
}

.thread-body {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.reply-list {
  display: grid;
  gap: 9px;
  margin: 12px 0 0 11px;
  padding-left: 11px;
  border-left: 2px solid var(--line);
}

.reply .thread-body {
  color: var(--ink-soft);
  font-size: 12px;
}

.thread-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.thread-actions button {
  padding: 5px 0;
  border: 0;
  color: var(--green);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.general-comment {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
}

.selection-action {
  position: fixed;
  z-index: 80;
  transform: translate(-50%, -110%);
}

.selection-action button {
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 26px rgba(23, 32, 29, 0.25);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 29, 0.38);
  backdrop-filter: blur(5px);
}

.modal {
  width: min(520px, 100%);
  max-height: min(740px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 24px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(18, 25, 22, 0.26);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
}

.modal-header p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.quoted-selection {
  max-height: 130px;
  margin: 0 0 18px;
  overflow-y: auto;
  padding: 13px 15px;
  border-left: 3px solid #d7ad35;
  color: #6d551b;
  background: #fff8df;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: white;
}

.field input {
  min-height: 44px;
  padding: 9px 12px;
}

.field textarea {
  min-height: 120px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.45;
}

.field-hint {
  color: var(--ink-soft);
  font-size: 11px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 150;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: min(390px, calc(100vw - 40px));
  padding: 11px 15px;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  box-shadow: 0 10px 34px rgba(23, 32, 29, 0.2);
  font-size: 12px;
}

.toast.error {
  background: var(--red);
}

.loading-shell,
.error-shell {
  display: grid;
  min-height: calc(100vh - 66px);
  place-items: center;
  padding: 40px;
  color: var(--ink-soft);
  text-align: center;
}

.mobile-review-button {
  display: none;
}

.mobile-review-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(23, 32, 29, 0.4);
  backdrop-filter: blur(4px);
}

.mobile-review-sheet {
  width: min(560px, 100%);
  max-height: min(82vh, 760px);
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 70px rgba(18, 25, 22, 0.2);
}

.mobile-review-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mobile-review-sheet-header strong,
.mobile-review-sheet-header span {
  display: block;
}

.mobile-review-sheet-header strong {
  font-size: 15px;
}

.mobile-review-sheet-header span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.mobile-review-sheet-body {
  max-height: calc(min(82vh, 760px) - 71px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
}

@media (max-width: 980px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .progress-card {
    max-width: 430px;
  }

  .article-layout {
    grid-template-columns: minmax(0, 780px);
  }

  .review-rail {
    position: static;
    max-height: none;
  }

  .mobile-review-button {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 70;
    display: block;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    color: white;
    background: var(--ink);
    box-shadow: 0 10px 32px rgba(23, 32, 29, 0.24);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 58px;
    padding: 9px 14px;
  }

  .brand-copy span {
    display: none;
  }

  .reviewer-button {
    max-width: 130px;
    min-height: 34px;
    padding: 6px 11px;
    font-size: 12px;
  }

  .shell,
  .article-shell {
    width: min(100% - 24px, 1180px);
  }

  .shell {
    padding-top: 24px;
  }

  .dashboard-hero {
    gap: 28px;
    padding: 28px 22px;
    border-radius: 22px;
  }

  .dashboard-hero h1 {
    font-size: 44px;
  }

  .hero-copy {
    font-size: 15px;
  }

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

  .article-card {
    min-height: 220px;
    padding: 22px;
  }

  .article-hero h1 {
    font-size: 44px;
  }

  .standfirst {
    font-size: 21px;
  }

  .article-body {
    font-size: 18px;
  }

  .selection-tip {
    display: block;
  }

  .selection-tip strong {
    display: block;
    margin-bottom: 4px;
  }

  .modal {
    padding: 20px;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
