* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #202124;
  background: #f7f7f4;
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid #d6d6ce;
  background: #ffffff;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  padding: 16px;
  font-size: 13px;
  text-transform: uppercase;
  color: #5f6368;
}

main {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  min-height: calc(100vh - 62px);
}

.auth-panel {
  display: grid;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #d6d6ce;
  background: #ffffff;
}

.auth-panel[hidden] {
  display: none;
}

.auth-header,
.auth-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auth-header h2 {
  padding: 0;
}

.auth-form input {
  min-height: 34px;
  width: 190px;
  padding: 6px 8px;
  border: 1px solid #c7c7be;
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
}

.auth-header button,
.auth-form button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #9aa0a6;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
}

.auth-register {
  max-width: 760px;
}

.auth-register summary {
  cursor: pointer;
}

.auth-error {
  color: #9f1239;
}

aside {
  border-right: 1px solid #d6d6ce;
  background: #eeeee8;
}

.build-list {
  display: grid;
  gap: 6px;
  padding: 0 12px 16px;
}

.build-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: #ffffff;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
  cursor: pointer;
}

.build-list button.selected {
  border-color: #1f6feb;
  box-shadow: inset 3px 0 0 #1f6feb;
}

.build-list button.baseline-build {
  border-color: #1f7a4d;
}

.baseline-list-label {
  width: fit-content;
  padding: 1px 7px;
  border-radius: 999px;
  background: #dff1e5;
  color: #1f6f43;
  font-size: 11px;
}

.build-list span,
.muted {
  color: #6f7378;
}

section {
  min-width: 0;
  padding: 20px 24px 40px;
}

.review-targets {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d6d6ce;
}

.review-targets-header,
.review-target-work-header,
.review-target-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.review-targets-header {
  justify-content: space-between;
}

.review-targets h2 {
  padding: 0;
}

.review-target-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-target-form input {
  width: 130px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #c7c7be;
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
}

.review-target-form button,
.review-target-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #9aa0a6;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
}

.review-target-list {
  display: grid;
  gap: 8px;
}

.review-target-work {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
  background: #ffffff;
}

.review-target-work-header {
  justify-content: space-between;
}

.review-page-targets {
  display: grid;
  gap: 8px;
}

.review-page-target {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e2e2dc;
  border-radius: 6px;
  background: #fbfbfa;
}

.review-page-target img,
.review-page-placeholder {
  width: 96px;
  height: 72px;
  border: 1px solid #e2e2dc;
  border-radius: 4px;
  background: #eeeeea;
  object-fit: contain;
}

.review-page-placeholder {
  display: grid;
  place-items: center;
  color: #6f7378;
  font-size: 12px;
}

.review-page-detail {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.review-page-detail span {
  overflow-wrap: anywhere;
  color: #5f6368;
}

.review-target-error {
  color: #9f1239;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d6d6ce;
}

.summary div {
  display: grid;
  gap: 2px;
}

.summary span {
  color: #6f7378;
  font-size: 12px;
}

.summary strong {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.baseline-controls {
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.baseline-status,
.baseline-current {
  display: grid;
  gap: 2px;
}

.baseline-current strong {
  color: #1f6f43;
}

.bless-baseline-button {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #9aa0a6;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
}

.bless-baseline-button:disabled {
  border-color: #cfd6dd;
  background: #edf7f0;
  color: #1f6f43;
  cursor: default;
}

.baseline-error {
  grid-column: 1 / -1;
  color: #9f1239;
}

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

.work-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
}

.work-header {
  display: grid;
  grid-template-columns: minmax(120px, 180px) max-content 1fr;
  gap: 12px;
  align-items: center;
}

.status {
  display: inline-flex;
  justify-content: center;
  min-width: 72px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e7ecf3;
  color: #334155;
  font-size: 12px;
}

.status-ok,
.status-unchanged {
  background: #dff1e5;
  color: #146c2e;
}

.status-minor {
  background: #fff3cd;
  color: #7a4d00;
}

.status-error,
.status-changed {
  background: #f8dfdf;
  color: #9a1b1b;
}

.artifact-links,
.diffs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

a,
.diffs span {
  color: #1f6feb;
}

.artifact-links a,
.diffs span {
  padding: 3px 8px;
  border: 1px solid #d6d6ce;
  border-radius: 999px;
  background: #fbfbfa;
  text-decoration: none;
}

.viewer-link {
  font-weight: 600;
}

.metadata {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 10px;
  margin: 0;
}

.metadata dt {
  color: #6f7378;
}

.metadata dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.visual-diffs {
  display: grid;
  gap: 8px;
}

.visual-target {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
  background: #fbfbfa;
}

.visual-target-changed,
.visual-target-error {
  border-color: #d87a7a;
  background: #fff8f8;
}

.visual-target-minor {
  border-color: #e2bd62;
  background: #fffaf0;
}

.visual-unchanged-group {
  padding: 8px 10px;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
  background: #fbfbfa;
}

.visual-unchanged-group summary {
  cursor: pointer;
  color: #5f6368;
  font-weight: 600;
}

.visual-unchanged-group .visual-target {
  margin-top: 8px;
}

.visual-target-title {
  display: grid;
  grid-template-columns: max-content max-content max-content 1fr;
  gap: 8px;
  align-items: center;
}

.visual-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.visual-page-links a,
.visual-page-links span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #d6d6ce;
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.visual-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.visual-images a {
  display: grid;
  gap: 4px;
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #ffffff;
  color: #1f6feb;
  font-size: 12px;
  text-align: center;
}

.visual-images img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #ececec;
  border-bottom: 1px solid #d6d6ce;
}

.screenshot-viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 24px;
  background: rgba(16, 18, 20, 0.76);
}

.screenshot-viewer.is-open {
  display: grid;
  place-items: center;
}

.screenshot-viewer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(1180px, 100%);
  height: min(820px, 100%);
  min-height: 0;
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.screenshot-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.screenshot-viewer-title {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.screenshot-viewer-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.screenshot-viewer-controls button {
  padding: 6px 10px;
  border: 1px solid #d6d6ce;
  border-radius: 6px;
  background: #fbfbfa;
  color: #202124;
  cursor: pointer;
}

.screenshot-viewer img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
  object-fit: contain;
  min-width: 0;
  min-height: 0;
  border: 1px solid #d6d6ce;
  background: #f7f7f4;
}

.screenshot-viewer-caption {
  color: #5f6368;
  overflow-wrap: anywhere;
  font-size: 12px;
}

@media (max-width: 800px) {
  main {
    grid-template-columns: 1fr;
  }

  aside {
    border-right: 0;
    border-bottom: 1px solid #d6d6ce;
  }

  .work-header {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .visual-target-title {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .screenshot-viewer {
    padding: 10px;
  }

  .screenshot-viewer-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
