:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --ink: #182233;
  --muted: #667085;
  --line: #d9e0ea;
  --panel: #ffffff;
  --green: #236254;
  --blue: #274c77;
  --amber: #9a5a16;
  --red: #df1d1d;
  --shadow: 0 18px 52px rgba(24, 34, 51, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

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

button.secondary {
  background: #e9eef5;
  color: var(--ink);
}

a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.app-shell {
  width: min(1460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar h1,
.panel-heading h2,
.detail-head h2,
.gate-copy h2,
.feedback-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.form-state {
  color: var(--muted);
}

.route-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 9px 14px;
  font-size: 13px;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-panel {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 0.7fr);
  gap: 36px;
  align-items: center;
}

.gate-copy {
  padding: 0 8px;
}

.gate-copy h2 {
  font-size: clamp(38px, 7vw, 82px);
  line-height: 0.96;
}

.gate-copy .muted {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.6;
}

.gate-form,
.result-list,
.detail-panel,
.feedback-panel,
.import-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.gate-form {
  padding: 28px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  margin: 0 0 8px;
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.result-list,
.detail-panel {
  padding: 18px;
}

.cards {
  display: grid;
  gap: 10px;
}

.result-card {
  width: 100%;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 16px;
}

.result-card[aria-pressed="true"] {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}

.card-meta,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.import-panel {
  margin-top: 18px;
  padding: 14px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.detail-head h2 {
  font-size: 28px;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.capture-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.capture-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.annotation-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotation-box {
  position: absolute;
  border: 3px solid var(--red);
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.03);
}

.annotation-number {
  position: absolute;
  top: -16px;
  left: -16px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

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

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

.annotation-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.annotation-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.feedback-panel {
  margin-top: 18px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.export-output {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 980px) {
  .workspace-grid,
  .capture-layout,
  .gate-panel {
    grid-template-columns: 1fr;
  }

  .detail-head {
    flex-direction: column;
  }

  .route-chip {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 20px, 1460px);
    padding-top: 12px;
  }

  .topbar,
  .password-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .gate-form,
  .result-list,
  .detail-panel {
    padding: 14px;
  }
}
