:root {
  --bg: #0a0a0a;
  --bg-elev: #121212;
  --bg-card: #161616;
  --border: #1f1f1f;
  --border-strong: #2a2a2a;
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --text-dim: #6a6a6a;
  --accent: #f5a524;
  --accent-strong: #ffb734;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --danger: #ff5a5a;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

/* ---------- Brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 12px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-title {
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 13px;
  color: var(--text);
}
.brand-subtitle {
  font-weight: 600;
  letter-spacing: 2px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.brand-sm .brand-mark { width: 30px; height: 30px; font-size: 11px; }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(245, 165, 36, 0.08), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, rgba(245, 165, 36, 0.06), transparent 60%),
    var(--bg);
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-title {
  margin: 24px 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-foot {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.input {
  width: 100%;
  background: #0e0e0e;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #0a0a0a;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 12px;
}
.alert-error {
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.35);
  color: #ffb0b0;
}

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.who { color: var(--text-muted); font-size: 13px; }
.who strong { color: var(--text); font-weight: 600; }
.inline-form { margin: 0; }

/* ---------- Page / Dashboard ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.hero h1 {
  font-size: 34px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.accent { color: var(--accent); }
.lede { color: var(--text-muted); font-size: 16px; margin: 0 0 36px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-accent {
  border-color: rgba(245, 165, 36, 0.5);
  background: linear-gradient(180deg, rgba(245, 165, 36, 0.08), var(--bg-card));
}
.card-label {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 8px;
}
.card-foot {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 8px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 24px; }
.page-head h1 { margin: 0; }
.page-narrow { max-width: 760px; }
.table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table thead th { font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); background: var(--bg-elev); }
.table tbody tr:last-child td { border-bottom: none; }
.table .link { color: var(--text); font-weight: 600; }
.table .link:hover { color: var(--accent); }
.table .dim { color: var(--text-dim); font-size: 13px; }
.table .truncate { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--text-muted); padding: 32px; text-align: center; background: var(--bg-card); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.navlink { color: var(--text-muted); padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.navlink:hover { color: var(--text); background: var(--bg-elev); }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.checklist-item:hover { border-color: var(--border-strong); }
.checklist-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.fieldset legend { padding: 0 8px; color: var(--text-muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--text-muted); }
.pill-draft { background: rgba(245,165,36,0.08); color: var(--accent); border-color: rgba(245,165,36,0.4); }
.pill-purchased { background: rgba(80,200,120,0.08); color: #7edc9d; border-color: rgba(80,200,120,0.3); }
.pill-csv_ready { background: rgba(80,200,255,0.08); color: #7ec8ff; border-color: rgba(80,200,255,0.3); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0; }
.stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat-label { font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-accent { border-color: rgba(245,165,36,0.5); background: linear-gradient(180deg, rgba(245,165,36,0.08), var(--bg-elev)); }
.stat-accent .stat-value { color: var(--accent); }
@media (max-width: 800px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }

.test-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.test-result { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.test-result-pending { color: var(--accent); }
.test-result-ok { color: #7edc9d; }
.test-result-fail { color: #ffb0b0; }

/* ---------- Checklist row with edit button ---------- */
.checklist-row { display: flex; align-items: center; gap: 8px; }
.checklist-row .checklist-item { flex: 1; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Modal ---------- */
.modal {
  display: none;
  position: fixed; inset: 0;
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 10px;
  border-radius: 8px;
}
.modal-close:hover { color: var(--text); background: var(--bg-card); }

/* ---------- Password reveal ---------- */
.input-group { position: relative; display: block; }
.input-group .input { padding-right: 72px; width: 100%; }
.reveal-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 10px;
  border-radius: 6px; font-family: inherit; letter-spacing: 0.3px;
}
.reveal-btn:hover { color: var(--text); background: var(--bg-card); }

/* ---------- Progress cell ---------- */
.progress { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.progress-count { font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: 0.2px; }
.progress-count .dim { font-weight: 500; margin-left: 4px; }
.progress-track { height: 4px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--accent); border-radius: 999px; transition: width 200ms ease; }
.progress-complete .progress-fill { background: #7edc9d; }
.progress-complete .progress-count { color: #7edc9d; }
