:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --base: #6366f1;
  --report: #10b981;
  --danger: #ef4444;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.brand__logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 800; letter-spacing: .5px; }
.brand__sub { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 12px;
  border: none; background: transparent; cursor: pointer;
  border-radius: 12px; color: var(--muted); font: inherit; font-weight: 600;
  text-align: left; transition: .15s;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item.is-active { background: var(--primary-soft); color: var(--primary-dark); }
.nav__item svg { width: 18px; height: 18px; }
.nav__item .tag {
  margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  background: #fef3c7; color: #b45309; padding: 3px 7px; border-radius: 999px;
}
.sidebar__foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 6px; }

/* ===== Main ===== */
.main { flex: 1; padding: 32px 40px; max-width: 1200px; }
.tab { display: none; animation: fade .25s ease; }
.tab.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; }
.page-head p { margin: 0; color: var(--muted); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.3); }
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn--primary:disabled { background: #c7cbe0; box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }

/* ===== Dropzones ===== */
.dropzones { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dropzone {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.dropzone__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dropzone__title { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--base { background: var(--base); }
.dot--report { background: var(--report); }
.dropzone__count {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 34px 16px; border: 2px dashed var(--border); border-radius: 14px;
  background: var(--surface-2); cursor: pointer; text-align: center; transition: .18s;
}
.drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.drop.is-drag { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.01); }
.drop__icon { width: 34px; height: 34px; color: var(--primary); stroke-width: 1.8; }
.drop__title { font-weight: 600; }
.drop__hint { font-size: 13px; color: var(--muted); }

.files { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; animation: fade .2s ease;
}
.file__ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.file__ico svg { width: 16px; height: 16px; }
.file[data-kind="base"] .file__ico { background: var(--base); }
.file[data-kind="report"] .file__ico { background: var(--report); }
.file__meta { min-width: 0; flex: 1; }
.file__name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file__size { font-size: 12px; color: var(--muted); }
.file__remove {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; transition: .15s;
}
.file__remove:hover { background: #fee2e2; color: var(--danger); }

/* ===== Results ===== */
.results {
  margin-top: 26px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.results.is-empty .results__list { display: none; }
.results:not(.is-empty) .results__empty { display: none; }
.results__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.results__head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.results__hint { font-size: 13px; color: var(--muted); }
.results__empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px; color: var(--muted); }
.results__empty svg { width: 40px; height: 40px; stroke-width: 1.6; color: #cbd2e0; }
.results__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.result {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.result__ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; margin-top: 2px;
  background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
}
.result__meta { flex: 1; min-width: 0; }
.result__name { font-weight: 600; }
.result__badge {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--report); min-width: 3.2ch; text-align: right;
}
.result__meta-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.result__track {
  margin-top: 8px; height: 8px; border-radius: 999px;
  background: #e0e7ff; overflow: hidden;
}
.result__fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  transition: width .25s ease;
  position: relative;
}
.result.is-busy .result__fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.result.is-busy { border-color: #c7d2fe; background: #eef2ff; }
.result.is-busy .result__badge { color: var(--primary); }
.result.is-queued { opacity: .85; }
.result.is-error { border-color: #fecaca; background: #fef2f2; }
.result.is-error .result__badge { color: var(--danger); }
.result.is-done .result__fill {
  background: linear-gradient(90deg, #10b981, #059669);
}
.result.is-done .result__track { background: #d1fae5; }
.result__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result__top { display: flex; align-items: center; gap: 12px; }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0; background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
}
.modal__card {
  position: relative; width: min(420px, 100%);
  background: var(--surface); border-radius: 18px; padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  animation: fade .2s ease;
}
.modal__card h3 { margin: 0 0 6px; font-size: 18px; }
.modal__hint { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 13px; }
.field input {
  font: inherit; font-weight: 500; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ===== Soon ===== */
.soon { text-align: center; padding: 70px 20px; color: var(--muted); }
.soon svg { width: 54px; height: 54px; color: #c7cbe0; stroke-width: 1.5; }
.soon h3 { margin: 16px 0 6px; color: var(--text); }
.soon p { margin: 0; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 12px;
  font-weight: 500; box-shadow: 0 12px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: .25s;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 16px; padding: 14px 16px; }
  .nav { flex-direction: row; }
  .nav__item .tag { display: none; }
  .sidebar__foot { display: none; }
  .main { padding: 22px 18px; }
  .dropzones { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
