:root {
  --navy: #001a5d;
  --ink: #0c1330;
  --muted: #5c5c72;
  --line: #e7e2f1;
  --soft: #f6f3fb;
  --purple: #7d2cce;
  --green: #1a9e5f;
  --red: #d64545;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  font-family: "Roboto", system-ui, sans-serif;
  color: var(--ink);
  background: var(--soft);
  -webkit-tap-highlight-color: transparent;
}
body.vlab-review-app {
  overflow: hidden;
}
.hidden {
  display: none !important;
}

/* Login */
.vlab-login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #f6f3fb, #ebe4f8);
}
.vlab-login .card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(0, 26, 93, 0.08);
}
.vlab-login h1 {
  font-family: Poppins, sans-serif;
  font-size: 20px;
  margin: 12px 0 6px;
}
.vlab-login p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
}
.vlab-login label {
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}
.vlab-login input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 12px;
}
.vlab-login .err {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}
.vlab-login button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), #5b21b6);
  color: #fff;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  font-size: 15px;
}

/* Review shell — full viewport (desktop + mobile) */
.vlab-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  height: 100dvh;
  background: #fff;
}
.vlab-top {
  flex: none;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  z-index: 10;
}
@media (min-width: 960px) {
  .vlab-top {
    padding: 16px 28px 12px;
  }
  .vlab-top h1 {
    font-size: 22px;
  }
}
.vlab-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  padding: 6px 0;
  border: none;
  background: none;
  color: var(--purple);
  font-family: Poppins, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.vlab-back.hidden {
  display: none !important;
}
.vlab-top .eyebrow {
  font-family: Poppins, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 600;
}
.vlab-top h1 {
  font-family: Poppins, sans-serif;
  font-size: 18px;
  margin-top: 2px;
}
.vlab-progress {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.vlab-progress b {
  color: var(--navy);
}
.vlab-filters {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.vlab-filters button {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: Poppins, sans-serif;
  font-weight: 500;
  color: var(--muted);
}
.vlab-filters button.on {
  background: var(--soft);
  border-color: var(--purple);
  color: var(--purple);
}

.vlab-card-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  background: var(--soft);
  min-height: 0;
}
@media (min-width: 960px) {
  .vlab-card-wrap {
    padding: 20px 28px 28px;
  }
}
.vlab-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  min-height: 0;
  max-width: none;
}
@media (min-width: 960px) {
  .vlab-card {
    padding: 24px 28px;
    border-radius: 16px;
  }
  .vlab-package-detail .vlab-ko-title {
    font-size: 22px;
    margin-bottom: 12px;
  }
  .vlab-package-detail .vlab-meaning {
    font-size: 15px;
    max-width: 90ch;
  }
}
.vlab-case-grid {
  display: grid;
  gap: 10px;
}
@media (min-width: 700px) {
  .vlab-case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .vlab-case-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1600px) {
  .vlab-case-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.vlab-case-grid .vlab-pkg-btn {
  margin-bottom: 0;
  height: 100%;
}
.vlab-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.vlab-badge {
  font-size: 10px;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}
.vlab-badge.em {
  border-color: var(--purple);
  color: var(--purple);
}
.vlab-summary {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.vlab-evidence {
  background: #fff;
  border-left: 3px solid var(--purple);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.vlab-evidence .meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}
.vlab-match {
  margin-top: 10px;
  font-size: 12px;
  color: var(--purple);
  font-weight: 500;
}
.vlab-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.vlab-empty h2 {
  font-family: Poppins, sans-serif;
  font-size: 18px;
  color: var(--navy);
  margin-bottom: 8px;
}

.vlab-decision-dock {
  flex: none;
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(0, 26, 93, 0.08);
}
.vlab-shell:not(:has(.vlab-actions button)) .vlab-decision-dock {
  display: none;
}

.vlab-actions {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 16px calc(12px + var(--safe-b));
  border-top: none;
  background: transparent;
}
.vlab-actions button {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  font-size: 14px;
  touch-action: manipulation;
}
.vlab-actions button.primary {
  background: linear-gradient(135deg, var(--purple), #5b21b6);
  color: #fff;
  border: none;
}
.vlab-actions button.danger {
  color: var(--red);
  border-color: #f5caca;
}
.vlab-actions button:disabled {
  opacity: 0.5;
}
.vlab-actions .full {
  grid-column: 1 / -1;
}
.vlab-toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.vlab-toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.vlab-toast.err {
  background: var(--red);
}

.vlab-skip-row {
  display: none;
  justify-content: center;
  padding: 0 16px 8px;
}
.vlab-skip-row.vlab-skip-visible {
  display: flex;
}
.vlab-skip-row button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  padding: 8px;
}

@media (min-width: 960px) {
  .vlab-shell:has(.vlab-actions button) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(440px, 36vw);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header"
      "main dock";
  }
  .vlab-shell:has(.vlab-actions button) .vlab-top {
    grid-area: header;
  }
  .vlab-shell:has(.vlab-actions button) .vlab-card-wrap {
    grid-area: main;
  }
  .vlab-shell:has(.vlab-actions button) .vlab-decision-dock {
    grid-area: dock;
    position: relative;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    border-top: none;
    border-left: 1px solid var(--line);
    box-shadow: -4px 0 24px rgba(0, 26, 93, 0.04);
    display: flex;
    flex-direction: column;
  }
  .vlab-shell:has(.vlab-actions button) .vlab-note-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 0;
  }
  .vlab-shell:has(.vlab-actions button) .vlab-note-row textarea {
    flex: 1;
    min-height: 160px;
  }
  .vlab-shell:has(.vlab-actions button) .vlab-actions {
    grid-template-columns: 1fr;
    padding: 12px 16px calc(16px + var(--safe-b));
  }
  .vlab-shell:has(.vlab-actions button) .vlab-skip-row {
    display: none;
  }
}

.vlab-funnel-mobile .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.vlab-funnel-mobile .row.highlight {
  color: var(--purple);
  font-weight: 600;
}
.vlab-funnel-mobile .n {
  font-family: Poppins, sans-serif;
  font-weight: 600;
}
.vlab-overview .hint {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0;
  line-height: 1.45;
}
.vlab-overview .form-list {
  font-size: 13px;
  padding-left: 18px;
  margin: 0 0 16px;
}
.vlab-cta {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--purple);
  color: #fff;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  font-size: 15px;
}
.vlab-pkg-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.vlab-pkg-btn strong {
  display: block;
  font-family: Poppins, sans-serif;
  font-size: 15px;
  margin-bottom: 4px;
}
.vlab-pkg-btn span {
  font-size: 12px;
  color: var(--purple);
}
.vlab-pkg-btn small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}
.vlab-pkg-btn.highlight {
  border-color: var(--purple);
  background: linear-gradient(180deg, #faf5ff 0%, #fff 100%);
  box-shadow: 0 0 0 1px rgba(125, 44, 206, 0.08);
}
.vlab-highlight-badge,
.vlab-ref-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.vlab-highlight-badge {
  background: #ede3f7;
  color: var(--purple);
}
.vlab-ref-badge {
  background: #eef2ff;
  color: #4338ca;
}
.vlab-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 12px;
  margin-bottom: 4px;
}
.vlab-meaning {
  font-size: 14px;
  line-height: 1.5;
}
.vlab-ko-title {
  font-family: Poppins, sans-serif;
  font-size: 17px;
  margin: 8px 0;
  line-height: 1.3;
}
.vlab-meta {
  font-size: 13px;
  color: var(--muted);
}
.vlab-review-hint {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e8;
  border: 1px solid #f0dfa0;
  font-size: 13px;
  line-height: 1.45;
  color: #6b4f00;
}
.vlab-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.vlab-reason-pill {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.vlab-thread-title {
  font-family: Poppins, sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--navy);
}
.vlab-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vlab-thread-msg {
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.vlab-thread-msg.user {
  border-left: 3px solid #94a3b8;
}
.vlab-thread-msg.assistant {
  border-left: 3px solid #cbd5e1;
}
.vlab-thread-msg.signal {
  border-color: var(--purple);
  border-left-width: 3px;
  border-left-color: var(--purple);
  background: #faf7ff;
}
.vlab-thread-msg.other_signal {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}
.vlab-thread-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.vlab-thread-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.vlab-thread-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--soft);
  color: var(--purple);
}
.vlab-thread-msg.other_signal .vlab-thread-tag {
  color: #b45309;
  background: #fef3c7;
}
.vlab-thread-reason {
  font-size: 10px;
  color: var(--muted);
}
.vlab-thread-text {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.vlab-more-evidence {
  margin-top: 14px;
  font-size: 12px;
}
.vlab-more-evidence summary {
  cursor: pointer;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 8px;
}
.vlab-ev-item {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.vlab-ev-item.warn {
  border-color: #fcd34d;
}
.vlab-ev-item p {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.vlab-mode-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.vlab-epistemic {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-right: 6px;
}
.vlab-epistemic.observed {
  background: #e8f5ee;
  color: #1a6b42;
}
.vlab-epistemic.inferred {
  background: #eef2ff;
  color: #3730a3;
}
.vlab-epistemic.proposed {
  background: #fff7ed;
  color: #c2410c;
}
.vlab-structure {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0 12px;
}
.vlab-list {
  margin: 6px 0 12px 18px;
  font-size: 13px;
  line-height: 1.45;
}
.vlab-list li {
  margin-bottom: 4px;
}
.vlab-note-row {
  padding: 10px 16px 0;
  max-width: none;
  margin: 0;
}
.vlab-note-row.hidden {
  display: none;
}
.vlab-note-row label {
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.vlab-note-row textarea {
  width: 100%;
  min-height: clamp(140px, 22vh, 180px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
  font-family: inherit;
  resize: vertical;
}
@media (min-width: 821px) {
  .vlab-note-row textarea {
    min-height: 120px;
  }
}
.vlab-case-kind {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vlab-no-formation {
  border-left: 4px solid var(--green);
  background: #f0fdf4;
}
.vlab-checklist {
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0;
}
.vlab-checklist li {
  margin-bottom: 6px;
}
.vlab-link-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px 0;
}
