:root {
  --app-bg: #0b0c0e;
  --panel: #121417;
  --panel2: #171a1f;
  --edge: #292d34;
  --text: #f2f3f5;
  --muted: #959ba6;
  --blue: #5ba1ff;
  --red: #ff6b6b;
  --orange: #f5a45d;
  --yellow: #e8c65c;
  --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

/* ===== App Shell ===== */
body.app-body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font: 14px/1.5 Geist, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
}

/* ===== Sidebar ===== */
.side {
  padding: 22px 16px;
  border-right: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--panel) 0%, var(--app-bg) 100%);
}
.side .brand {
  color: white;
  margin: 3px 8px 34px;
}
.side .mark:before,
.side .mark:after { border-color: #fff; }
.side .mark:after { background: #fff; }
.side nav { display: grid; gap: 6px; }
.side nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  transition: all var(--transition);
  font-size: 13.5px;
}
.side nav a.active,
.side nav a:hover {
  background: var(--panel2);
  color: white;
}
.side nav a.active {
  box-shadow: inset 3px 0 0 var(--blue);
}
.side-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  padding: 10px;
}

/* ===== Top Bar ===== */
.app-main { min-width: 0; }
.top {
  height: 66px;
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  backdrop-filter: blur(12px);
  background: rgba(11, 12, 14, .8);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top small { color: var(--muted); }
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-actions .app-btn { min-height: 44px; }

/* ===== Content Area ===== */
.app-content {
  padding: 32px;
  max-width: 1280px;
  margin: auto;
}
.app-title {
  font-size: 29px;
  letter-spacing: -.04em;
  margin: 0;
  font-weight: 600;
  background: none;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}

/* ===== Demo Notice ===== */
.demo-notice {
  border: 1px solid #315b8c;
  background: linear-gradient(135deg, #0d1926 0%, #101c2b 100%);
  color: #bcd8fa;
  padding: 15px 18px;
  border-radius: 10px;
  margin: 22px 0;
  font-size: 13.5px;
  line-height: 1.5;
}

/* ===== Repository Card ===== */
.repo {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 24px;
  transition: border-color var(--transition);
}
.repo:hover { border-color: #3d4450; }
.repo h2 { font-size: 18px; margin: 0 0 5px; font-weight: 600; }
.repo p { color: var(--muted); margin: 0; font-size: 13.5px; }

/* ===== Buttons ===== */
.app-btn{border:0;border-radius:8px;background:#f4f4f5;color:#111;padding:10px 18px;font-weight:600;cursor:pointer;min-height:44px;font-size:13.5px;transition:all var(--transition)}
.app-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,255,255,.1);
}
.app-btn.secondary {
  background: var(--panel2);
  color: white;
  border: 1px solid var(--edge);
}
.app-btn.secondary:hover {
  background: #1e2228;
  border-color: #3d4450;
}
.app-btn.danger {
  background: #2a1719;
  color: #ff9b9b;
  border: 1px solid #552a2f;
}
.app-btn.danger:hover {
  background: #351d20;
  border-color: #6b3338;
}
.app-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Scan Section ===== */
.scan-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin: 28px 0 14px;
}
.status {
  font: 500 11px Geist Mono, monospace;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-block;
  letter-spacing: .04em;
}
.status.pass {
  background: #132b1a;
  color: #6dd67c;
  border: 1px solid #1f4d29;
}
.status.fail {
  background: #2a1719;
  color: #ff9b9b;
  border: 1px solid #552a2f;
}
.status.warn {
  background: #2b2211;
  color: #f5c95c;
  border: 1px solid #5e4a1a;
}

/* ===== Findings Table ===== */
.findings-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 36px;
}
.findings-table th,
.findings-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--edge);
}
.findings-table th {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.findings-table tr {
  transition: background var(--transition);
}
.findings-table tr:hover {
  background: var(--panel);
}
.findings-table .sev { font-weight: 600; font-size: 12px; }
.sev.critical { color: var(--red); }
.sev.high { color: var(--orange); }
.sev.medium { color: var(--yellow); }
.sev.low { color: var(--muted); }

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 24px 0;
}
.settings-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 24px;
  transition: border-color var(--transition);
}
.settings-card:hover { border-color: #3d4450; }
.settings-card h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.settings-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.settings-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.settings-card label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.settings-card input,
.settings-card select {
  background: var(--app-bg);
  border: 1px solid var(--edge);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font: 13px Geist, system-ui, sans-serif;
  transition: border-color var(--transition);
}
.settings-card input:focus,
.settings-card select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 161, 255, .12);
}
.plan-badge {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--blue);
  margin-bottom: 12px;
}

/* ===== Auth Pages ===== */
.auth-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-bg);
  color: var(--text);
  font: 14px/1.5 Geist, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}
.auth-page:before {
  content: "";
  position: absolute;
  width: 800px;
  height: 600px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(91, 161, 255, .06) 0%, transparent 60%);
  pointer-events: none;
}
.auth-card {
  width: min(420px, calc(100% - 40px));
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 40px 36px;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,.3), 0 8px 20px rgba(0,0,0,.2);
}
.auth-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 24px;
}
.auth-card .mark {
  width: 22px;
  height: 22px;
  position: relative;
}
.auth-card .mark:before,
.auth-card .mark:after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.5px solid #fff;
  border-radius: 2px;
  transform: rotate(45deg);
}
.auth-card .mark:after {
  inset: 6px;
  background: #fff;
  border-radius: 1px;
}
.auth-card .badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(91, 161, 255, .3);
  color: var(--blue);
  background: rgba(91, 161, 255, .08);
  margin-bottom: 18px;
}
.auth-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -.03em;
  color: var(--text);
  background: none;
  -webkit-text-fill-color: var(--text);
}
.auth-card p {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.6;
}
.auth-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.auth-card label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.auth-card input {
  background: var(--app-bg);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font: 14px Geist, system-ui, sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-card input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 161, 255, .12);
}
.auth-card .app-btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px 18px;
  font-size: 14px;
}
.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 8px;
  min-height: 0;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--edge);
}
.auth-links a {
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
  transition: opacity var(--transition);
}
.auth-links a:hover { opacity: .8; }

/* ===== Finding Detail (app.html) ===== */
.finding-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background var(--transition);
}
.finding-row:hover { background: var(--panel2); }
.finding-row.active { background: var(--panel2); box-shadow: inset 3px 0 0 var(--blue); }
.finding-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

#finding-detail {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 28px;
}
#finding-detail h2 {
  font-size: 18px;
  margin: 8px 0 16px;
  font-weight: 600;
}
#finding-detail .meta {
  color: var(--muted);
  font: 500 12px Geist Mono, monospace;
  margin-bottom: 18px;
}
#finding-detail h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 0 8px;
}
#finding-detail .code {
  background: var(--app-bg);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 14px 16px;
  font: 12.5px/1.6 Geist Mono, monospace;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
#finding-detail .detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 0;
}
#finding-detail .detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 18px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--panel2);
}
#finding-detail .detail-grid h3 { margin-top: 0; }
#finding-detail .detail-grid p {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
}
@media (max-width: 700px) {
  #finding-detail .detail-grid { grid-template-columns: 1fr; }
}

/* ===== Progress ===== */
.progress {
  height: 4px;
  background: var(--panel2);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #8b5cf6);
  border-radius: 4px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.progress-0 { width: 0%; }
.progress-1 { width: 12%; }
.progress-2 { width: 25%; }
.progress-3 { width: 37%; }
.progress-4 { width: 50%; }
.progress-5 { width: 62%; }
.progress-6 { width: 75%; }
.progress-7 { width: 87%; }
.progress-8 { width: 100%; }
.progress-64 { width: 64%; }
.progress-100 { width: 100%; }

/* ===== Summary Metrics ===== */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.metric span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.metric strong {
  font-size: 24px;
  font-weight: 600;
}
.metric .critical { color: var(--red); }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Mobile ===== */
@media(max-width:800px){.top{height:auto;min-height:82px;padding:12px 18px}.top-actions{flex-wrap:wrap}.app-shell{grid-template-columns:1fr}.side{display:none}.settings-grid{grid-template-columns:1fr}.auth-card{padding:32px 24px}}
