* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

header {
  background: #2563eb;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

#auth-status {
  font-size: 13px;
}

main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

section {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section.hidden {
  display: none;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #1e40af;
}

/* Login form */
#login-section {
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.login-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid #fecaca;
}

.login-error.hidden {
  display: none;
}

#login-btn {
  width: 100%;
  background: #2563eb;
  color: #fff;
}

#login-btn:hover {
  background: #1d4ed8;
}

#logout-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 16px;
  font-size: 13px;
}

#logout-btn:hover {
  background: rgba(255,255,255,0.3);
}

#logout-btn.hidden {
  display: none;
}

/* Labels (generic) */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #555;
}

/* Status box */
.status-box {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.status-box.ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-box.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-box.warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Drop zone */
#drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

#drop-zone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

#drop-zone p {
  color: #64748b;
  font-size: 15px;
}

#drop-zone p.sub {
  font-size: 12px;
  margin: 8px 0;
}

.file-label {
  display: inline-block;
  padding: 8px 20px;
  background: #2563eb;
  color: #fff !important;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.file-label:hover {
  background: #1d4ed8;
}

#file-name {
  margin-top: 10px;
  font-size: 13px;
  color: #555;
}

/* Preview summary */
#preview-summary {
  margin-bottom: 12px;
  font-size: 14px;
}

/* Parse errors */
#parse-errors {
  margin-bottom: 12px;
}

#parse-errors .error-item {
  background: #fef2f2;
  color: #991b1b;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 4px;
  font-size: 13px;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
}

tr:hover {
  background: #f8fafc;
}

td.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Result status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge.success {
  background: #ecfdf5;
  color: #065f46;
}

.badge.error {
  background: #fef2f2;
  color: #991b1b;
}

.badge.skipped {
  background: #fffbeb;
  color: #92400e;
}

/* Buttons */
button {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#process-btn, #new-btn {
  background: #2563eb;
  color: #fff;
}

#process-btn:hover:not(:disabled), #new-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.secondary {
  background: #e2e8f0;
  color: #475569;
}

.secondary:hover {
  background: #cbd5e1;
}

.actions {
  display: flex;
  gap: 8px;
}

/* Results summary */
#results-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

#results-summary .stat {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

#results-summary .stat.success {
  background: #ecfdf5;
  color: #065f46;
}

#results-summary .stat.error {
  background: #fef2f2;
  color: #991b1b;
}

#results-summary .stat.total {
  background: #f8fafc;
  color: #475569;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px auto;
}

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

/* Responsive */
@media (max-width: 600px) {
  header {
    flex-direction: column;
    gap: 8px;
  }

  main {
    padding: 0 8px;
  }

  section {
    padding: 14px;
  }

  #drop-zone {
    padding: 24px;
  }

  .actions {
    flex-direction: column;
  }

  #results-summary {
    flex-direction: column;
    gap: 8px;
  }
}
