:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d7dbe0;
  --text: #1b1f24;
  --muted: #6b7280;
  --pass: #1a7f37;
  --marginal: #b7791f;
  --fail: #c0392b;
  --accent: #2563eb;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(
      1100px 600px at 50% -10%,
      rgba(37, 99, 235, 0.1),
      transparent 60%
    ),
    var(--bg);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: min(420px, 90vw);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.login-card {
  text-align: center;
  padding: 2.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

.brand-logo {
  display: block;
  margin: 0 auto 0.6rem;
  width: 72px;
  height: 72px;
}

.brand-name {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.login-card h1 {
  margin: 0.35rem 0 0.75rem;
  font-size: 1.5rem;
}

.login-card #login-message {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}

.login-footer {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.card h1 {
  margin-top: 0;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

#login-form input {
  width: 100%;
}

input,
textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

textarea {
  width: 100%;
  resize: vertical;
}

button {
  font: inherit;
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

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

.primary-button {
  display: inline-block;
  font: inherit;
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

button.link-button,
.link-button {
  background: none;
  color: var(--accent);
  border: none;
  padding: 0;
}

.error {
  color: var(--fail);
}

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

.dataset-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  align-self: center;
}

.topbar-logo {
  width: 28px;
  height: 28px;
  display: block;
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.topbar-brand-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.topbar-brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.topbar-divider {
  align-self: center;
  width: 1px;
  height: 1.6rem;
  background: var(--border);
}

.topbar-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}

.plot-pane,
.verdict-pane,
.overview-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

/* The verdict and overview panes share the right grid column, stacked
   vertically so an admin sees both their own verdict panel and everyone's
   verdict overview at once. */
.side-panes {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.badge {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--border);
  font-size: 0.8rem;
  font-weight: 600;
}

.plot {
  width: 100%;
  min-height: 240px;
  max-height: 340px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.plot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.plot-row .plot {
  flex: 1 1 320px;
  min-width: 0;
}

.ascan-details {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem 0.7rem;
  background: linear-gradient(180deg, #fbfcfd 0%, #ffffff 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.detail-card h3 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.detail-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.25rem;
}

.detail-card.two-col .detail-list {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid #f0f1f3;
  font-size: 0.82rem;
}

.detail-row dt {
  color: var(--muted);
  min-width: 0;
}

.detail-row dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow-wrap: anywhere;
}

.gallery {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.gallery img {
  flex: 0 1 auto;
  min-width: 0;
  display: block;
  width: auto;
  height: auto;
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.8);
  cursor: zoom-out;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.verdict-pane h2 {
  margin-top: 0;
}

.overview-pane h2 {
  margin-top: 0;
}

.verdict-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.verdict-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.verdict-user {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.verdict-badge {
  justify-self: end;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.verdict-badge.pass {
  background: var(--pass);
}

.verdict-badge.marginal {
  background: var(--marginal);
}

.verdict-badge.fail {
  background: var(--fail);
}

.verdict-comment {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.verdict-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

button.verdict {
  background: #fff;
  color: var(--text);
  border: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

button.verdict.pass.selected {
  border-color: var(--pass);
  background: #e8f6ec;
  color: var(--pass);
}

button.verdict.marginal.selected {
  border-color: var(--marginal);
  background: #fbf2e0;
  color: var(--marginal);
}

button.verdict.fail.selected {
  border-color: var(--fail);
  background: #fbe9e7;
  color: var(--fail);
}

.reason-block {
  margin-bottom: 1rem;
}

.reason-heading {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.reason-heading .muted {
  font-weight: 400;
  font-size: 0.85rem;
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reason-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.reason-item:hover {
  border-color: var(--accent);
  background: #eef2f8;
}

.reason-item:has(.reason-checkbox:checked) {
  border-color: var(--fail);
  background: #fbe9e7;
  color: var(--fail);
  font-weight: 600;
}

/* The native checkbox drives state but is visually hidden in favour of the
   chip styling; it stays in the DOM for accessibility and keyboard toggling. */
.reason-checkbox {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.reason-item:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.reason-text {
  font-size: inherit;
}

.reason-info {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.7;
}

.reason-item:has(.reason-checkbox:checked) .reason-info {
  color: var(--fail);
  opacity: 0.85;
}

.reason-tooltip {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 260px;
  max-width: min(260px, 80vw);
  padding: 0.6rem 0.7rem;
  background: #1b1f24;
  color: #f4f5f7;
  font-weight: 400;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  line-height: 1.35;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.reason-item:hover .reason-tooltip,
.reason-item:has(.reason-checkbox:focus-visible) .reason-tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip-detail {
  display: block;
  margin-bottom: 0.5rem;
}

.tooltip-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.tooltip-case {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tooltip-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tooltip-case.good .tooltip-tag {
  color: #6ee7a0;
}

.tooltip-case.bad .tooltip-tag {
  color: #f6a99c;
}

.wave {
  width: 100%;
  height: 48px;
  display: block;
  border-radius: 4px;
}

.wave-bg {
  fill: #0f1216;
}

.wave-trace {
  fill: none;
  stroke: #8ec7ff;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.tooltip-case.good .wave-trace {
  stroke: #6ee7a0;
}

.tooltip-case.bad .wave-trace {
  stroke: #f6a99c;
}

.wave-floor {
  stroke: #6b7280;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.verdict-reasons {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.reason-chip {
  font-size: 0.75rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #eef2f8;
  border: 1px solid var(--border);
  color: var(--text);
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #eef0f3;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.35rem;
  font-size: 0.8em;
}

.hint {
  margin-top: 1rem;
  font-size: 0.85rem;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-card.two-col .detail-list {
    grid-template-columns: 1fr;
  }
}
