/* ---------- Base ---------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #fafafa;
  color: #111827;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #2563eb;
  text-decoration: none;
}
a:hover { text-decoration: underline; }


/* ---------- Upload page (drop zone) ---------- */

.dropzone-wrapper {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 2rem;
}

.dropzone {
  display: grid;
  place-items: center;
  width: min(640px, 92vw);
  aspect-ratio: 5/3;
  border: 2px dashed #d1d5db;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: #2563eb;
  background: #eff6ff;
}
.dropzone.is-dragging {
  transform: scale(1.01);
}

.dropzone input[type=file] {
  display: none;
}

.dropzone-inner {
  text-align: center;
}

.dropzone-icon {
  font-size: 3rem;
  line-height: 1;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.dropzone-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.4rem;
}

.dropzone-sub {
  font-size: 1rem;
  color: #6b7280;
}


/* ---------- Report page ---------- */

.report {
  max-width: 720px;
  margin: 3.5rem auto;
  padding: 0 1.5rem 4rem;
}

.filename {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 0.4rem;
}

.report h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.breakdown {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0 0 2.5rem;
}

.issue-group {
  margin-bottom: 1.75rem;
  padding-left: 1rem;
  border-left: 3px solid #d1d5db;
}

.issue-group.sev-high   { border-left-color: #dc2626; }
.issue-group.sev-medium { border-left-color: #d97706; }
.issue-group.sev-low    { border-left-color: #9ca3af; }

.issue-group h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #111827;
}

.issue-group .count {
  color: #9ca3af;
  font-weight: 400;
  font-size: 0.9rem;
  margin-left: 0.25rem;
}

.issue-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.issue-group li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.95rem;
}
.issue-group li:last-child {
  border-bottom: none;
}

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

.loc {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #6b7280;
}

.val {
  color: #111827;
  font-weight: 500;
  text-align: right;
}

.why {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.45;
}

.back {
  margin-top: 3rem;
  font-size: 0.95rem;
}


/* ---------- Possible fraud total card ---------- */

.fraud-total {
  margin-top: 3rem;
  padding: 1.75rem 2rem;
  background: #fef3c7;
  border-left: 4px solid #d97706;
  border-radius: 12px;
}

.fraud-total-label {
  font-size: 0.8rem;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.fraud-total-amount {
  font-size: 2.25rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.fraud-total-note {
  font-size: 0.85rem;
  color: #78350f;
  line-height: 1.45;
}


/* ---------- Brand (logo + wordmark) ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #111827;
}

.brand-small .brand-mark { width: 26px; height: 26px; }
.brand-small .brand-name { font-size: 1.05rem; }


/* ---------- App header (shown on the upload page) ---------- */

.app-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-tool-link {
  font-size: 0.9rem;
  color: #2563eb;
  text-decoration: none;
}

.admin-tool-link:hover { text-decoration: underline; }


/* ---------- Login page ---------- */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 2rem;
}

.landing {
  width: min(560px, 92vw);
  text-align: center;
}

.landing .brand {
  margin-bottom: 1.5rem;
}

.tagline {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: #111827;
  margin: 0 0 0.75rem;
}

.description {
  font-size: 1rem;
  line-height: 1.55;
  color: #4b5563;
  margin: 0;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 1.75rem;
  width: min(380px, 92vw);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  text-align: center;
}

.login-card input[type=password] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  background: #fafafa;
  font-family: inherit;
}

.login-card input[type=password]:focus {
  outline: none;
  border-color: #2563eb;
  background: white;
}

.login-card button {
  width: 100%;
  padding: 0.75rem;
  background: #111827;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.login-card button:hover { background: #1f2937; }

.login-card .error {
  color: #dc2626;
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
}


/* ---------- Loading overlay (while a file is being checked) ---------- */

.check-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 250, 0.97);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 100;
}

body.is-checking .check-overlay {
  display: flex;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.check-overlay-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.check-overlay-sub {
  font-size: 0.95rem;
  color: #6b7280;
  margin: 0;
}

.overlay-brand {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
}


/* ---------- Admin page ---------- */

.admin {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.admin h1 {
  font-size: 1.75rem;
  margin: 0 0 1.5rem;
}

.admin h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  color: #374151;
}

.admin-section {
  margin-bottom: 2.5rem;
}

.new-code-card {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.new-code-label {
  font-size: 0.9rem;
  color: #065f46;
  margin-bottom: 0.5rem;
}

.new-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #064e3b;
  user-select: all;
}

.create-code-form {
  display: grid;
  gap: 0.85rem;
  max-width: 460px;
  background: white;
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
}

.create-code-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #4b5563;
}

.create-code-form input[type=text],
.create-code-form select {
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
}

.create-code-form .checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #111827;
}

.create-code-form button {
  margin-top: 0.5rem;
  padding: 0.65rem;
  background: #2563eb;
  color: white;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.codes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.codes-table th,
.codes-table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #f3f4f6;
}

.codes-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #6b7280;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.codes-table tr:last-child td {
  border-bottom: 0;
}

.code-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.25rem;
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pill.status-active   { background: #d1fae5; color: #065f46; }
.status-pill.status-expired  { background: #fee2e2; color: #991b1b; }
.status-pill.status-revoked  { background: #f3f4f6; color: #6b7280; }

.inline-form { display: inline; }

.link-button {
  background: none;
  border: 0;
  color: #dc2626;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.muted { color: #9ca3af; }
