:root {
  --ink: #172126;
  --muted: #64737c;
  --line: #d9e1e4;
  --panel: #ffffff;
  --wash: #f3f6f4;
  --accent: #0f766e;
  --accent-dark: #0a5c56;
  --danger: #b42318;
  --warning: #b85b00;
  --low: #52606a;
  --shadow: 0 18px 45px rgba(23, 33, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 320px),
    var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
}

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

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

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2vw, 2.3rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.live-dot {
  width: 12px;
  height: 12px;
  margin-top: 9px;
  border-radius: 999px;
  background: #20a46b;
  box-shadow: 0 0 0 5px rgba(32, 164, 107, 0.15);
}

.upload-zone {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px dashed #9eb3b1;
  border-radius: 8px;
  background: #f8fbfa;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: #e9f6f3;
}

#fileInput {
  display: none;
}

.upload-zone p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.upload-button,
.primary,
.secondary,
.warning {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.upload-button,
.primary {
  color: #fff;
  background: var(--accent);
}

.upload-button:hover,
.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  color: var(--ink);
  background: #e8eeee;
}

.secondary:hover {
  background: #dce5e5;
}

.warning {
  color: #fff;
  background: var(--warning);
}

.warning:hover {
  background: #984a00;
}

.button-icon {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f1;
}

.filter {
  min-height: 34px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.filter.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 33, 38, 0.08);
}

.queue {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.queue-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
}

.queue-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.queue-title {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.mini-counts {
  display: inline-flex;
  gap: 6px;
}

.mini-counts span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f2;
  text-align: center;
  font-weight: 800;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.empty-state,
.document-panel {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.empty-state {
  display: grid;
  min-height: calc(100vh - 60px);
  place-content: center;
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.empty-state p {
  color: var(--muted);
}

.document-panel {
  display: grid;
  gap: 20px;
}

.hidden {
  display: none !important;
}

.document-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.status-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #dff2ee;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.changes_requested {
  color: #823b00;
  background: #ffe6c7;
}

.status-pill.approved {
  color: #0d5d36;
  background: #dff6e9;
}

.status-pill.uploaded {
  color: #44515a;
  background: #e9eeee;
}

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

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.review-column,
.preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.finding-group {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.finding-group:last-child {
  margin-bottom: 0;
}

.severity-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.severity-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--low);
}

.severity-dot.high {
  background: var(--danger);
}

.severity-dot.medium {
  background: var(--warning);
}

.finding {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--low);
  border-radius: 8px;
  background: #fbfcfc;
}

.finding.high {
  border-left-color: var(--danger);
}

.finding.medium {
  border-left-color: var(--warning);
}

.finding h4 {
  margin: 0;
  font-size: 0.95rem;
}

.finding p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.snippet {
  padding: 8px;
  border-radius: 6px;
  background: #eef3f2;
  color: #344147;
  font-size: 0.82rem;
}

.comment-form {
  display: grid;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfc;
}

textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fbfcfc;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.comments {
  display: grid;
  gap: 10px;
}

.comment {
  padding: 12px;
  border-radius: 8px;
  background: #f3f7f6;
}

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

.comment time {
  color: var(--muted);
  font-size: 0.78rem;
}

.comment p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.preview pre {
  max-height: 480px;
  margin: 0;
  overflow: auto;
  border-radius: 8px;
  padding: 16px;
  background: #162126;
  color: #edf7f4;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #172126;
  box-shadow: var(--shadow);
  font-weight: 700;
}

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

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

.owner-fields,
.compact-form,
.assignment-form,
.reviewer-action-form {
  display: grid;
  gap: 10px;
}

.owner-fields {
  grid-template-columns: 1fr 1fr;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f1;
}

.side-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.side-tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 33, 38, 0.08);
}

.badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 0.72rem;
  font-weight: 900;
}

.side-view {
  display: grid;
  gap: 14px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-row > * {
  flex: 1 1 150px;
}

.people-list,
.notification-list,
.assignment-list,
.timeline {
  display: grid;
  gap: 10px;
}

.person-card,
.notification-card,
.assignment-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.notification-card.unread {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11);
}

.person-card small,
.notification-card small,
.assignment-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.notification-card p {
  margin-bottom: 0;
  color: #344147;
  font-size: 0.88rem;
}

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

.tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.tiny-label {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
}

.owner-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.assignment-panel {
  box-shadow: none;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.check-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.check-card input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  padding: 0;
}

.check-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.assignment-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.assignment-card > small {
  grid-column: 1 / -1;
}

.status-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #44515a;
  background: #e9eeee;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-chip.commented,
.status-chip.pending {
  color: var(--accent-dark);
  background: #dff2ee;
}

.status-chip.changes_requested {
  color: #823b00;
  background: #ffe6c7;
}

.status-chip.approved {
  color: #0d5d36;
  background: #dff6e9;
}

.muted-panel {
  opacity: 0.62;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
}

.timeline-item > span {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.timeline-item div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.timeline-item p {
  margin: 4px 0;
  color: #344147;
  font-size: 0.88rem;
}

.timeline-item time {
  color: var(--muted);
  font-size: 0.78rem;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .queue {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: 340px;
  }

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

@media (max-width: 640px) {
  .sidebar,
  .workspace {
    padding: 18px;
  }

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

  .owner-fields {
    grid-template-columns: 1fr;
  }

  .document-header {
    display: grid;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
