:root {
  color-scheme: light;
  --bg: oklch(1 0 0);
  --surface: oklch(0.97 0.004 200);
  --surface-strong: oklch(0.94 0.008 130);
  --ink: oklch(0.22 0.028 130);
  --muted: oklch(0.48 0.018 130);
  --line: oklch(0.88 0.008 130);
  --primary: oklch(0.54 0.15 130);
  --primary-hover: oklch(0.49 0.14 130);
  --primary-soft: oklch(0.94 0.045 130);
  --error: oklch(0.58 0.19 27);
  --error-soft: oklch(0.96 0.025 27);
  --warning: oklch(0.72 0.14 70);
  --warning-soft: oklch(0.96 0.035 70);
  --warning-ink: oklch(0.48 0.13 70);
  --success: oklch(0.55 0.14 142);
  --success-soft: oklch(0.94 0.035 142);
  --success-ink: oklch(0.43 0.12 142);
  --info: oklch(0.48 0.09 250);
  --info-soft: oklch(0.94 0.025 250);
  --shadow-sm: 0 2px 8px oklch(0.22 0.028 130 / 0.08);
  --radius-s: 8px;
  --radius-m: 12px;
  --space-3xs: 4px;
  --space-2xs: 8px;
  --space-xs: 12px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 32px;
  --space-xl: 48px;
  --tap: 44px;
  --sidebar: 248px;
  --evidence: 440px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  min-height: var(--tap);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--primary-hover);
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

:where(a, button, input, select):focus-visible {
  outline: 3px solid oklch(0.72 0.14 70);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: var(--space-s);
  left: var(--space-s);
  transform: translateY(-180%);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-s);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100svh;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-m);
  padding: var(--space-s);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2xs);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.brand__mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
}

.brand__mark svg {
  width: 28px;
  height: 28px;
}

.button {
  display: inline-flex;
  min-width: 0;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: 0 var(--space-s);
  border-radius: var(--radius-s);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--bg);
}

.button--primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.button--primary:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
}

.button--secondary {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.button--secondary:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.button--compact {
  min-height: var(--tap);
  padding-inline: var(--space-xs);
}

.button--full {
  width: 100%;
}

.button__loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid oklch(1 0 0 / 0.42);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.button.is-loading .button__loader {
  display: block;
}

.nav-list {
  display: flex;
  min-width: 0;
  gap: var(--space-2xs);
}

.nav-item {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-xs);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

.nav-item:hover:not(:disabled),
.nav-item--active {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.nav-item:disabled {
  opacity: 0.58;
}

.nav-item__soon {
  margin-left: auto;
  font-size: 12px;
}

.sidebar__note,
.sidebar__footer {
  display: none;
}

.main {
  min-width: 0;
}

.start-view {
  display: grid;
  min-height: calc(100svh - 150px);
  align-content: center;
  gap: var(--space-l);
  width: min(920px, 100%);
  margin-inline: auto;
  padding: var(--space-xl) var(--space-s);
}

.start-view__copy {
  display: grid;
  max-width: 720px;
  gap: var(--space-s);
}

.start-view__lead {
  color: var(--primary-hover);
  font-size: 14px;
  font-weight: 700;
}

.start-view h1 {
  max-width: 18ch;
  font-size: clamp(32px, 8vw, 48px);
  letter-spacing: -0.035em;
}

.start-view__copy > p:last-child {
  max-width: 66ch;
  color: var(--muted);
  font-size: 17px;
}

.scan-form {
  padding: var(--space-s);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.field {
  display: grid;
  min-width: 0;
  gap: var(--space-2xs);
}

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

.url-control {
  position: relative;
  display: grid;
  min-width: 0;
  gap: var(--space-2xs);
}

.url-control__icon {
  position: absolute;
  top: 14px;
  left: var(--space-xs);
  color: var(--muted);
  pointer-events: none;
}

.url-control input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 var(--space-xs) 0 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  font-size: max(16px, 1rem);
}

.url-control input:hover {
  border-color: var(--muted);
}

.url-control input:focus {
  border-color: var(--primary);
}

.field__meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-s);
  color: var(--muted);
  font-size: 13px;
}

.page-limit {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2xs);
}

.page-limit select {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.field__error {
  min-height: 20px;
  color: var(--error);
  font-size: 13px;
}

.process {
  display: grid;
  gap: var(--space-s);
  margin: 0;
  padding: 0;
  list-style: none;
}

.process li {
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: var(--space-xs);
  align-items: center;
}

.process li > span {
  display: grid;
  width: 32px;
  height: 32px;
  grid-row: 1 / span 2;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--primary-hover);
  font-size: 13px;
  font-weight: 750;
}

.process strong {
  font-size: 14px;
}

.process small {
  color: var(--muted);
  font-size: 13px;
}

.results-view {
  min-width: 0;
}

.project-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  padding: var(--space-s);
  border-bottom: 1px solid var(--line);
}

.project-header__title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2xs);
}

.project-header h1 {
  min-width: 0;
  font-size: 24px;
  letter-spacing: -0.025em;
  word-break: break-word;
}

.project-header p {
  color: var(--muted);
  font-size: 13px;
}

.external-link {
  display: grid;
  width: var(--tap);
  height: var(--tap);
  place-items: center;
  border-radius: var(--radius-s);
}

.scan-summary {
  display: grid;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.progress-summary,
.issue-totals {
  min-width: 0;
  padding: var(--space-s);
}

.progress-summary {
  display: grid;
  gap: var(--space-2xs);
}

.progress-summary__row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  font-size: 14px;
}

.progress-summary__row span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  overflow: clip;
  border-radius: 999px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: inherit;
  background: var(--primary);
  transition: transform 220ms ease;
}

.scan-current {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  border-top: 1px solid var(--line);
}

.issue-totals > div {
  display: grid;
  min-width: 0;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-2xs);
}

.issue-totals strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.issue-totals small {
  grid-column: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.issue-icon {
  display: grid;
  width: 24px;
  height: 24px;
  grid-row: 1 / span 2;
  place-items: center;
  border-radius: 50%;
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
}

.issue-icon--spelling {
  background: var(--error);
}

.issue-icon--punctuation {
  background: var(--warning);
}

.issue-icon--rewrite {
  background: var(--info);
}

.workspace {
  min-width: 0;
}

.issues-pane,
.evidence-pane {
  min-width: 0;
}

.filters {
  display: flex;
  min-width: 0;
  gap: var(--space-2xs);
  overflow-x: auto;
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--line);
  overscroll-behavior-inline: contain;
}

.filters select {
  flex: 0 0 auto;
  min-width: 144px;
  padding: 0 38px 0 var(--space-xs);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  font-size: 14px;
}

.filter-reset {
  min-height: var(--tap);
  flex: 0 0 auto;
  padding: 0 var(--space-xs);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.filter-reset:hover {
  background: var(--surface);
  color: var(--ink);
}

.list-heading {
  display: none;
}

.issues-list {
  min-width: 0;
}

.issue-row {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs);
  align-items: center;
  padding: var(--space-s);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  text-align: left;
}

.issue-row:hover {
  background: var(--surface);
}

.issue-row.is-selected {
  background: var(--primary-soft);
}

.issue-row__copy {
  min-width: 0;
}

.issue-row__page {
  overflow: hidden;
  margin-bottom: var(--space-3xs);
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row__text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.issue-row__meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2xs);
}

.type-badge,
.status-badge,
.confidence {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: var(--space-3xs);
  padding: 2px var(--space-2xs);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.type-badge::before,
.status-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.type-badge--spelling {
  background: var(--error-soft);
  color: var(--error);
}

.type-badge--punctuation,
.type-badge--typography {
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.type-badge--rewrite {
  background: var(--info-soft);
  color: var(--info);
}

.status-badge {
  background: var(--surface);
  color: var(--muted);
}

.status-badge--accepted {
  background: var(--success-soft);
  color: var(--success-ink);
}

.status-badge--dismissed {
  background: var(--surface);
  color: var(--muted);
}

.empty-state,
.evidence-empty {
  display: grid;
  min-height: 360px;
  place-content: center;
  justify-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xl) var(--space-s);
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.evidence-empty h2 {
  color: var(--ink);
  font-size: 18px;
}

.empty-state p,
.evidence-empty p {
  max-width: 38ch;
  font-size: 14px;
}

.empty-state__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--success);
  font-size: 22px;
}

.evidence-pane {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.evidence {
  display: grid;
  min-width: 0;
  gap: var(--space-s);
  padding: var(--space-s);
}

.evidence__top {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xs);
}

.evidence__top > div {
  min-width: 0;
}

.evidence__page-label {
  color: var(--muted);
  font-size: 12px;
}

.evidence__top h2 {
  max-width: 28ch;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-frame {
  position: relative;
  min-width: 0;
  overflow: clip;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
}

.screenshot-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screenshot-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-s);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.evidence-section {
  display: grid;
  min-width: 0;
  gap: var(--space-2xs);
  padding-top: var(--space-s);
  border-top: 1px solid var(--line);
}

.evidence-section h3 {
  font-size: 14px;
}

.evidence-section p {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.suggestion {
  padding: var(--space-xs);
  border-radius: var(--radius-s);
  background: var(--primary-soft);
}

.reason-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.confidence {
  min-height: 24px;
  background: var(--surface);
  color: var(--muted);
}

.evidence-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-2xs);
  padding-top: var(--space-2xs);
}

.toast {
  position: fixed;
  z-index: 5;
  right: var(--space-s);
  bottom: calc(var(--space-s) + env(safe-area-inset-bottom));
  max-width: min(380px, calc(100vw - 32px));
  transform: translateY(140%);
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius-s);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 600px) {
  .url-control {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .url-control .button {
    min-height: 50px;
  }

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

  .scan-summary {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
  }

  .issue-totals {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .list-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 126px 104px;
    gap: var(--space-xs);
    padding: var(--space-2xs) var(--space-s);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
  }

  .issue-row {
    grid-template-columns: minmax(0, 1fr) 126px 104px;
  }

  .issue-row__meta {
    display: contents;
  }
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100svh;
    gap: var(--space-m);
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .nav-list {
    flex-direction: column;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .sidebar__note {
    display: grid;
    gap: var(--space-2xs);
    margin-top: auto;
    padding: var(--space-s);
    border-radius: var(--radius-s);
    background: var(--surface-strong);
    font-size: 13px;
  }

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

  .sidebar__footer {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    color: var(--muted);
    font-size: 12px;
  }

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

  .main {
    min-height: 100svh;
  }

  .start-view {
    min-height: 100svh;
    padding-inline: var(--space-l);
  }

  .project-header,
  .progress-summary,
  .issue-totals {
    padding-inline: var(--space-m);
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, var(--evidence));
    min-height: calc(100svh - 190px);
  }

  .issues-pane {
    border-right: 1px solid var(--line);
  }

  .evidence-pane {
    border-top: 0;
  }

  .evidence {
    position: sticky;
    top: 0;
    padding: var(--space-m);
  }
}

@media (min-width: 1200px) {
  .project-header {
    min-height: 82px;
  }

  .progress-summary,
  .issue-totals {
    padding-block: var(--space-m);
  }
}

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

[hidden] {
  display: none;
}
