:root {
  --bg: #07060f;
  --ink: #f4f1ff;
  --muted: #a39bbd;
  --dim: #6e6786;
  --line: rgba(255,255,255,.08);
  --glass: rgba(18, 16, 32, .72);
  --violet: #b06bff;
  --blue: #5b7cff;
  --cyan: #3ee0ff;
  --up: #3ee0a0;
  --down: #ff5d73;
  --warn: #ffc14d;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --display: "Syne", "Outfit", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; }
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(820px 480px at -10% -10%, rgba(176,107,255,.34), transparent 60%),
    radial-gradient(680px 420px at 110% 0%, rgba(62,224,255,.16), transparent 55%),
    radial-gradient(500px 300px at 70% 110%, rgba(91,124,255,.14), transparent 50%);
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
img { max-width: 100%; }

.app { position: relative; z-index: 1; min-height: 100vh; display: flex; }
.side {
  display: none;
  width: 232px; flex: 0 0 232px;
  padding: calc(18px + var(--safe-t)) 14px 18px;
  border-right: 1px solid var(--line);
  background: rgba(7,6,15,.55);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; height: 100vh;
  flex-direction: column;
}
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  background: rgba(7,6,15,.55);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.view { padding: 16px 16px calc(92px + var(--safe-b)); max-width: 1100px; width: 100%; margin: 0 auto; }
.view > .block { animation: rise .45s ease both; }
.view > .block:nth-child(2) { animation-delay: .04s; }
.view > .block:nth-child(3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tabs {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 20;
  display: flex; gap: 4px; padding: 6px;
  border-radius: 22px;
  background: rgba(16, 14, 28, .78);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.tab, .nav-btn {
  flex: 1; border: 0; background: transparent; color: var(--dim);
  border-radius: 16px; padding: 8px 4px; font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab .ico, .nav-btn .ico { font-size: 16px; line-height: 1; }
.tab.on, .nav-btn.on { color: white; background: linear-gradient(180deg, rgba(176,107,255,.35), rgba(62,224,255,.12)); }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 16px; }
.mark {
  width: 36px; height: 36px; border-radius: 12px; position: relative;
  background: linear-gradient(135deg, #b06bff, #5b7cff 55%, #3ee0ff);
  box-shadow: 0 0 22px rgba(140,90,255,.45);
}
.mark svg { width: 36px; height: 36px; display: block; }
.word { font-family: var(--display); font-weight: 800; letter-spacing: -.04em; font-size: 22px; line-height: 1; }
.word span { background: linear-gradient(90deg, #fff, #c9b6ff 40%, #7ef0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }

.side .nav-btn { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 11px 12px; font-size: 14px; margin-bottom: 4px; }
.side-foot { margin-top: auto; font-size: 11px; color: var(--dim); line-height: 1.45; padding: 10px; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.hero {
  position: relative; overflow: hidden;
  padding: 22px 18px 18px;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(176,107,255,.22), rgba(16,14,28,.2) 42%, rgba(62,224,255,.08)),
    var(--glass);
  border: 1px solid var(--line);
}
.hero h1 { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -.04em; margin: 8px 0 6px; line-height: .95; }
.lede { color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
  border-radius: 999px; padding: 10px 14px; font-weight: 600; font-size: 13px;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  border: 0; color: #140a22;
  background: linear-gradient(90deg, #d7b1ff, #8eb6ff 45%, #7af0ff);
  box-shadow: 0 8px 24px rgba(120,90,255,.28);
}
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb3bd; border-color: rgba(255,93,115,.4); }
.btn.tiny { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: wait; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.kpi .lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.kpi .val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; margin-top: 4px; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .dim { color: var(--dim); }
.xs { font-size: 12px; } .tiny { font-size: 11px; color: var(--dim); }

.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 8px; }
.sec h2 { margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 650; }

.watch-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 2px 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.watch-row:last-child { border-bottom: 0; }
.sym { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.pill {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 7px; border: 1px solid var(--line); color: var(--muted);
}
.pill.ai { color: #d7c6ff; border-color: rgba(176,107,255,.45); }
.pill.bad { color: #ffb3bd; border-color: rgba(255,93,115,.4); }
.px { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.chg { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.meta { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; color: var(--dim); font-size: 12px; }
.spark { width: 88px; height: 28px; justify-self: end; }
.spark path { fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
input, select, textarea {
  background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 12px; outline: none; width: 100%;
}
textarea { min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(126,240,255,.55); box-shadow: 0 0 0 3px rgba(62,224,255,.12); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 999px; border: 1px solid var(--line); background: transparent; padding: 7px 10px; font-size: 12px; color: var(--muted); }
.chip.on { color: white; border-color: transparent; background: linear-gradient(90deg, rgba(176,107,255,.7), rgba(62,224,255,.45)); }

.drop {
  border: 1px dashed rgba(176,107,255,.45);
  border-radius: 18px; padding: 16px; text-align: center; color: var(--muted);
  background: rgba(176,107,255,.05);
}
.drop strong { color: var(--ink); }

.score {
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(#3ee0a0 calc(var(--p) * 1%), rgba(255,255,255,.08) 0);
  box-shadow: 0 0 28px rgba(62,224,255,.18);
}
.score span {
  width: 70px; height: 70px; border-radius: 50%; background: #100e1c;
  display: grid; place-items: center; font-family: var(--display); font-size: 22px;
}
.head-row { display: flex; gap: 14px; align-items: center; }
.rating { font-family: var(--display); font-size: 28px; margin: 0; letter-spacing: -.03em; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.level { padding: 10px; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.level b { display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.check:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--down); }
.dot.ok { background: var(--up); box-shadow: 0 0 8px var(--up); }

.scan {
  display: grid; place-items: center; min-height: 280px; text-align: center; gap: 8px;
}
.orb {
  width: 86px; height: 86px; border-radius: 50%;
  background: conic-gradient(from 0deg, #b06bff, #3ee0ff, transparent 62%, #b06bff);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%);
  animation: spin 1s linear infinite;
  filter: drop-shadow(0 0 12px rgba(176,107,255,.6));
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; }

.chart-card svg { width: 100%; height: 160px; display: block; }
.chart-card path.line { fill: none; stroke: url(#evaStroke); stroke-width: 2; stroke-linecap: round; }

.list-card + .list-card { margin-top: 8px; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.subnav .chip { flex: none; }

.chat-log { display: flex; flex-direction: column; gap: 8px; min-height: 240px; }
.bubble { max-width: 92%; padding: 10px 12px; border-radius: 16px; line-height: 1.4; }
.bubble.user { align-self: flex-end; background: linear-gradient(180deg, rgba(176,107,255,.35), rgba(91,124,255,.2)); }
.bubble.eva { align-self: flex-start; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.composer { display: flex; gap: 8px; margin-top: 10px; }
.composer input { flex: 1; }

.lesson h3 { font-family: var(--display); margin: 0 0 8px; }
.lesson p { color: var(--muted); line-height: 1.5; }
.choice { display: block; width: 100%; text-align: left; margin-top: 6px; }

.pin {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.pin form { width: min(360px, 100%); }

#toasts { position: fixed; top: calc(12px + var(--safe-t)); right: 12px; left: 12px; z-index: 40; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; margin-left: auto; max-width: 360px; padding: 10px 12px; border-radius: 14px; background: #161226; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast.err { border-color: rgba(255,93,115,.5); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; display: grid; place-items: end center; padding: 12px; }
.modal { width: min(520px, 100%); max-height: 86vh; overflow: auto; }

.fine { font-size: 11px; color: var(--dim); line-height: 1.45; margin-top: 14px; }

@media (min-width: 960px) {
  .side { display: flex; }
  .tabs { display: none; }
  .view { padding: 28px 32px 48px; }
  .top .mob-brand { display: none; }
  .kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .home-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; align-items: start; }
  .hero h1 { font-size: 52px; }
}
@media (max-width: 959px) {
  .home-grid { display: block; }
}
