* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.panel {
  width: 100%;
  max-width: 800px;
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.choose-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #17181a;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.hint {
  color: #8a8f98;
  font-size: 13px;
}

.dropzone {
  border: 2px dashed #d8dcdf;
  border-radius: 16px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone.drag-over {
  border-color: #3b82f6;
  background: #e5f0ff;
}

.dropzone.has-result {
  border-style: solid;
  border-color: #e2e5e8;
  cursor: default;
  padding: 24px 28px;
  align-items: stretch;
}

.state.hidden {
  display: none;
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: #3b82f6;
  margin-bottom: 12px;
}

.dropzone p {
  color: #5c6470;
  font-size: 16px;
  margin: 0;
}

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

/* Processing banner — full-width gradient card shown while extraction runs.
   Top line: spinner + status; second line: a format-specific upsell. */
.dropzone.is-processing {
  border-style: solid;
  border-color: transparent;
}

.processing-banner {
  width: 100%;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

.processing-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.processing-spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.processing-title {
  font-size: 15px;
  font-weight: 400;
}

.processing-ad {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.error-message {
  color: #c0392b;
  margin-bottom: 16px;
}

/* Daily-limit upsell — shown instead of the error state when /api/extract
   returns 429. The CTA is a plain <a target="_top"> so the click breaks out
   of the marketing-site iframe and navigates the whole page. */
.dropzone.is-static {
  border-style: solid;
  border-color: #e2e5e8;
  cursor: default;
}

.limit-state {
  width: 100%;
  text-align: center;
  padding: 8px 4px;
}

.limit-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  color: #1f2733;
}

.limit-subtitle {
  color: #5c6470;
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 24px;
}

.limit-cta {
  display: inline-block;
  margin: 12px 0;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  border-radius: 14px;
  padding: 16px 40px;
  font-size: 17px;
  font-weight: 700;
  transition: background-color 0.15s ease;
}

.limit-cta:hover {
  background: #1d4ed8;
}

.limit-footnote {
  color: #8a8f98;
  font-size: 14px;
  margin: 24px 0 0;
}

.result-state {
  width: 100%;
  text-align: left;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eceff1;
}

.result-check {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e5f7ec;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.result-heading {
  flex: 1;
  min-width: 0;
}

.result-vendor {
  font-size: 20px;
  font-weight: 700;
  color: #3d434b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  margin-top: 4px;
  color: #8a8f98;
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.result-total {
  flex: none;
  text-align: right;
}

.result-total-label {
  font-size: 12px;
  color: #8a8f98;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-total-amount {
  font-size: 26px;
  font-weight: 700;
  color: #3d434b;
  white-space: nowrap;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a8f98;
  padding: 0 0 8px;
  font-weight: 600;
}

.result-table th.align-right,
.result-table td.align-right {
  text-align: right;
}

.result-table td {
  padding: 10px 0;
  border-top: 1px solid #f0f2f4;
  color: #3d434b;
  vertical-align: top;
}

.category-badge {
  display: inline-block;
  background: #eaf2fe;
  color: #3b82f6;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.result-actions .choose-button,
.result-actions .secondary-button {
  margin-top: 0;
}

.import-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1px solid #f2d98a;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #7a5c00;
}

.import-note:empty {
  display: none;
}

.secondary-button {
  display: inline-block;
  background: none;
  border: 1px solid #d8dcdf;
  border-radius: 999px;
  /* 1px less vertical padding than .choose-button to offset this button's
     1px border — box-sizing: border-box means both end up the same total
     rendered height. */
  padding: 13px 20px;
  font-size: 15px;
  color: #5c6470;
  cursor: pointer;
  margin-top: 12px;
}

