* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #111827;
  background: #f5f5f3;
}

#app {
  height: 100vh;
}

button {
  font-family: inherit;
}

/* ─── Layout shells ───────────────────────────────────────────── */

.portal-screen {
  height: 100vh;
  background: #f5f5f3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  overflow: hidden;
}

.portal-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f5f5f3;
  overflow: hidden;
}

.max-w {
  max-width: 768px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Card ────────────────────────────────────────────────────── */

.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  border: 1px solid #f3f4f6;
}

.card.card-error {
  border-color: #fca5a5;
}

.card-centered {
  text-align: center;
  max-width: 420px;
  width: 100%;
  padding: 40px;
}

/* ─── Top nav ─────────────────────────────────────────────────── */

.topnav {
  flex-shrink: 0;
  background: #f5f5f3;
  border-bottom: 1px solid #e5e7eb;
  z-index: 10;
}

.topnav-inner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #4b5563;
  background: transparent;
  border: none;
  cursor: pointer;
}

.back-btn:hover {
  color: #111827;
}

.secure-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #6b7280;
}

.secure-badge .icon {
  color: #059669;
}

/* ─── Content ─────────────────────────────────────────────────── */

.content-scroll {
  flex: 1;
  overflow-y: auto;
}

.content-inner {
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Audit info card ─────────────────────────────────────────── */

.audit-type-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  margin-bottom: 12px;
}

.audit-title {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
}

.audit-supplier {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 4px;
}

.audit-description {
  font-size: 14px;
  color: #9ca3af;
  margin-top: 12px;
  line-height: 1.6;
}

/* ─── Skeleton ────────────────────────────────────────────────── */

.skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-card {
  display: flex;
  gap: 16px;
}

.skeleton-badge {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f3f4f6;
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 16px;
  background: #f3f4f6;
  border-radius: 4px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }

.skeleton-box {
  height: 96px;
  background: #f9fafb;
  border-radius: 8px;
  margin-top: 16px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Question card ───────────────────────────────────────────── */

.question-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}

.question-card.has-error {
  border-color: #fca5a5;
}

.question-body {
  display: flex;
  gap: 16px;
  min-width: 0;
}

.q-number {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  flex-shrink: 0;
  margin-top: 2px;
}

.q-content {
  flex: 1;
  min-width: 0;
}

.q-text {
  font-size: 16px;
  font-weight: 400;
  color: #111827;
  line-height: 1.6;
  margin: 0;
}

.q-required {
  color: #ef4444;
  margin-left: 4px;
}

.q-input-area {
  margin-top: 16px;
}

.q-error {
  margin-top: 8px;
  font-size: 12px;
  color: #ef4444;
}

textarea.q-textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 12px 16px;
  font-size: 14px;
  color: #1f2937;
  resize: none;
  font-family: inherit;
}

textarea.q-textarea:focus {
  outline: none;
  border-color: #9ca3af;
}

textarea.q-textarea::placeholder {
  color: #9ca3af;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.option-label:hover {
  color: #111827;
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2d4a1e;
  cursor: pointer;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 96px;
  border-radius: 8px;
  border: 2px dashed #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.15s;
}

.file-drop:hover {
  border-color: #9ca3af;
}

.file-drop.evidence-drop {
  height: 112px;
}

.file-drop input[type="file"] {
  display: none;
}

.file-drop-label {
  font-size: 14px;
  color: #6b7280;
}

.file-drop-name {
  font-size: 12px;
  color: #4b5563;
  font-weight: 500;
}

.evidence-icon {
  width: 24px;
  height: 24px;
  color: #9ca3af;
}

/* ─── Evidence section ────────────────────────────────────────── */

.evidence-title {
  font-size: 16px;
  font-weight: 400;
  color: #111827;
  line-height: 1.6;
  margin: 0 0 16px;
}

.evidence-subtitle {
  color: #9ca3af;
  font-size: 14px;
  font-weight: 400;
  margin-left: 8px;
}

.evidence-file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  padding: 0;
}

.evidence-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
}

.evidence-file-name {
  font-size: 14px;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80%;
}

.evidence-remove-btn {
  color: #9ca3af;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.evidence-remove-btn:hover {
  color: #ef4444;
}

.evidence-error-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  padding: 0;
}

.evidence-error-item {
  font-size: 12px;
  color: #ef4444;
}

/* ─── Footer ──────────────────────────────────────────────────── */

.footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

.footer-inner {
  padding: 16px;
}

.submit-btn {
  width: 100%;
  background: #2d4a1e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Success / error states ──────────────────────────────────── */

.state-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #d1fae5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.state-icon-circle .icon {
  font-size: 28px;
  color: #059669;
}

.state-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}

.state-desc {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.state-img {
  display: block;
  margin: 0 auto 16px;
  width: 160px;
  height: 160px;
}

/* ─── Spinner ─────────────────────────────────────────────────── */

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Inline icon helper ──────────────────────────────────────── */

.icon-svg {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}
