:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #1c2733; --muted: #6b7a8d;
  --line: #e4e9ef; --brand: #2563eb; --brand-d: #1d4ed8;
  --ok: #15803d; --warn: #b45309; --hi: #b91c1c;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; font-size: 15px;
}
.hidden { display: none !important; }

.topbar { background: #0f172a; color: #fff; padding: 16px 24px; }
.brand { display: flex; align-items: center; gap: 14px; max-width: 1080px; margin: 0 auto; }
.logo { font-size: 30px; color: #60a5fa; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: #9fb2c8; }

.layout { max-width: 1180px; margin: 24px auto; padding: 0 20px; display: grid;
  grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; }

/* sidebar */
.sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 18px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; }
.side-card h3 { margin: 0 0 4px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.side-note { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #34435a; margin-bottom: 12px; }
.fld input, .fld select { font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-weight: 500; }
.fld input:focus, .fld select:focus { outline: 2px solid #bfd4ff; border-color: var(--brand); }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-ghost { background: #f5f7fa; border-color: var(--line); color: #445; }
.side-help ol { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: #445; line-height: 1.8; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: 2; }
}

/* dropzone */
.dropzone { border: 2px dashed #c3ccd8; background: #fbfcfe; transition: .15s; }
.dropzone.drag { border-color: var(--brand); background: #eff5ff; }
.dz-inner { text-align: center; padding: 26px 10px; }
.dz-icon { font-size: 46px; }
.dz-title { font-size: 17px; font-weight: 600; margin: 10px 0 2px; }
.dz-sub { color: var(--muted); margin: 4px 0 12px; }
.dz-file { margin-top: 14px; font-weight: 600; color: var(--brand-d); }

/* controls */
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.scope { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.scope .lbl { font-weight: 600; }
.scope label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* buttons */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 18px;
  border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; transition: .12s; }
.btn:hover { background: #f5f7fa; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* results */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.results-head h2 { margin: 0; font-size: 18px; }
.results-actions { display: flex; align-items: center; gap: 16px; }
.chk-all { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.pill { background: #eef2f7; color: var(--muted); border-radius: 20px; padding: 2px 12px; font-size: 13px; font-weight: 600; margin-left: 6px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafbfc; }
tbody tr:hover { background: #fafcff; }
.c-chk { width: 42px; } .c-loc { width: 110px; white-space: nowrap; color: var(--muted); }
.c-cat { width: 120px; } .c-sev { width: 70px; }
.cat-tag { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 20px; background: #eef2f7; color: #445; }
.sev { font-size: 12px; font-weight: 700; }
.sev.cao { color: var(--hi); } .sev.vua { color: var(--warn); } .sev.thap { color: var(--muted); }
.desc-main { font-weight: 600; }
.desc-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.desc-sub .arrow { color: var(--ok); font-weight: 700; }
td input[type=checkbox], .chk-all input, .results-actions input { width: 17px; height: 17px; cursor: pointer; }

.empty { text-align: center; color: var(--muted); padding: 20px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #0f172a;
  color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 30; font-size: 14px; }
.toast.ok { background: #15803d; } .toast.err { background: #b91c1c; }

/* overlay */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; z-index: 40; color: #fff; }
.spinner { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
