/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black: #111111;
  --dark: #333333;
  --mid: #666666;
  --light: #999999;
  --border: #e0e0e0;
  --bg-subtle: #f7f7f7;
  --white: #ffffff;
  --error: #cc0000;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
}

/* === Flash Messages === */
.flash {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  max-width: 500px;
  width: calc(100% - 2rem);
  animation: flashIn 0.3s ease;
}

.flash-error {
  background: var(--black);
  color: var(--white);
}

.flash-close {
  background: none;
  border: none;
  color: var(--light);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.flash-close:hover {
  color: var(--white);
}

@keyframes flashIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Landing Page === */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem 3rem;
}

.landing-content {
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.landing-title {
  font-size: 6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
  color: var(--black);
}

.title-light {
  font-weight: 300;
  font-style: italic;
}

.landing-subtitle {
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  color: var(--mid);
  margin-bottom: 1.25rem;
}

/* === Landing Auth Links === */
.landing-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.landing-auth a {
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s ease;
}

.landing-auth a:hover {
  color: var(--black);
}

.landing-auth-sep {
  color: var(--light);
}

.landing-auth-link-btn {
  background: none;
  border: none;
  color: var(--mid);
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.landing-auth-link-btn:hover {
  color: var(--black);
}

/* === Upload Form === */
.upload-form {
  text-align: left;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--white);
}

.upload-area:hover {
  border-color: var(--dark);
  background: var(--bg-subtle);
}

.upload-area.dragover {
  border-color: var(--black);
  background: var(--bg-subtle);
  border-style: solid;
}

.upload-icon {
  color: var(--light);
  margin-bottom: 1rem;
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
  color: var(--dark);
}

.upload-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.upload-hint {
  font-size: 0.875rem;
  color: var(--light);
  margin-bottom: 0.75rem;
}

.upload-formats {
  font-size: 0.75rem;
  color: var(--light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.file-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

/* === File Preview === */
.file-preview {
  margin-top: 0.5rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dark);
}

.file-info svg {
  flex-shrink: 0;
  color: var(--mid);
}

.file-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-remove {
  background: none;
  border: none;
  color: var(--light);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.file-remove:hover {
  color: var(--black);
}

/* === Form Elements === */
.form-row {
  margin-top: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.form-select:hover {
  border-color: var(--dark);
}

.form-select:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* === Math Challenge === */
.math-challenge-hint {
  font-size: 0.9375rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.form-input:hover {
  border-color: var(--dark);
}

.form-input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.form-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--medium);
  margin-top: 0.375rem;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  margin-top: 1.25rem;
  background: var(--black);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--dark);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--light);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--dark);
}

/* === Footer === */
.landing-footer {
  margin-top: 3rem;
  text-align: center;
}

.landing-footer p {
  font-size: 0.75rem;
  color: var(--light);
}

.disclaimer {
  font-size: 0.6875rem;
  color: var(--light);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--light);
  text-align: center;
  margin-top: 1rem;
}

/* === Page Topbar === */
.page-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-topbar-three {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.topbar-left {
  justify-self: start;
}

.topbar-right {
  justify-self: end;
}

.topbar-email {
  font-size: 0.8125rem;
  color: var(--light);
}

.brand-link {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--black);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-light {
  font-weight: 300;
  font-style: italic;
}

/* === Scan Footer === */
.scan-footer {
  margin-top: 2.5rem;
  text-align: center;
}

.scan-footer p {
  font-size: 0.75rem;
  color: var(--light);
}

/* === Status Page === */
.status-page {
  min-height: 100vh;
  padding: 2rem;
  max-width: 680px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--black);
}

.status-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.status-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--black);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 100px;
  white-space: nowrap;
}

.status-pending {
  background: var(--bg-subtle);
  color: var(--mid);
}

.status-processing {
  background: var(--black);
  color: var(--white);
}

.status-completed {
  background: var(--bg-subtle);
  color: var(--black);
  border: 1px solid var(--border);
}

.status-failed {
  background: var(--white);
  color: var(--error);
  border: 1px solid var(--error);
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === Scan Meta === */
.scan-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.meta-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--light);
}

.meta-value {
  font-size: 0.875rem;
  color: var(--dark);
  word-break: break-all;
}

/* === Progress === */
.progress-section {
  margin-top: 1.5rem;
  text-align: center;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--black);
}

.progress-waiting {
  width: 30%;
  animation: progressPulse 2s ease-in-out infinite;
}

.progress-active {
  width: 100%;
  animation: progressSweep 1.5s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--black) 50%,
    var(--border) 100%
  );
  background-size: 200% 100%;
}

@keyframes progressPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes progressSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.75rem;
}

.progress-hint {
  font-size: 0.8125rem;
  color: var(--light);
  line-height: 1.5;
}

/* === Error === */
.error-section {
  margin-top: 1.5rem;
  text-align: center;
}

.error-message {
  font-size: 0.9375rem;
  color: var(--error);
  margin-bottom: 1.5rem;
}

.error-section .btn-primary {
  width: auto;
  display: inline-flex;
}

/* === Results === */
.results-section {
  margin-top: 1.5rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.results-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.confidence-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mid);
  background: var(--bg-subtle);
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
}

.results-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.result-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row-full {
  grid-template-columns: 1fr;
}

.result-row-full .result-key {
  border-bottom: 1px solid var(--border);
  border-right: none;
}

.result-key {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mid);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
}

.result-value {
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--dark);
  word-break: break-word;
}

/* === Nested Tables === */
.nested-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.nested-table th {
  text-align: left;
  padding: 0.375rem 0.5rem;
  font-weight: 600;
  color: var(--mid);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nested-table td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--dark);
}

.nested-table tr:last-child td {
  border-bottom: none;
}

.result-list {
  list-style: none;
  padding: 0;
}

.result-list li {
  padding: 0.25rem 0;
}

.result-list li::before {
  content: "\2022";
  color: var(--light);
  margin-right: 0.5rem;
}

.nested-object {
  display: flex;
  flex-direction: column;
}

.nested-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.nested-row:last-child {
  border-bottom: none;
}

.nested-key {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mid);
  min-width: 120px;
}

.nested-value {
  font-size: 0.8125rem;
  color: var(--dark);
}

/* === Results Actions === */
.results-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

.results-actions .btn-primary {
  width: auto;
  margin-top: 0;
}

/* === Scan URL === */
.scan-url {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.url-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--light);
  margin-bottom: 0.375rem;
}

.url-value {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mid);
  background: var(--bg-subtle);
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  user-select: all;
}

.btn-copy-link {
  margin-left: 0.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  vertical-align: middle;
}

/* === Legal Pages === */
.legal-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.legal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 0.25rem;
}

.legal-updated {
  font-size: 0.8125rem;
  color: var(--light);
  margin-bottom: 2rem;
}

.legal-content h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--black);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.legal-content p {
  font-size: 0.875rem;
  color: var(--dark);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.legal-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.legal-content li {
  font-size: 0.875rem;
  color: var(--dark);
  line-height: 1.7;
  margin-bottom: 0.25rem;
}

/* === Landing Sections === */
.landing-section {
  width: 100%;
  max-width: 640px;
  margin-top: 3rem;
  text-align: left;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.25rem;
  text-align: center;
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.step {
  text-align: center;
}

.step-number {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.step-heading {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.25rem;
}

.step-text {
  font-size: 0.8125rem;
  color: var(--mid);
  line-height: 1.5;
}

/* Document Types */
.doc-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.doc-type {
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.doc-type-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.125rem;
}

.doc-type-desc {
  font-size: 0.75rem;
  color: var(--mid);
  line-height: 1.4;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:first-child {
  border-top: 1px solid var(--border);
}

.faq-question {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--black);
  padding: 0.875rem 0;
  cursor: pointer;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: "+";
  float: right;
  font-size: 1.125rem;
  font-weight: 300;
  color: var(--light);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-question::after {
  content: "\2212";
}

.faq-answer {
  font-size: 0.8125rem;
  color: var(--mid);
  line-height: 1.6;
  padding-bottom: 0.875rem;
}

/* === Upgrade Banner === */
.upgrade-banner {
  text-align: center;
  padding: 1rem 1.5rem;
}

.upgrade-banner-link {
  font-size: 0.75rem;
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s ease;
}

.upgrade-banner-link:hover {
  color: var(--dark);
  text-decoration: underline;
}

/* === Site Footer === */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
}

.site-footer p {
  font-size: 0.75rem;
  color: var(--light);
}

/* === Landing Auth Email === */
.landing-auth-email {
  width: 100%;
  font-size: 0.8125rem;
  color: var(--light);
  text-decoration: none;
  margin-bottom: 0.125rem;
  transition: color 0.15s ease;
}

.landing-auth-email:hover {
  color: var(--dark);
}

/* === Footer Links === */
.footer-link {
  color: var(--light);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--dark);
}

/* === Compare View === */
.compare-page-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.compare-page-title:first-of-type {
  margin-top: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.compare-panel {
  min-width: 0;
}

.compare-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mid);
  margin-bottom: 0.75rem;
}

.compare-image-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.compare-image {
  width: 100%;
  height: auto;
  display: block;
}

.status-page:has(.compare-grid) {
  max-width: 1100px;
}

.status-page:has(.pricing-cards) {
  max-width: 1080px;
}

.status-page:has(.demo-grid) {
  max-width: 820px;
}

/* === Demo Section === */
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.demo-panel {
  min-width: 0;
}

.demo-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--light);
  margin-bottom: 0.5rem;
}

.demo-receipt {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--bg-subtle);
  font-size: 0.8125rem;
  color: var(--dark);
}

.demo-receipt-header {
  font-weight: 700;
  font-size: 0.9375rem;
  text-align: center;
  margin-bottom: 0.125rem;
}

.demo-receipt-sub {
  font-size: 0.75rem;
  color: var(--light);
  text-align: center;
}

.demo-receipt-divider {
  border-top: 1px dashed var(--border);
  margin: 0.625rem 0;
}

.demo-receipt-line {
  display: flex;
  justify-content: space-between;
  padding: 0.125rem 0;
  font-size: 0.8125rem;
}

.demo-receipt-total {
  font-weight: 700;
}

.demo-json {
  background: var(--black);
  color: #cccccc;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
}

@media (max-width: 640px) {
  .demo-grid {
    grid-template-columns: 1fr;
  }
}

/* === Cookie Banner === */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--black);
  color: var(--white);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 1000;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.cookie-banner p {
  max-width: 600px;
  margin: 0;
}

.cookie-link {
  color: var(--white);
  text-decoration: underline;
}

.btn-cookie {
  background: var(--white);
  color: var(--black);
  border: none;
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.btn-cookie:hover {
  opacity: 0.85;
}

/* === Site Nav === */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 2rem;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--black);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  font-size: 0.8125rem;
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--black);
}

.nav-link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 0;
}

.nav-email {
  font-size: 0.75rem;
  color: var(--light);
}

/* === Flash Notice === */
.flash-notice {
  background: var(--dark);
  color: var(--white);
}

/* === Auth Pages === */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--mid);
  margin-bottom: 2rem;
}

.auth-form {
  text-align: left;
}

.auth-hint {
  font-size: 0.8125rem;
  color: var(--light);
  margin-top: 1.5rem;
}

.auth-link {
  color: var(--dark);
  text-decoration: underline;
}

.form-input-code {
  text-align: center;
  font-size: 1.5rem;
  font-family: var(--mono);
  letter-spacing: 0.5em;
  padding: 0.75rem;
}

/* === Scan History === */
.history-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem;
}

.history-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.5rem;
}

.history-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--light);
  font-size: 0.9375rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.history-item:hover {
  border-color: var(--dark);
}

.history-item-link {
  flex: 1;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dark);
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--light);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--light);
  font-size: 0.75rem;
  font-family: var(--font);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete:hover {
  border-color: var(--error);
  color: var(--error);
}

/* === User Dropdown === */
.user-dropdown {
  position: relative;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.8125rem;
  color: var(--mid);
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.15s ease;
}

.dropdown-trigger:hover {
  color: var(--black);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.dropdown-menu-open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  color: var(--dark);
  text-decoration: none;
  text-align: left;
  transition: background 0.1s ease;
}

.dropdown-item:hover {
  background: var(--bg-subtle);
}

.dropdown-item-btn {
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.dropdown-menu form {
  margin: 0;
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.pagination-link:hover:not(.pagination-disabled) {
  border-color: var(--dark);
  background: var(--bg-subtle);
}

.pagination-disabled {
  color: var(--light);
  cursor: default;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--mid);
}

/* === Profile Page === */
.profile-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.profile-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.5rem;
}

.profile-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.profile-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.profile-form .profile-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.profile-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 1rem;
}

.profile-coming-soon {
  font-size: 0.9375rem;
  color: var(--light);
  text-align: center;
  padding: 2rem 1rem;
  background: var(--bg-subtle);
  border-radius: 8px;
}

.profile-section-billing {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* === Billing Section === */
.billing-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.billing-label {
  font-size: 0.875rem;
  color: var(--mid);
}

.plan-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 100px;
}

.plan-badge-free {
  background: var(--bg-subtle);
  color: var(--mid);
}

.plan-badge-pro {
  background: var(--black);
  color: var(--white);
}

.plan-badge-max {
  background: var(--dark);
  color: var(--white);
}

.plan-badge-upgrade {
  background: #fff0f0;
  color: var(--error);
  text-decoration: none;
  cursor: pointer;
}

.plan-badge-upgrade:hover {
  background: #ffe0e0;
}

.billing-usage {
  margin-bottom: 1.25rem;
}

.usage-text {
  font-size: 0.8125rem;
  color: var(--mid);
  margin-bottom: 0.5rem;
}

.usage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--black);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.billing-actions {
  display: flex;
  gap: 0.75rem;
}

/* === Pricing Page === */
.pricing-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

.pricing-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pricing-card-highlighted {
  border-color: var(--black);
  border-width: 2px;
  position: relative;
}

.pricing-plan-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.25rem;
}

.pricing-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--mid);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  width: 100%;
  text-align: left;
}

.pricing-features li {
  font-size: 0.8125rem;
  color: var(--dark);
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features li::before {
  content: "\2713";
  color: var(--mid);
  margin-right: 0.5rem;
  font-weight: 600;
}

.pricing-cta {
  margin-top: auto;
  width: 100%;
}

.pricing-cta.btn-primary {
  margin-top: auto;
}

/* === Scans Filter Bar === */
.scans-filter-bar {
  margin-bottom: 1.5rem;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 160px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.filter-date {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

.filter-date:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.filter-clear {
  font-size: 0.8125rem;
  color: var(--mid);
  text-decoration: none;
  padding: 0.5rem 0.5rem;
  transition: color 0.15s ease;
}

.filter-clear:hover {
  color: var(--black);
}

.sort-toggle {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--mid);
  text-decoration: none;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sort-toggle:hover {
  border-color: var(--dark);
  color: var(--black);
  background: var(--bg-subtle);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-danger {
  background: var(--error);
  color: var(--white);
  border: none;
}

.btn-danger:hover {
  background: #aa0000;
}

/* === API Key Section === */
.api-key-reveal {
  background: #fffbe6;
  border: 1px solid #e6d85e;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.api-key-code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--white);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  word-break: break-all;
}

.api-key-warning {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #8a6d00;
}

.api-key-info {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.api-key-detail {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.api-key-detail code {
  font-family: var(--mono);
  font-size: 0.875rem;
}

.api-key-detail span {
  font-size: 0.875rem;
  color: var(--dark);
}

/* === Delay Countdown === */
.delay-overlay {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.delay-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.delay-countdown {
  font-size: 5rem;
  font-weight: 700;
  color: var(--black);
  line-height: 1;
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.delay-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.375rem;
}

.delay-message {
  font-size: 0.875rem;
  color: var(--mid);
  margin-bottom: 1.5rem;
}

.delay-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.delay-progress-fill {
  height: 100%;
  background: var(--black);
  border-radius: 2px;
  width: 0%;
}

.delay-upgrade {
  font-size: 0.8125rem;
  color: var(--mid);
}

.delay-upgrade-link {
  color: var(--black);
  font-weight: 600;
  text-decoration: underline;
}

.delay-upgrade-link:hover {
  color: var(--dark);
}

/* === Responsive === */
@media (max-width: 900px) {
  .pricing-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .landing {
    padding: 1.5rem;
  }


  .landing-title {
    font-size: 3.5rem;
  }

  .upload-area {
    padding: 2rem 1.5rem;
  }

  .status-page {
    padding: 1.5rem;
  }

  .status-container {
    padding: 1.5rem;
  }

  .status-header {
    flex-direction: column;
  }

  .status-title {
    font-size: 1.25rem;
  }

  .result-row {
    grid-template-columns: 1fr;
  }

  .result-key {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .step {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-align: left;
  }

  .step-number {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .doc-types {
    grid-template-columns: 1fr;
  }

  .cookie-banner {
    flex-direction: column;
    text-align: center;
  }

  .site-nav {
    padding: 0.75rem 1.5rem;
  }

  .history-page {
    padding: 1.5rem;
  }

  .pricing-cards {
    grid-template-columns: 1fr;
  }

  .profile-container {
    padding: 1.5rem;
  }

  .dropdown-trigger {
    font-size: 0.75rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
