:root {
  --bg: #0b1220;
  --panel: #121b2e;
  --panel-2: #1a2540;
  --line: #22304d;
  --muted: #7c8aa6;
  --text: #e7ecf3;
  --primary: #2dd4bf;
  --primary-2: #14b8a6;
  --accent: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fb923c;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn {
  background: var(--primary);
  color: #08131a;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
  min-height: 44px;
}
button:hover, .btn:hover { background: var(--primary-2); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { background: #2a3651; color: #6c7a99; cursor: not-allowed; }

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: #243054; }

.btn-danger { background: var(--danger); color: #2a0606; }
.btn-warn { background: var(--warn); color: #2a1206; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }

.btn-sm { padding: 8px 12px; font-size: 14px; min-height: 36px; }

input, select, textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  width: 100%;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}
textarea { min-height: 80px; resize: vertical; }

label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }

.field { margin-bottom: 14px; }

/* ===== Layout ===== */

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .brand span { color: var(--primary); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.topbar nav a.active, .topbar nav a:hover { background: var(--panel-2); text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .user-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.topbar .user-chip .lvl {
  background: var(--primary);
  color: #08131a;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 12px;
}

main { padding: 24px 20px 80px; max-width: 1200px; width: 100%; margin: 0 auto; }

h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; }
h1 + .subtitle { color: var(--muted); margin-bottom: 24px; }
h2 { margin: 28px 0 12px; font-size: 19px; }
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 780px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  main { padding: 16px 14px 80px; }
  h1 { font-size: 22px; }
}

/* ===== Stat cards ===== */

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat .lbl { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat .val { font-size: 30px; font-weight: 700; line-height: 1; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.stat.accent .val { color: var(--accent); }
.stat.primary .val { color: var(--primary); }
.stat.ok .val { color: var(--ok); }

/* ===== Level/progress ===== */

.lvl-card {
  background: linear-gradient(135deg, #1a2540 0%, #243367 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.lvl-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.lvl-badge {
  width: 60px; height: 60px;
  background: var(--primary);
  color: #08131a;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800;
}
.lvl-name { font-size: 20px; font-weight: 700; }
.lvl-mult { color: var(--muted); font-size: 13px; }

.progress {
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 100px;
  transition: width .4s ease;
}
.progress-text { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ===== Lists ===== */

.list { display: flex; flex-direction: column; gap: 10px; }
.list-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.list-row .meta { flex: 1; min-width: 0; }
.list-row .meta .title { font-weight: 600; }
.list-row .meta .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
}
.badge.short { background: rgba(45,212,191,0.12); color: var(--primary); border-color: rgba(45,212,191,0.4); }
.badge.full  { background: rgba(251,191,36,0.12);  color: var(--accent);  border-color: rgba(251,191,36,0.4); }
.badge.ok    { background: rgba(52,211,153,0.12);  color: var(--ok);      border-color: rgba(52,211,153,0.4); }
.badge.warn  { background: rgba(251,146,60,0.12);  color: var(--warn);    border-color: rgba(251,146,60,0.4); }
.badge.danger{ background: rgba(248,113,113,0.12); color: var(--danger);  border-color: rgba(248,113,113,0.4); }
.badge.muted { color: var(--muted); }

/* ===== Tables ===== */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
tbody tr:hover { background: var(--panel-2); }

/* ===== Login ===== */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
}
.login-box h1 { font-size: 24px; margin-bottom: 4px; }
.login-box .sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.login-box button { width: 100%; margin-top: 8px; }

/* ===== Verification form ===== */

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-weight: 600;
}
.section-title .pct {
  font-size: 13px;
  color: var(--muted);
  font-weight: normal;
}

.equipment-block {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.equipment-block .eq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.equipment-block .eq-header .eq-title {
  font-weight: 600;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 680px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
}
.checkbox input { width: 18px; height: 18px; margin: 0; min-height: 0; }
.checkbox label { margin: 0; cursor: pointer; color: var(--text); font-size: 14px; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(11,18,32,0.96);
  backdrop-filter: blur(10px);
  margin: 24px -20px -24px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  z-index: 10;
}
.sticky-actions .left { flex: 1; color: var(--muted); font-size: 13px; align-self: center; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 22px;
  border-radius: 100px;
  box-shadow: var(--shadow);
  z-index: 1000;
  font-size: 14px;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }

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

.muted { color: var(--muted); }
.bold { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }

.points-big { color: var(--accent); font-weight: 700; font-size: 26px; }
.points-mid { color: var(--accent); font-weight: 600; }

/* ===== Streak chip ===== */
.streak-chip {
  background: rgba(251,146,60,0.18);
  color: var(--warn);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(251,146,60,0.4);
  display: inline-flex; gap: 3px; align-items: center;
}

/* ===== Badges ===== */
.badges-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-top: 8px;
}
.badge-tile {
  flex: 0 0 auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 110px;
  text-align: center;
}
.badge-tile .badge-icon { font-size: 26px; margin-bottom: 4px; }
.badge-tile .badge-name { font-size: 12px; color: var(--muted); }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.badge-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  transition: transform .15s;
}
.badge-card.earned {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--panel) 0%, rgba(45,212,191,0.08) 100%);
}
.badge-card.locked { opacity: 0.45; filter: grayscale(0.6); }
.badge-card:hover { transform: translateY(-2px); }
.badge-icon-big { font-size: 42px; }
.badge-name-big { font-weight: 700; margin-top: 8px; }
.badge-status { font-size: 12px; color: var(--ok); margin-top: 8px; font-weight: 600; }
.badge-status.locked { color: var(--muted); font-weight: normal; }

/* ===== Progress overview ===== */
.progress-overview {
  background: linear-gradient(135deg, #1a2540 0%, #243367 100%);
  border-color: rgba(251,191,36,0.3);
}
.progress-overview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.progress-overview .overall-pct {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.sec-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sec-pill {
  display: inline-flex;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 100px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
}
.sec-pill.done { background: rgba(52,211,153,0.15); color: var(--ok); border-color: rgba(52,211,153,0.4); }
.sec-pill.mid  { background: rgba(251,146,60,0.12); color: var(--warn); border-color: rgba(251,146,60,0.4); }
.sec-pill.empty { color: var(--muted); }
.sec-pill-pct { font-weight: 700; }

/* ===== Section progress ===== */
.section-title .pct {
  font-weight: 700;
  font-size: 12px;
  background: var(--panel-2);
  padding: 3px 9px;
  border-radius: 100px;
}
.section-title .pct.pct-mid { background: rgba(251,146,60,0.18); color: var(--warn); }
.section-title .pct.pct-done { background: rgba(52,211,153,0.18); color: var(--ok); }

/* Prefill marker */
.field.prefilled input,
.field.prefilled textarea,
.field.prefilled select {
  border-color: rgba(45,212,191,0.5);
}
.pf-hint {
  font-size: 11px;
  color: var(--primary);
  margin-top: 4px;
  font-style: italic;
}

