*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:       #00995d;
  --green-dark:  #007a4a;
  --green-deep:  #004e4c;
  --green-light: #b1d34b;
  --orange:      #f47920;
  --white:       #fafcfa;
  --gray-50:     #f4f7f5;
  --gray-100:    #e6ede9;
  --gray-300:    #b0c0b8;
  --gray-500:    #6b8077;
  --gray-700:    #374740;
  --gray-900:    #1a2420;
}

html { font-size: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ─────────────────────────────── */
header {
  background: var(--green-deep);
  padding: 1.125rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
header img { height: 2.75rem; }
.header-divider {
  width: 1px;
  height: 2rem;
  background: rgba(255,255,255,0.25);
}
.header-label {
  color: rgba(255,255,255,0.75);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── MAIN LAYOUT ─────────────────────────── */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 44rem 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  padding: 3rem 1.5rem;
  gap: 0;
  position: relative;
  overflow: hidden;
}

main::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 45%;
  background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
  z-index: 0;
}

main::after {
  content: '';
  position: absolute;
  left: -5rem; bottom: -5rem;
  width: 26.25rem; height: 26.25rem;
  border-radius: 50%;
  background: rgba(177,211,75,0.12);
  z-index: 0;
}

.deco-circle {
  position: absolute;
  right: 3.75rem; top: -3.75rem;
  width: 18.75rem; height: 18.75rem;
  border-radius: 50%;
  background: rgba(0,153,93,0.06);
  z-index: 0;
}

/* ── LEFT PANEL ──────────────────────────── */
.left-panel {
  grid-column: 1;
  z-index: 1;
  padding: 0 3rem 0 3.5rem;
  color: #fff;
}
.left-panel h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.875rem;
  text-wrap: pretty;
}
.left-panel h1 span { color: var(--green-light); }
.left-panel > p {
  font-size: 0.906rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.75);
  max-width: 16.875rem;
}

.trust-badges {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.8);
}
.trust-badge-icon {
  width: 2rem; height: 2rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── CARD ────────────────────────────────── */
.card {
  grid-column: 2;
  z-index: 2;
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 1.5rem 5rem rgba(0,78,76,0.18), 0 0.25rem 1rem rgba(0,0,0,0.06);
  padding: 2.5rem 2.75rem;
  min-height: 38rem;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}
.card-subtitle {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 1.75rem;
}

/* ── TABS ────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--gray-50);
  border-radius: 0.625rem;
  padding: 0.25rem;
  margin-bottom: 1.75rem;
}
.tab {
  flex: 1;
  padding: 0.5625rem 0;
  border: none;
  background: transparent;
  border-radius: 0.4375rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
}
.tab.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 0.375rem rgba(0,0,0,0.1);
}
.tab:hover:not(.active) { color: var(--gray-700); }

/* ── FIELDS ──────────────────────────────── */
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.tab-content { flex: 1; }

.input-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}
.code-input {
  width: 100%;
  padding: 0.8125rem 1rem;
  border: 1.5px solid var(--gray-100);
  border-radius: 0.625rem;
  font-family: 'Inter', monospace;
  font-size: 0.875rem;
  color: var(--gray-900);
  background: var(--gray-50);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.03em;
}
.code-input::placeholder { color: var(--gray-300); font-size: 0.8125rem; }
.code-input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 0.1875rem rgba(0,153,93,0.1);
}
.char-count {
  position: absolute;
  right: 0.75rem; bottom: 0.75rem;
  font-size: 0.6875rem;
  color: var(--gray-300);
}

/* ── HINT ────────────────────────────────── */
.hint {
  display: flex;
  align-items: flex-start;
  gap: 0.4375rem;
  font-size: 0.75rem;
  color: var(--gray-300);
  line-height: 0.55;
  margin-bottom: 1rem;
}
.hint svg { flex-shrink: 0; margin-top: -3.5px; }

/* ── DROP ZONE ───────────────────────────── */
.dropzone {
  border: 2px dashed var(--gray-100);
  border-radius: 0.75rem;
  padding: 2.25rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
  margin-bottom: 1.25rem;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--green);
  background: rgba(0,153,93,0.04);
}
.dropzone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.dropzone-icon {
  width: 2.75rem; height: 2.75rem;
  background: rgba(0,153,93,0.1);
  border-radius: 0.625rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
}
.dropzone p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.dropzone strong { color: var(--green); font-weight: 600; }
.dropzone .file-hint { font-size: 0.6875rem; color: var(--gray-300); margin-top: 0.375rem; }

.file-attached {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(0,153,93,0.06);
  border: 1.5px solid rgba(0,153,93,0.2);
  border-radius: 0.625rem;
  margin-bottom: 1.25rem;
}
.file-attached-icon {
  width: 2.25rem; height: 2.25rem;
  background: var(--green);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-attached-info { flex: 1; min-width: 0; }
.file-attached-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-attached-size { font-size: 0.6875rem; color: var(--gray-500); margin-top: 0.125rem; }
.btn-remove-file {
  background: none; border: none; cursor: pointer;
  padding: 0.25rem; color: var(--gray-300);
  display: flex; align-items: center;
  transition: color 0.15s;
}
.btn-remove-file:hover { color: #e05252; }

/* ── SUBMIT ──────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 0.875rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 0.625rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-top: auto;
}
.btn-submit:hover:not(:disabled) {
  background: var(--green-dark);
  box-shadow: 0 0.25rem 1rem rgba(0,153,93,0.35);
}
.btn-submit:active:not(:disabled) { transform: scale(0.98); }
.btn-submit:disabled {
  background: var(--gray-100);
  color: var(--gray-300);
  cursor: not-allowed;
}

/* ── LOADING ─────────────────────────────── */
.spinner {
  width: 1.125rem; height: 1.125rem;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULT ──────────────────────────────── */
.result {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: fadeUp 0.4s ease;
  padding: 0.75rem 0;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-icon {
  width: 4.5rem; height: 4.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}
.result-icon.success { background: rgba(0,153,93,0.1); }
.result-icon.failure { background: rgba(224,82,82,0.1); }

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.875rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.result-badge.success { background: rgba(0,153,93,0.1); color: var(--green); }
.result-badge.failure { background: rgba(224,82,82,0.1); color: #e05252; }

.result h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}
.result > p {
  font-size: 0.84375rem;
  color: var(--gray-500);
  line-height: 1.6;
  max-width: 17.5rem;
  margin: 0 auto 1.5rem;
}

.result-detail {
  width: 100%;
  background: var(--gray-50);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  text-align: left;
  margin-bottom: 1.25rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3125rem 0;
  font-size: 0.78125rem;
  color: var(--gray-700);
}
.detail-row:not(:last-child) {
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 0.5625rem;
  margin-bottom: 0.25rem;
}
.detail-label { color: var(--gray-500); }
.detail-value { font-weight: 600; }
.detail-value.green { color: var(--green); }
.detail-value.red   { color: #e05252; }
.detail-value.truncate {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-value.mono { font-family: monospace; font-size: 0.71875rem; }

.warning-box {
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: rgba(244,121,32,0.07);
  border: 1px solid rgba(244,121,32,0.2);
  border-radius: 0.625rem;
  font-size: 0.78125rem;
  color: #8a4a10;
  line-height: 1.55;
  margin-bottom: 1rem;
  text-align: left;
}
.warning-box strong { color: var(--orange); }

.btn-retry {
  background: none;
  border: 1.5px solid var(--gray-100);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-500);
  padding: 0.5625rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0.25rem;
}
.btn-retry:hover { border-color: var(--green); color: var(--green); }

/* ── SCAN ERROR SCREEN ───────────────────── */
.result-badge.scan-error { background: rgba(244,121,32,0.1); color: var(--orange); }
.result-icon.scan-error  { background: rgba(244,121,32,0.1); }

.scan-tips {
  width: 100%;
  background: var(--gray-50);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  text-align: left;
  margin-bottom: 1.25rem;
}
.scan-tips-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.scan-tips ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.scan-tips li {
  font-size: 0.78125rem;
  color: var(--gray-500);
  padding-left: 1rem;
  position: relative;
  line-height: 1.5;
}
.scan-tips li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--orange);
  font-weight: 700;
}

.scan-error-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.btn-scan-retry {
  width: 100%;
  padding: 0.875rem;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 0.625rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-scan-retry:hover {
  background: #d9660e;
  box-shadow: 0 0.25rem 1rem rgba(244,121,32,0.35);
}
.btn-scan-manual {
  background: none;
  border: 1.5px solid var(--gray-100);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-500);
  padding: 0.5625rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.btn-scan-manual:hover { border-color: var(--orange); color: var(--orange); }

/* ── FOOTER ──────────────────────────────── */
footer {
  padding: 1rem 2.5rem;
  background: var(--green-deep);
  text-align: center;
  font-size: 0.71875rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.02em;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 56.25em) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 2rem 1rem;
  }
  main::before { display: none; }
  .left-panel {
    grid-column: 1;
    background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
    margin: -2rem -1rem 0;
    padding: 2rem 1.5rem 2.25rem;
    border-radius: 0 0 1.25rem 1.25rem;
  }
  .card { grid-column: 1; margin-top: -1.25rem; }
  header { padding: 0.875rem 1.25rem; }
  header img { height: 2.25rem; }
}
