* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
}

/* ---------- Top nav ---------- */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}
.topnav .brand {
  font-weight: 700;
  font-size: 16px;
  color: #94a3b8;
  letter-spacing: 0.02em;
}
.topnav .links a {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  margin-left: 18px;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  transition: background 0.15s;
}
.topnav .links a:hover { background: rgba(255,255,255,0.16); }
.topnav .links a.primary { background: #6366f1; }
.topnav .links a.primary:hover { background: #4f46e5; }

/* ---------- Progress bar ---------- */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.08);
  z-index: 60;
}
.progress-fill {
  height: 100%;
  background: #6366f1;
  transition: width 0.25s ease;
}

/* ---------- Wizard ---------- */
.wizard-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 60px;
}
.step {
  display: none;
  width: 100%;
  max-width: 620px;
  animation: fadeIn 0.25s ease;
}
.step.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.step .eyebrow {
  color: #818cf8;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.step h1 {
  font-size: 30px;
  line-height: 1.3;
  margin: 0 0 28px 0;
  font-weight: 700;
}
.step input[type="text"],
.step input[type="number"],
.step input[type="date"] {
  width: 100%;
  font-size: 22px;
  padding: 14px 4px;
  background: transparent;
  border: none;
  border-bottom: 3px solid #334155;
  color: #f8fafc;
  outline: none;
  margin-bottom: 28px;
}
.step input:focus { border-bottom-color: #6366f1; }
.step input::placeholder { color: #64748b; }

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.option-btn {
  text-align: left;
  padding: 18px 20px;
  font-size: 18px;
  border-radius: 12px;
  border: 2px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option-btn:hover { border-color: #6366f1; }
.option-btn.selected { border-color: #6366f1; background: #312e81; }

.btn-row { display: flex; gap: 12px; align-items: center; }
.btn-next, .btn-submit {
  background: #6366f1;
  color: white;
  border: none;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 30px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-next:hover, .btn-submit:hover { background: #4f46e5; }
.btn-back {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 14px 8px;
}
.btn-back:hover { color: #e2e8f0; }
.hint {
  font-size: 13px;
  color: #64748b;
  margin-top: -18px;
  margin-bottom: 20px;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #1e293b;
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 24px; }
.login-card input {
  width: 100%;
  font-size: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 2px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  margin-bottom: 16px;
  outline: none;
}
.login-card input:focus { border-color: #6366f1; }
.login-card button {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: #6366f1;
  color: white;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.error-msg { color: #f87171; font-size: 14px; margin-bottom: 12px; }

/* ---------- Dashboard ---------- */
.dash-wrap { padding: 100px 32px 60px; max-width: 1200px; margin: 0 auto; }
.dash-wrap h1 { font-size: 26px; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; background: #1e293b; border-radius: 12px; table-layout: fixed; }
thead tr:first-child th:first-child { border-top-left-radius: 12px; }
thead tr:first-child th:last-child { border-top-right-radius: 12px; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
th, td { text-align: left; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #334155; overflow-wrap: break-word; }
th { color: #94a3b8; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; position: relative; }
tr:last-child td { border-bottom: none; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; display: inline-block; }
.badge.thirty { background: #164e63; color: #67e8f9; }
.badge.seven { background: #78350f; color: #fcd34d; }
.nowrap { white-space: nowrap; }

/* ---------- Sortable headers + filter icons ---------- */
th.sortable .th-label { cursor: pointer; user-select: none; display: inline-block; }
th.sortable .th-label:hover { color: #e2e8f0; }
th.sortable .arrow { display: inline-block; margin-left: 4px; opacity: 0.4; font-size: 10px; }
th.sortable.active .arrow { opacity: 1; color: #818cf8; }
.filter-icon {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 10px;
  padding: 2px 4px;
  margin-left: 2px;
  border-radius: 4px;
  vertical-align: middle;
}
.filter-icon:hover { color: #e2e8f0; background: rgba(255,255,255,0.08); }
.filter-icon.active { color: #818cf8; }
.results-count { color: #94a3b8; font-size: 13px; margin-bottom: 12px; }

.filter-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  min-width: 200px;
  max-width: 260px;
  z-index: 100;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
  font-weight: 400;
  color: #f1f5f9;
}
.popover-actions-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.popover-link {
  background: none; border: none; color: #818cf8; font-size: 12px;
  font-weight: 600; cursor: pointer; padding: 0;
}
.popover-link:hover { color: #a5b4fc; text-decoration: underline; }
.popover-checklist { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.popover-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400; }
.popover-checkbox input { accent-color: #6366f1; }
.popover-date-range { display: flex; flex-direction: column; gap: 10px; }
.popover-date-range label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #94a3b8; font-weight: 600; }
.popover-date-range input[type="date"] {
  background: #1e293b; border: 2px solid #334155; color: #f1f5f9;
  border-radius: 6px; padding: 6px 8px; font-size: 13px; outline: none;
}
.popover-date-range input[type="date"]:focus { border-color: #6366f1; }
.popover-actions-bottom { margin-top: 10px; }
.gen-btn {
  background: #6366f1; color: white; border: none;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.gen-btn:hover { background: #4f46e5; }
.gen-btn:disabled { background: #334155; color: #64748b; cursor: not-allowed; }
.empty-state { color: #94a3b8; text-align: center; padding: 60px 0; }
