:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e6e2d8;
  --brand: #c0392b;
  --brand-dark: #97271c;
  --accent: #f4c542;
  --green: #1f9d55;
  --green-bg: #e6f6ed;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, #fbeede 0, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #eef3ee 0, transparent 55%),
    var(--bg);
  min-height: 100vh;
}

.app-header {
  padding: 28px 24px 8px; max-width: 1000px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; }
#btn-start-new {
  flex: none; white-space: nowrap; margin-left: auto;
  background: var(--brand); color: #fff;
  box-shadow: 0 8px 20px rgba(192, 57, 43, 0.28);
}
#btn-start-new:hover:not(:disabled) { background: var(--brand-dark); }
@media (max-width: 560px) {
  .app-header { flex-wrap: wrap; }
  #btn-start-new { order: 3; }
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #e0654f);
  color: #fff; font-weight: 800; font-size: 30px;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.app-header h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.app-header p { margin: 2px 0 0; color: var(--muted); }

/* Stepper */
.stepper { max-width: 1000px; margin: 24px auto 8px; padding: 0 24px; }
.stepper ol {
  list-style: none; display: flex; gap: 8px; padding: 0; margin: 0;
}
.step {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700;
  background: #efece4; color: var(--muted); transition: 0.2s;
}
.step .label { font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.active .dot { background: var(--brand); color: #fff; }
.step.active .label { color: var(--ink); }
.step.done .dot { background: var(--green); color: #fff; }
.step.done .dot::after { content: "✓"; }
.step.done .dot { font-size: 0; }
.step.done .dot::after { font-size: 15px; }

/* Content */
.content { max-width: 1000px; margin: 16px auto 80px; padding: 0 24px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); padding: 28px;
  animation: rise 0.25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.muted { color: var(--muted); margin-top: 4px; }

/* Dropzones */
.dropzones { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.dropzone {
  position: relative; border: 2px dashed #d8d2c4; border-radius: 16px;
  background: #fbfaf6; padding: 28px 20px; text-align: center; cursor: pointer;
  transition: 0.18s;
}
.dropzone.wide { margin-top: 16px; }
.dropzone:hover { border-color: var(--brand); background: #fff8f5; }
.dropzone.dragover { border-color: var(--brand); background: #fdeee9; transform: scale(1.01); }
.dz-icon {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 10px;
  display: grid; place-items: center; font-size: 26px; font-weight: 700;
  background: #fff; color: var(--brand); box-shadow: var(--shadow);
}
.dropzone h3 { margin: 0 0 4px; font-size: 17px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 14px; }

/* File lists / chips */
.file-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.file-lists h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: #f4f1ea; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; animation: rise 0.2s ease;
}
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .x {
  border: none; background: #e7e2d6; color: #555; width: 24px; height: 24px;
  border-radius: 50%; cursor: pointer; font-weight: 700; flex: none;
}
.chip .x:hover { background: var(--brand); color: #fff; }

/* Buttons */
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 12px; padding: 14px 22px; font-size: 15px;
  font-weight: 700; cursor: pointer; font-family: inherit; transition: 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(192, 57, 43, 0.28); margin-left: auto; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.secondary { background: #1f2430; color: #fff; }
.btn.secondary:hover:not(:disabled) { background: #000; }
.btn.ghost { background: #efece4; color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: #e4dfd3; }

/* Summary cards */
.summary-card {
  display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0 4px;
}
.stat {
  flex: 1; min-width: 140px; background: #faf8f3; border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px;
}
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat .cap { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat.good .num { color: var(--green); }
.stat.warn .num { color: var(--brand); }

.needlist, .reasonlist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.needlist li {
  background: #fff7e8; border: 1px solid #f0dca8; border-radius: 10px;
  padding: 10px 14px; font-size: 14px;
}

.success-banner {
  background: var(--green-bg); color: #0f5e30; border: 1px solid #b6e3c8;
  border-radius: 12px; padding: 16px 18px; font-weight: 700; margin-top: 16px;
}
.warn-banner {
  background: #fdeee9; color: var(--brand-dark); border: 1px solid #f3c5bb;
  border-radius: 12px; padding: 16px 18px; font-weight: 600; margin-top: 16px;
}

/* Preview table */
.preview-title { margin: 28px 0 10px; font-size: 17px; }
.table-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.preview-table th, .preview-table td { padding: 12px 16px; text-align: left; }
.preview-table thead th { background: #1f2430; color: #fff; font-weight: 600; }
.preview-table tbody tr:nth-child(even) { background: #faf8f3; }
.preview-table td.was { color: var(--muted); text-decoration: line-through; }
.preview-table td.sale { color: var(--brand); font-weight: 800; }

/* Overlay + spinner */
.overlay {
  position: fixed; inset: 0; background: rgba(245, 243, 238, 0.78);
  backdrop-filter: blur(3px); z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.overlay p { font-weight: 700; color: var(--ink); }
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 5px solid #e3ddd0; border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toast-host { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1f2430; color: #fff; padding: 14px 18px; border-radius: 12px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; max-width: 340px;
  animation: rise 0.2s ease;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--brand); }

.hidden { display: none !important; }

@media (max-width: 720px) {
  .dropzones, .file-lists, .summary-card { grid-template-columns: 1fr; }
  .stepper .label { display: none; }
  .step { justify-content: center; padding: 12px; }
  .btn.primary { margin-left: 0; width: 100%; }
  .actions { flex-direction: column; }
}
