:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202b;
  --muted: #657184;
  --line: #dde3ea;
  --brand: #1b6a6f;
  --brand-dark: #124a4e;
  --danger: #b42318;
  --success: #147a45;
  --warning: #b45309;
  --warning-bg: #fff7ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.tier {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--brand-dark);
  background: #eef8f7;
}

main {
  min-height: calc(100vh - 64px);
}

.login-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel,
.review-panel,
.done-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(28, 40, 55, 0.08);
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  display: grid;
  gap: 18px;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

.ghost,
.ghost-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  padding: 9px 14px;
}

.ghost:hover {
  background: #f3f5f7;
}

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

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading p {
  color: var(--muted);
  margin-bottom: 0;
}

.upload {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.plan,
.document-row,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.plan {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.plan span,
.document-row small {
  color: var(--muted);
}

.plan.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.document-list {
  display: grid;
  gap: 10px;
}

.document-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
}

.review-panel {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.document-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(28, 40, 55, 0.08);
  display: grid;
  gap: 0;
  padding: 28px;
}

.manuscript-paragraph {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 22px 0;
}

.manuscript-paragraph:first-child {
  padding-top: 0;
}

.manuscript-paragraph:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.manuscript-paragraph p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.75;
  margin-bottom: 0;
  white-space: pre-wrap;
}

.active-paragraph {
  margin: 8px -14px;
  padding: 20px 14px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  border-color: var(--brand);
  background: #f8ffff;
  box-shadow: 0 14px 34px rgba(27, 106, 111, 0.12);
}

.done-paragraph {
  background: linear-gradient(90deg, rgba(237, 253, 244, 0.75), rgba(255, 255, 255, 0));
}

.skipped-paragraph {
  background: linear-gradient(90deg, rgba(255, 247, 237, 0.95), rgba(255, 255, 255, 0));
}

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

.paragraph-toolbar,
.paragraph-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  width: max-content;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef8f7;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 750;
}

.status-pill.done {
  background: #edfdf4;
  color: var(--success);
}

.status-pill.pending {
  background: #f1f4f8;
  color: var(--muted);
}

.status-pill.skipped {
  background: var(--warning-bg);
  color: var(--warning);
}

.paragraph-box {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  line-height: 1.7;
}

.original-text {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.original-text strong {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

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

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

.suggestions {
  display: grid;
  gap: 12px;
}

.suggestion {
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.change {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text);
}

del {
  color: var(--danger);
  background: #fff0ed;
  text-decoration-thickness: 2px;
}

ins {
  color: var(--success);
  background: #edfdf4;
  text-decoration: none;
}

.inline-review-text {
  white-space: pre-wrap;
}

.inline-suggestion {
  align-items: baseline;
  display: inline-flex;
  gap: 4px;
  margin: 0 3px;
  vertical-align: baseline;
}

.inline-suggestion input {
  inline-size: 15px;
  block-size: 15px;
  margin: 0 2px 0 0;
  transform: translateY(2px);
}

.inline-suggestion del,
.inline-suggestion ins {
  border-radius: 4px;
  padding: 1px 4px;
}

.inline-suggestion.readonly del {
  background: #fee2e2;
}

.inline-suggestion.readonly ins {
  background: #dcfce7;
}

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

.accepted-changes span,
.accepted-changes small {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  background: #f3f5f7;
}

.skip-button {
  border: 1px solid #fed7aa;
  background: var(--warning-bg);
  color: var(--warning);
}

.skip-button:hover {
  background: #ffedd5;
}

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

.skipped-issues span,
.skipped-issues small {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.skipped-issues mark {
  border-radius: 4px;
  padding: 2px 4px;
  background: #fee2e2;
  color: var(--danger);
}

.skipped-issues span small {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--warning);
}

.done-panel {
  padding: 28px;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

.error {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff0ed;
  color: var(--danger);
  border: 1px solid #ffd4cc;
}

@media (max-width: 780px) {
  .topbar,
  .page-heading,
  .document-row,
  .upload {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    height: auto;
    gap: 12px;
    padding: 16px;
  }

  .account {
    flex-wrap: wrap;
  }

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

  .suggestion {
    grid-template-columns: 22px 1fr;
  }

  .suggestion small {
    grid-column: 2;
  }
}
