*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222536;
  --border: #2e3148;
  --accent: #6366f1;
  --accent-hover: #4f52d6;
  --green: #22c55e;
  --orange: #f97316;
  --red: #ef4444;
  --text: #e2e8f0;
  --muted: #8892a4;
  --radius: 10px;
  --font: 'Inter', system-ui, sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

/* NAV */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; }
.nav-brand svg { color: var(--accent); }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .9rem; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.btn-logout { background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: .4rem .9rem; border-radius: 6px; cursor: pointer; font-size: .85rem; transition: all .2s; }
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* LAYOUT */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.page { display: none; }
.page.active { display: block; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.card-title { font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; }
.card-value { font-size: 2rem; font-weight: 700; }

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }

/* BADGE SCORE */
.score-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .9rem; border-radius: 99px; font-weight: 700; font-size: .85rem;
}
.score-LOW  { background: #14532d33; color: var(--green); border: 1px solid #22c55e44; }
.score-MEDIUM { background: #7c2d1233; color: var(--orange); border: 1px solid #f9731644; }
.score-HIGH { background: #7f1d1d33; color: var(--red); border: 1px solid #ef444444; }

/* TABLE */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: .75rem 1rem; color: var(--muted); font-weight: 600;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border)22; vertical-align: middle; }
tr:hover td { background: var(--surface2); }
.empty-row td { text-align: center; color: var(--muted); padding: 2rem; }

/* FORMS */
.form-group { margin-bottom: 1.2rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
input, textarea, select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: .7rem 1rem; color: var(--text); font-size: .9rem;
  outline: none; transition: border-color .2s; font-family: var(--font);
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 120px; resize: vertical; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.4rem; border-radius: 8px; border: none;
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; border: 1px solid var(--border); color: var(--red); }
.btn-danger:hover { background: #ef44441a; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* AUTH PAGE */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 800; }
.auth-logo p { color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; background: var(--surface2); border-radius: 8px; padding: .3rem; }
.auth-tab { flex: 1; padding: .5rem; text-align: center; border-radius: 6px; cursor: pointer;
  font-size: .875rem; font-weight: 500; color: var(--muted); border: none; background: transparent; transition: all .2s; }
.auth-tab.active { background: var(--accent); color: #fff; }
.error-msg { color: var(--red); font-size: .85rem; margin-top: .5rem; display: none; }
.success-msg { color: var(--green); font-size: .85rem; margin-top: .5rem; display: none; }

/* SCORE RESULT */
.result-box { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-top: 1.5rem; display: none; }
.score-circle { width: 90px; height: 90px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; margin: 0 auto 1rem; border: 4px solid; }
.score-circle.LOW { border-color: var(--green); color: var(--green); }
.score-circle.MEDIUM { border-color: var(--orange); color: var(--orange); }
.score-circle.HIGH { border-color: var(--red); color: var(--red); }
.finding-item { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--border)44; font-size: .875rem; }
.finding-item:last-child { border-bottom: none; }
.finding-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); margin-top: 6px; flex-shrink: 0; }

/* SECTION TITLE */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.section-title { font-size: 1.25rem; font-weight: 700; }

/* PLAN BADGE */
.plan-badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: .2rem .6rem; border-radius: 99px; }
.plan-free { background: #334155; color: #94a3b8; }
.plan-pro { background: #3730a344; color: var(--accent); border: 1px solid var(--accent)44; }

/* ALERT */
.alert { padding: .85rem 1.1rem; border-radius: 8px; font-size: .875rem; margin-bottom: 1rem; }
.alert-info { background: #1e3a5f44; border: 1px solid #3b82f644; color: #93c5fd; }
.alert-warn { background: #7c2d1244; border: 1px solid #f9731644; color: #fdba74; }

/* TOGGLE */
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 24px; transition: .3s; }
.slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 4px; bottom: 4px;
  background: white; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider::before { transform: translateX(18px); }

/* SPINNER */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid #ffffff44;
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 640px) {
  nav { padding: .8rem 1rem; }
  .container { padding: 1rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
