:root {
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --dark: #0f172a;
  --brand-dark: #1e3a5f;
  --white: #ffffff;
  --light: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --yellow: #ca8a04;
  --yellow-bg: #fefce8;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--light); color: var(--text); min-height: 100vh; }

/* LOGIN */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}
.login-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .luigi { color: var(--white); font-size: 22px; font-weight: 800; }
.login-logo .copertino { color: var(--blue); font-size: 22px; font-weight: 800; }
.login-logo .tagline { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.login-card h2 { color: var(--white); font-size: 18px; margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 14px; background: #0f172a; border: 1px solid #334155;
  border-radius: 6px; color: var(--white); font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; text-align: center; }

/* NAV */
#app { display: none; min-height: 100vh; }
nav {
  background: var(--dark);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky; top: 0; z-index: 100;
}
.nav-logo .luigi { color: var(--white); font-weight: 800; font-size: 16px; }
.nav-logo .copertino { color: var(--blue); font-weight: 800; font-size: 16px; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px; border-radius: 6px; color: var(--text-muted); font-size: 14px;
  cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.nav-link:hover { color: var(--white); background: #1e293b; }
.nav-link.active { color: var(--white); background: #1e293b; }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* MAIN CONTENT */
.main { max-width: 860px; margin: 0 auto; padding: 32px 24px; }
.page { display: none; }
.page.active { display: block; }

/* CARD */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--dark); }

/* DISCLAIMER */
.disclaimer-box {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: #1e40af; line-height: 1.5;
}

/* SCAN FORM */
.scan-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
@media(max-width:600px) { .scan-form .form-row { grid-template-columns: 1fr; } }
.input-field {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; outline: none; background: var(--white);
  transition: border-color 0.2s; color: var(--text);
}
.input-field:focus { border-color: var(--blue); }
.input-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }

/* PROGRESS */
.progress-section { margin-top: 20px; }
.progress-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  background: var(--white); transition: all 0.3s;
}
.check-item.running { border-color: var(--blue); background: #eff6ff; }
.check-item.done { border-color: #bbf7d0; background: var(--green-bg); }
.check-item.error { border-color: #fecaca; background: var(--red-bg); }
.check-icon { font-size: 16px; width: 20px; text-align: center; }
.check-label { flex: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #bfdbfe; border-top-color: var(--blue); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* SCORE BANNER */
.score-banner {
  display: flex; align-items: center; gap: 20px; padding: 20px 24px;
  border-radius: 10px; margin-bottom: 20px; border: 1px solid var(--border);
}
.score-circle {
  width: 72px; height: 72px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.score-circle.green { background: var(--green); }
.score-circle.yellow { background: var(--yellow); }
.score-circle.orange { background: var(--orange); }
.score-circle.red { background: var(--red); }
.score-num { font-size: 22px; font-weight: 800; color: var(--white); line-height: 1; }
.score-denom { font-size: 10px; color: rgba(255,255,255,0.8); }
.score-info h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.score-info p { font-size: 13px; color: var(--text-secondary); }

/* FINDINGS */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; cursor: pointer; }
.section-header h3 { font-size: 14px; font-weight: 700; }
.finding-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px;
  margin-bottom: 10px; transition: box-shadow 0.2s;
}
.finding-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.finding-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.finding-title { font-size: 14px; font-weight: 600; flex: 1; }
.finding-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.fix-steps { background: var(--light); border-radius: 6px; padding: 10px 14px; }
.fix-steps-label { font-size: 11px; font-weight: 700; color: var(--blue); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.fix-steps ol { padding-left: 16px; }
.fix-steps li { font-size: 13px; color: var(--dark); margin-bottom: 3px; line-height: 1.5; }

/* BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-critical { background: var(--red-bg); color: var(--red); }
.badge-high { background: var(--orange-bg); color: var(--orange); }
.badge-medium { background: var(--yellow-bg); color: var(--yellow); }
.badge-low { background: var(--light); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-info { background: #eff6ff; color: var(--blue); }

/* STORICO */
.scan-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s; background: var(--white);
}
.scan-row:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(59,130,246,0.08); }
.scan-url { font-size: 14px; font-weight: 600; flex: 1; }
.scan-meta { font-size: 12px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); font-size: 14px; }

/* MODAL */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 999; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 12px; padding: 28px; width: 100%;
  max-width: 680px; max-height: 85vh; overflow-y: auto; margin: 16px;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-muted); background: none; border: none; line-height: 1; }
.prompt-textarea {
  width: 100%; height: 300px; padding: 14px; background: var(--light);
  border: 1px solid var(--border); border-radius: 6px; font-family: monospace;
  font-size: 12px; resize: vertical; outline: none;
}

/* PAGINATION */
.pagination { display: flex; gap: 8px; margin-top: 16px; justify-content: center; }
.page-btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--white); cursor: pointer; font-size: 13px; }
.page-btn.active { background: var(--blue); color: var(--white); border-color: var(--blue); }

/* ── HAMBURGER ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  gap: 5px;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-link-mobile-only { display: none; }
.nav-desktop-only { display: inline-flex; }

@media (max-width: 640px) {
  .hamburger { display: flex; }
  .nav-desktop-only { display: none; }

  #nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: #1e293b;
    border-top: 1px solid #334155;
    flex-direction: column;
    padding: 8px 0;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  #nav-links.open { display: flex; }

  .nav-link {
    padding: 14px 20px;
    border-radius: 0;
    font-size: 15px;
    border-bottom: 1px solid #334155;
  }
  .nav-link:last-child { border-bottom: none; }
  .nav-link-mobile-only { display: block; }

  nav { position: relative; }
  .main { padding: 16px 12px; }
  .card { padding: 16px; }
  .scan-form .form-row { grid-template-columns: 1fr; }
  .score-banner { flex-direction: column; text-align: center; gap: 12px; }
  .score-info { text-align: center; }
  .finding-header { flex-wrap: wrap; }
  .btn-sm { padding: 8px 14px; font-size: 13px; }
  .modal { margin: 8px; padding: 20px; }
  .prompt-textarea { height: 220px; }
  .scan-url { font-size: 13px; }
}
