:root {
  color-scheme: light;
  --blue: #2d5ddc;
  --orange: #ff5734;
  --ink: #151313;
  --paper: #f7f7f7;
  --soft: #e3e6e9;
  --lime: #c4f03b;
  --white: #ffffff;
  --line: rgb(21 19 19 / 0.1);
  --muted: rgb(21 19 19 / 0.58);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #d9e3e8;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

svg {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-frame {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  width: min(1720px, calc(100vw - 42px));
  min-height: calc(100vh - 42px);
  margin: 21px auto;
  overflow: hidden;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 38px 90px rgb(21 19 19 / 0.2);
}

.side-rail {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  gap: 1.45rem;
  background: var(--soft);
  padding: 2rem 1rem;
}

.brand-mark,
.rail-btn,
.notify-btn {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: var(--ink);
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--lime);
}

.rail-nav {
  display: grid;
  gap: 0.9rem;
}

.rail-bottom {
  margin-top: auto;
}

.rail-btn {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: transparent;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.rail-btn:hover,
.rail-btn:focus-visible {
  background: rgb(255 255 255 / 0.86);
  outline: none;
}

.rail-btn.is-active {
  background: var(--orange);
  color: white;
  box-shadow: 0 12px 26px rgb(255 87 52 / 0.28);
}

.app-shell {
  min-width: 0;
  padding: clamp(1rem, 2vw, 2rem);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.brand-word {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 800;
}

.brand-word span {
  color: var(--orange);
}

.breadcrumb {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.api-key-card,
.status-chip {
  display: grid;
  width: min(34vw, 430px);
  min-width: 300px;
  gap: 0.45rem;
  border: 0;
  border-radius: 20px;
  background: var(--soft);
  padding: 0.55rem;
  color: var(--ink);
  text-align: left;
}

.status-chip {
  width: auto;
  min-width: 13rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.45rem;
  color: rgb(21 19 19 / 0.68);
  font-size: 0.8rem;
  font-weight: 700;
}

.status-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: rgb(21 19 19 / 0.24);
  box-shadow: 0 0 0 4px rgb(21 19 19 / 0.06);
}

.status-dot[data-status="ok"] {
  background: var(--lime);
  box-shadow: 0 0 0 4px rgb(196 240 59 / 0.32);
}

.status-dot[data-status="error"] {
  background: var(--orange);
  box-shadow: 0 0 0 4px rgb(255 87 52 / 0.18);
}

.status-dot[data-status="checking"] {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgb(45 93 220 / 0.18);
}

.api-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.4rem;
}

.settings-api-row {
  margin-top: 0.9rem;
}

.api-key-input {
  min-width: 0;
}

.search-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  width: min(22vw, 330px);
  min-width: 210px;
  height: 52px;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  background: var(--soft);
  padding: 0.3rem 0.34rem 0.3rem 1.1rem;
}

.search-pill input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.search-pill button,
.notify-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.search-pill button {
  border: 0;
  background: var(--orange);
  color: white;
}

.notify-btn {
  background: var(--soft);
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  white-space: nowrap;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 3px solid white;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.profile-name {
  font-weight: 700;
  line-height: 1.1;
}

.profile-handle {
  color: var(--muted);
  font-size: 0.86rem;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.selected-workspace {
  display: contents;
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 440px);
  gap: 1rem;
  margin-bottom: 1rem;
}

.hero-copy {
  border-radius: 24px;
  background: var(--ink);
  color: white;
  padding: clamp(1.2rem, 3vw, 2.1rem);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 4.3rem);
  font-weight: 800;
  line-height: 1;
}

.hero-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.hero-controls .input {
  grid-column: 1 / -1;
}

.metric-card {
  border-radius: 22px;
  background: var(--blue);
  color: white;
  padding: 1.05rem 1.15rem;
}

.metric-card.is-black {
  background: var(--ink);
}

.metric-label {
  color: rgb(255 255 255 / 0.74);
  font-size: 0.85rem;
}

.metric-value {
  margin-top: 0.25rem;
  font-size: 1.55rem;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 1rem;
}

.panel,
.panel-tight {
  min-width: 0;
  border: 0;
  border-radius: 24px;
  padding: 1.35rem;
}

.panel-blue {
  background: var(--blue);
  color: white;
}

.panel-light,
.panel-tight,
.panel-table {
  background: var(--soft);
  color: var(--ink);
}

.panel-table {
  padding-bottom: 1rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head h2 {
  margin: 0.65rem 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 800;
  line-height: 1.05;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: currentColor;
  font-size: 0.95rem;
  opacity: 0.72;
}

.panel-head > svg,
.panel-head > i svg,
.panel-head > i {
  color: var(--blue);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0.33rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.tag-dark {
  background: var(--ink);
  color: white;
}

.tag-orange {
  background: var(--orange);
  color: white;
}

.tag-lime {
  background: var(--lime);
  color: var(--ink);
}

.form-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 0.8rem;
}

.button-row,
.quick-actions,
.review-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.quick-actions {
  margin-top: 1.4rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.summary-box,
.settings-card,
.metric-mini {
  border-radius: 18px;
  background: white;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px rgb(21 19 19 / 0.08);
}

.summary-box span,
.metric-mini span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-box strong,
.metric-mini strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.input {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0.72rem 1rem;
  outline: none;
  box-shadow: inset 0 0 0 1px rgb(21 19 19 / 0.08);
}

.textarea {
  min-height: 6rem;
  resize: vertical;
  border-radius: 18px;
}

.panel-blue .input {
  background: rgb(255 255 255 / 0.92);
}

.input:focus {
  box-shadow:
    inset 0 0 0 2px var(--lime),
    0 0 0 4px rgb(196 240 59 / 0.26);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.icon-btn {
  display: inline-flex;
  min-height: 2.7rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease, filter 140ms ease, background 140ms ease;
}

.btn-primary {
  background: var(--lime);
  color: var(--ink);
}

.btn-secondary,
.icon-btn {
  background: white;
  color: var(--blue);
  box-shadow: inset 0 0 0 2px var(--blue);
}

.btn-danger {
  background: white;
  color: var(--orange);
  box-shadow: inset 0 0 0 2px var(--orange);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.icon-btn:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.icon-btn {
  width: 2.7rem;
  padding: 0;
}

.compact {
  min-height: 2.45rem;
  border-radius: 12px;
  white-space: nowrap;
}

.full-width {
  width: 100%;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.5rem;
  max-height: 19rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.answer-grid-large {
  max-height: calc(100vh - 15rem);
  margin-top: 1.25rem;
}

.answer-cell {
  display: grid;
  min-width: 0;
  gap: 0.28rem;
}

.answer-cell label {
  color: currentColor;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.62;
}

.answer-cell select,
.review-card select {
  width: 100%;
  height: 2.15rem;
  border: 0;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  text-align: center;
  box-shadow: inset 0 0 0 1px rgb(21 19 19 / 0.1);
}

.upload-form {
  display: grid;
  gap: 1rem;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 1rem;
}

.upload-sources {
  display: grid;
  gap: 0.8rem;
}

.upload-drop {
  display: flex;
  min-height: 11rem;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgb(45 93 220 / 0.38);
  border-radius: 20px;
  background: rgb(45 93 220 / 0.05);
  color: var(--blue);
  padding: 1rem;
  text-align: center;
}

.upload-drop svg {
  width: 2rem;
  height: 2rem;
}

.upload-title {
  margin-top: 0.45rem;
  font-weight: 800;
}

.upload-help {
  max-width: 100%;
  margin-top: 0.35rem;
  overflow: hidden;
  color: rgb(45 93 220 / 0.72);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.camera-tile {
  display: grid;
  min-height: 6.8rem;
  cursor: pointer;
  place-items: center;
  gap: 0.35rem;
  border-radius: 18px;
  background: white;
  color: var(--ink);
  padding: 0.9rem;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.camera-tile svg {
  color: var(--orange);
}

.camera-tile span {
  font-weight: 800;
}

.camera-tile small {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-side {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.file-preview-list {
  display: grid;
  gap: 0.6rem;
}

.file-preview {
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border-radius: 16px;
  background: white;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px var(--line);
}

.file-order {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

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

.file-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.job-progress {
  display: grid;
  gap: 0.55rem;
}

.job-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: white;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--line);
}

.phase-badge[data-tone="info"] {
  background: rgb(45 93 220 / 0.12);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgb(45 93 220 / 0.2);
}

.phase-badge[data-tone="success"] {
  background: rgb(196 240 59 / 0.36);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgb(196 240 59 / 0.46);
}

.phase-badge[data-tone="warning"] {
  background: rgb(255 87 52 / 0.14);
  color: var(--orange);
  box-shadow: inset 0 0 0 1px rgb(255 87 52 / 0.24);
}

.phase-badge[data-tone="error"] {
  background: var(--ink);
  color: white;
  box-shadow: none;
}

.phase-badge[data-tone="neutral"] {
  background: white;
  color: var(--ink);
}

.job-substatus {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.job-percent {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
}

.job-progress-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.job-track {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(21 19 19 / 0.1);
}

.job-bar {
  width: 0;
  height: 100%;
  background: var(--lime);
  transition: width 180ms ease;
}

.job-progress.is-indeterminate .job-bar {
  width: 38% !important;
  animation: job-bar-indeterminate 1.2s ease-in-out infinite;
}

@keyframes job-bar-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  60% {
    transform: translateX(170%);
  }
  100% {
    transform: translateX(170%);
  }
}

.activity-log {
  display: grid;
  gap: 0.8rem;
  border-radius: 20px;
  background: white;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px var(--line);
}

.activity-log-head h3 {
  margin: 0.55rem 0 0;
  font-size: 1rem;
  font-weight: 800;
}

.activity-log-list {
  display: grid;
  gap: 0.6rem;
  max-height: 19rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.activity-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  border-radius: 14px;
  background: var(--paper);
  padding: 0.75rem;
}

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

.activity-message {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

.activity-item[data-tone="success"] .activity-message {
  color: var(--blue);
}

.activity-item[data-tone="warning"] .activity-message {
  color: var(--orange);
}

.activity-item[data-tone="error"] .activity-message {
  color: var(--orange);
}

.activity-meta {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.segmented {
  display: grid;
  min-width: 220px;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  border-radius: 999px;
  background: white;
  padding: 0.25rem;
  box-shadow: inset 0 0 0 1px var(--line);
}

.segmented label {
  cursor: pointer;
  border-radius: 999px;
  padding: 0.58rem 0.65rem;
  text-align: center;
  color: rgb(21 19 19 / 0.74);
  font-weight: 800;
}

.segmented input {
  display: none;
}

.segmented label:has(input:checked) {
  background: var(--blue);
  color: white;
}

.table-wrap {
  margin-top: 1.2rem;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0 0.45rem;
  font-size: 0.92rem;
}

thead {
  color: rgb(21 19 19 / 0.5);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  padding: 0.75rem 0.9rem;
}

tbody tr {
  background: white;
}

tbody td {
  border-top: 1px solid rgb(21 19 19 / 0.06);
  border-bottom: 1px solid rgb(21 19 19 / 0.06);
}

tbody td:first-child {
  border-left: 1px solid rgb(21 19 19 / 0.06);
  border-radius: 16px 0 0 16px;
}

tbody td:last-child {
  border-right: 1px solid rgb(21 19 19 / 0.06);
  border-radius: 0 16px 16px 0;
}

.candidate-cell {
  font-weight: 800;
}

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

.score-good {
  color: var(--blue);
  font-weight: 800;
}

.score-bad {
  color: var(--orange);
  font-weight: 800;
}

.row-actions {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
}

.empty-row {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.pill-completed {
  background: var(--lime);
  color: var(--ink);
}

.pill-errors {
  background: var(--orange);
  color: white;
}

.pill-processing {
  background: var(--blue);
  color: white;
}

.pill-neutral {
  background: var(--soft);
  color: var(--ink);
}

.pill-failed {
  background: var(--ink);
  color: white;
}

.review-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.review-list-card {
  display: grid;
  gap: 0.75rem;
  border-radius: 18px;
  background: white;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px var(--line);
}

.review-list-card h3 {
  margin: 0;
  font-size: 1rem;
}

.review-list-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.settings-card h3 {
  margin: 0 0 0.45rem;
}

.settings-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / 0.6);
}

.review-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(100%, 1120px);
  height: 100%;
  overflow-y: auto;
  border-left: 1px solid rgb(21 19 19 / 0.08);
  background: var(--paper);
  color: var(--ink);
  box-shadow: -18px 0 54px rgb(0 0 0 / 0.22);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgb(247 247 247 / 0.96);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(10px);
}

.drawer-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.drawer-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.drawer-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
}

.drawer-left,
.drawer-right {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.image-frame {
  border-radius: 22px;
  background: var(--soft);
  padding: 0.75rem;
}

.image-frame img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: white;
}

.panel-tight label {
  display: block;
  margin-bottom: 0.5rem;
  color: rgb(21 19 19 / 0.7);
  font-size: 0.9rem;
  font-weight: 800;
}

.warning-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.warning-item {
  border-radius: 14px;
  background: rgb(255 87 52 / 0.12);
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.drawer-score {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.review-toolbar {
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.review-toolbar h3 {
  margin: 0;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.55rem;
}

.review-card {
  min-height: 7.6rem;
  border: 0;
  border-radius: 18px;
  background: white;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px rgb(21 19 19 / 0.08);
}

.review-card[data-result="correct"] {
  background: rgb(196 240 59 / 0.28);
}

.review-card[data-result="wrong"] {
  background: rgb(255 87 52 / 0.14);
}

.review-card[data-result="blank"],
.review-card[data-result="ambiguous"] {
  background: rgb(255 255 255 / 0.84);
  box-shadow: inset 0 0 0 2px rgb(255 87 52 / 0.24);
}

.review-card-head,
.review-card-meta {
  display: grid;
  gap: 0.35rem;
}

.review-card-head {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 0.55rem;
}

.review-card-meta {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.review-card-meta strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  max-width: min(28rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 18px;
  background: var(--ink);
  color: white;
  padding: 0.9rem 1.05rem;
  box-shadow: 0 18px 45px rgb(0 0 0 / 0.22);
}

@media (max-width: 1160px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .api-key-card,
  .status-chip,
  .search-pill {
    width: 100%;
    min-width: 0;
  }

  .profile-chip {
    display: none;
  }

  .hero-strip,
  .workspace-grid,
  .settings-grid,
  .drawer-grid {
    grid-template-columns: 1fr;
  }

  .drawer-score {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html,
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  .app-frame {
    display: block;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
  }

  .side-rail {
    position: fixed;
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0.75rem;
    z-index: 30;
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    border-radius: 20px;
    background: rgb(227 230 233 / 0.96);
    padding: 0.45rem;
    box-shadow: 0 18px 50px rgb(21 19 19 / 0.22);
    backdrop-filter: blur(12px);
  }

  .brand-mark {
    display: none;
  }

  .rail-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.25rem;
    overflow-x: auto;
  }

  .rail-bottom {
    margin-top: 0;
  }

  .brand-mark,
  .rail-btn {
    width: 100%;
    height: 46px;
    border-radius: 16px;
  }

  .rail-bottom .rail-btn {
    width: 46px;
  }

  .app-shell {
    padding: 0.85rem 0.85rem calc(5.5rem + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }

  .brand-word {
    font-size: 1.25rem;
  }

  .breadcrumb {
    margin-top: 0.25rem;
    font-size: 0.8rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 0.5rem;
  }

  .status-chip {
    min-height: 48px;
    border-radius: 16px;
    padding: 0.45rem;
  }

  .api-status {
    min-width: 0;
    padding: 0 0.25rem;
  }

  #openaiStatusText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-pill {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 48px;
    min-width: 0;
    order: 3;
  }

  .notify-btn {
    width: 48px;
    height: 48px;
  }

  .hero-controls,
  .summary-grid,
  .form-row,
  .upload-layout,
  .camera-grid {
    grid-template-columns: 1fr;
  }

  .hero-strip {
    gap: 0.65rem;
    margin-bottom: 0.75rem;
  }

  .hero-copy {
    border-radius: 18px;
    padding: 1rem;
  }

  .hero-copy h1 {
    font-size: 1.8rem;
    line-height: 1.05;
  }

  .hero-controls {
    gap: 0.6rem;
  }

  .metric-card {
    border-radius: 16px;
    padding: 0.85rem;
  }

  .panel,
  .panel-tight,
  .panel-table {
    border-radius: 20px;
    padding: 1rem;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    min-width: 0;
  }

  .quick-actions,
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .quick-actions .btn-secondary,
  .button-row .btn-secondary,
  .panel-head .btn-primary,
  .panel-head .btn-secondary {
    width: 100%;
  }

  .input {
    min-height: 2.85rem;
  }

  .answer-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
    max-height: 48vh;
  }

  .answer-grid-large {
    max-height: none;
  }

  .answer-cell select,
  .review-card select {
    height: 2.35rem;
    min-width: 0;
  }

  .upload-drop {
    min-height: 8.8rem;
    border-radius: 18px;
  }

  .job-progress-head,
  .job-progress-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
  }

  .job-percent {
    font-size: 1rem;
  }

  .camera-tile {
    min-height: 5.8rem;
  }

  .upload-side {
    position: sticky;
    bottom: calc(5.2rem + env(safe-area-inset-bottom));
    z-index: 20;
    border-radius: 18px;
    background: rgb(227 230 233 / 0.92);
    padding: 0.5rem;
    box-shadow: 0 14px 34px rgb(21 19 19 / 0.14);
    backdrop-filter: blur(10px);
  }

  .file-preview {
    grid-template-columns: 2rem minmax(0, 1fr) 1.5rem;
    gap: 0.55rem;
    border-radius: 14px;
    padding: 0.65rem;
  }

  .file-order {
    width: 2rem;
    height: 2rem;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    border-spacing: 0;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    margin-bottom: 0.75rem;
    border-radius: 18px;
    background: white;
    padding: 0.75rem;
    box-shadow: inset 0 0 0 1px var(--line);
  }

  tbody td,
  tbody td:first-child,
  tbody td:last-child {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    border: 0;
    border-radius: 0;
    padding: 0.42rem 0;
  }

  tbody td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  tbody td:nth-child(1)::before { content: "Candidate"; }
  tbody td:nth-child(2)::before { content: "Source"; }
  tbody td:nth-child(3)::before { content: "Score"; }
  tbody td:nth-child(4)::before { content: "Correct"; }
  tbody td:nth-child(5)::before { content: "Wrong"; }
  tbody td:nth-child(6)::before { content: "Blank"; }
  tbody td:nth-child(7)::before { content: "Review"; }
  tbody td:nth-child(8)::before { content: "Status"; }

  .row-actions {
    justify-items: stretch;
  }

  .row-actions .btn-secondary {
    width: 100%;
  }

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

  .review-list-card .button-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .settings-grid {
    gap: 0.75rem;
  }

  .api-key-row {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
  }

  .review-drawer {
    inset: 0;
    width: 100%;
    border-left: 0;
  }

  .drawer-head {
    align-items: stretch;
    padding: 0.85rem;
  }

  .drawer-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 0.85rem;
  }

  .image-frame {
    border-radius: 18px;
    padding: 0.5rem;
  }

  .image-frame img {
    max-height: 46vh;
  }

  .drawer-score {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .review-card {
    min-height: 0;
    border-radius: 16px;
    padding: 0.65rem;
  }

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

  .toast {
    right: 0.75rem;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    left: 0.75rem;
    max-width: none;
  }

  .activity-log {
    border-radius: 18px;
    padding: 0.85rem;
  }

  .activity-log-list {
    max-height: 15rem;
  }

  .activity-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
