:root{
  --bg:#020712;
  --panel:#071120;
  --glass:rgba(8,18,34,.72);
  --line:rgba(130,190,255,.16);
  --ink:#f3f8ff;
  --muted:#aebcd1;
  --dim:#6f819a;
  --cyan:#5ee7ff;
  --blue:#6ea8ff;
  --purple:#9c6dff;
  --green:#2dffb0;
  --gold:#ffc85f;
  --red:#ff5b65;
  --orange:#ffb347;
  --shadow:0 30px 90px rgba(0,0,0,.46);
}

*{box-sizing:border-box}

body{
  margin:0;
  color:var(--ink);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(900px 600px at 50% 0%,rgba(94,231,255,.16),transparent 60%),
    radial-gradient(700px 520px at 82% 34%,rgba(156,109,255,.12),transparent 65%),
    linear-gradient(180deg,#01040a,#06101e 48%,#01040a);
  overflow-x:hidden;
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.014) 1px,transparent 1px);
  background-size:54px 54px;
  mask-image:radial-gradient(circle at 50% 30%,black,transparent 72%);
}

a{color:inherit;text-decoration:none}

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

.sidebar{
  border-right:1px solid var(--line);
  background:
    linear-gradient(180deg,rgba(255,255,255,.045),rgba(255,255,255,.012)),
    rgba(2,8,18,.76);
  backdrop-filter:blur(22px);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
}

.logo{
  display:flex;
  align-items:center;
  gap:12px;
  padding-bottom:22px;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.logo-orb{
  width:58px;
  height:58px;
  border-radius:50%;
  display:grid;
  place-items:center;
  border:1px solid rgba(94,231,255,.34);
  background:radial-gradient(circle at 35% 20%,rgba(255,255,255,.22),rgba(94,231,255,.12),rgba(156,109,255,.12));
  color:var(--cyan);
  font-size:32px;
  box-shadow:0 0 28px rgba(94,231,255,.16);
}

.logo span{
  font-size:12px;
  letter-spacing:.12em;
  color:var(--muted);
}

.logo b{
  display:block;
  font-size:25px;
  line-height:.95;
}

.nav-title{
  color:var(--muted);
  font-size:12px;
  letter-spacing:.14em;
  margin:22px 10px 12px;
}

.side-nav{
  display:grid;
  gap:6px;
}

.side-nav a{
  padding:13px 14px;
  border-radius:12px;
  color:#d8e6f8;
  border:1px solid transparent;
}

.side-nav a:hover,
.side-nav a.active{
  background:rgba(156,109,255,.20);
  border-color:rgba(156,109,255,.24);
}

.ava-mark{
  position:absolute;
  left:14px;
  right:14px;
  bottom:18px;
  border:1px solid var(--line);
  border-radius:18px;
  padding:22px 16px;
  text-align:center;
  background:rgba(255,255,255,.035);
}

.ava-mark strong{
  display:block;
  font-size:44px;
  letter-spacing:.08em;
  color:#d7e8ff;
}

.ava-mark span{
  display:block;
  color:var(--cyan);
  text-transform:uppercase;
  font-size:12px;
  letter-spacing:.1em;
}

.ava-mark em{
  display:block;
  color:var(--muted);
  font-style:normal;
  margin-top:10px;
  font-size:12px;
}

.main-stage{
  padding:14px;
}

.topbar{
  min-height:70px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:14px 20px;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--glass);
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
}

.topbar h1{
  margin:0;
  font-size:18px;
}

.topbar p{
  margin:5px 0 0;
  color:var(--muted);
  font-size:13px;
}

.top-actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.top-actions span{
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 14px;
  background:rgba(255,255,255,.04);
  font-size:13px;
  font-weight:800;
}

.rag-status.online{color:var(--green)}
.rag-status.offline{color:var(--red)}
.mode-pill{color:var(--purple)}
.user-pill{color:#fff}

.consult-grid{
  display:grid;
  grid-template-columns:minmax(620px,1fr) 410px;
  gap:14px;
  margin-top:14px;
}

.center-column,
.right-column{
  display:grid;
  gap:14px;
  align-content:start;
}

.question-panel,
.answer-panel,
.branches-panel,
.mini-panel,
.intel-panel{
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--glass);
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
  padding:18px;
}

.question-panel label,
.section-head{
  color:var(--cyan);
  text-transform:uppercase;
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  margin-bottom:12px;
}

textarea,
input,
select{
  width:100%;
  border:1px solid rgba(130,190,255,.14);
  border-radius:12px;
  background:rgba(2,8,18,.66);
  color:var(--ink);
  padding:12px;
  outline:none;
}

textarea{
  min-height:86px;
  resize:vertical;
  font-size:18px;
  font-weight:800;
}

textarea.context{
  min-height:58px;
  margin-top:10px;
  font-size:13px;
  font-weight:500;
}

.input-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  margin-top:10px;
}

#askBtn{
  margin-top:12px;
  width:100%;
  border:0;
  border-radius:14px;
  padding:14px;
  cursor:pointer;
  color:#001018;
  font-weight:950;
  background:linear-gradient(135deg,var(--cyan),var(--blue));
  box-shadow:0 0 28px rgba(94,231,255,.22);
}

#askBtn:disabled{
  opacity:.7;
  cursor:not-allowed;
}

.empty-state,
.empty-small{
  color:var(--muted);
  font-size:13px;
}

.answer-card{
  display:grid;
  gap:14px;
}

.answer-block{
  display:grid;
  grid-template-columns:54px 1fr;
  gap:14px;
  padding:14px;
  border:1px solid rgba(130,190,255,.12);
  border-radius:16px;
  background:rgba(255,255,255,.035);
}

.answer-icon{
  width:48px;
  height:48px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(45,255,176,.13);
  color:var(--green);
}

.answer-icon.purple{
  background:rgba(156,109,255,.16);
  color:var(--purple);
}

.answer-block h3{
  margin:0 0 8px;
  color:var(--cyan);
  font-size:13px;
  text-transform:uppercase;
}

.answer-block p{
  margin:0;
  line-height:1.55;
}

.disclaimer,
.memory-note{
  color:var(--muted);
  font-size:12px;
  border:1px solid rgba(130,190,255,.10);
  border-radius:14px;
  padding:12px;
  background:rgba(255,255,255,.025);
}

.branches-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
}

.branch-card{
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,.035);
}

.branch-card.expected{border-color:rgba(45,255,176,.38)}
.branch-card.possible{border-color:rgba(255,179,71,.42)}
.branch-card.concerning,
.branch-card.dangerous{border-color:rgba(255,91,101,.44)}

.branch-title{
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:10px;
  text-transform:uppercase;
  font-size:13px;
}

.branch-card.expected .branch-title{color:var(--green)}
.branch-card.possible .branch-title{color:var(--orange)}
.branch-card.concerning .branch-title,
.branch-card.dangerous .branch-title{color:var(--red)}

.branch-card p{
  color:#e7f1ff;
  line-height:1.42;
  font-size:13px;
}

.branch-card h4{
  color:var(--cyan);
  margin:14px 0 6px;
  font-size:11px;
  text-transform:uppercase;
}

.branch-card ul{
  margin:0;
  padding-left:18px;
  color:var(--muted);
  font-size:12px;
}

.likelihood{
  margin-top:12px;
  color:var(--gold);
  text-transform:uppercase;
  font-size:12px;
  font-weight:900;
}

.bottom-panels{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.check-list,
.alert-list{
  columns:2;
  list-style:none;
  padding:0;
  margin:0;
}

.check-list li,
.alert-list li{
  margin:7px 0;
  font-size:12px;
  color:var(--muted);
}

.check-list li:before{
  content:"✓";
  color:var(--green);
  margin-right:8px;
}

.alert-list li:before{
  content:"●";
  color:var(--red);
  margin-right:8px;
}

.frame-list{
  display:grid;
  grid-template-columns:120px 1fr;
  gap:8px 12px;
  margin:0;
  font-size:13px;
}

.frame-list dt{color:var(--muted)}
.frame-list dd{margin:0;color:#fff}
.frame-list .risk{color:var(--red);font-weight:900;text-transform:uppercase}

.safety-card{
  display:flex;
  justify-content:space-between;
  gap:10px;
  border:1px solid rgba(255,91,101,.28);
  border-radius:12px;
  padding:12px;
  margin-bottom:10px;
  background:rgba(255,91,101,.055);
}

.safety-card b{
  color:#fff;
}

.safety-card p{
  color:var(--muted);
  margin:6px 0 0;
  font-size:12px;
}

.safety-card span{
  color:#fff;
  background:rgba(255,91,101,.16);
  border:1px solid rgba(255,91,101,.34);
  height:max-content;
  border-radius:999px;
  padding:4px 8px;
  font-size:10px;
  text-transform:uppercase;
}

.evidence-strength strong{
  display:block;
  color:var(--purple);
  font-size:22px;
  margin-bottom:10px;
}

.strength-meter{
  display:flex;
  gap:6px;
}

.strength-meter i{
  width:14px;
  height:14px;
  border-radius:3px;
  background:rgba(255,255,255,.08);
}

.strength-meter i.on{
  background:var(--purple);
  box-shadow:0 0 12px rgba(156,109,255,.45);
}

.evidence-card{
  display:grid;
  grid-template-columns:34px 1fr;
  gap:10px;
  border-bottom:1px solid rgba(255,255,255,.08);
  padding:12px 0;
}

.evidence-rank{
  width:30px;
  height:30px;
  border-radius:8px;
  display:grid;
  place-items:center;
  background:rgba(156,109,255,.18);
  color:#fff;
  font-weight:900;
}

.evidence-card h4{
  margin:0 0 6px;
  color:var(--purple);
}

.evidence-meta{
  display:flex;
  gap:8px;
  color:var(--green);
  font-size:11px;
  margin-bottom:8px;
}

.evidence-card p{
  color:var(--muted);
  font-size:12px;
  line-height:1.38;
  margin:0 0 8px;
}

.evidence-card small{
  color:#d7e8ff;
}

.grounding{
  display:inline-flex;
  border-radius:999px;
  padding:10px 14px;
  font-weight:950;
}

.grounding-grounded{
  color:var(--green);
  background:rgba(45,255,176,.10);
}

.grounding-partially_grounded{
  color:var(--gold);
  background:rgba(255,200,95,.10);
}

.grounding-ungrounded{
  color:var(--red);
  background:rgba(255,91,101,.10);
}

.figure8-bar{
  margin-top:14px;
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(6,15,28,.84);
  padding:18px;
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  box-shadow:var(--shadow);
}

.figure8-bar span{
  color:var(--cyan);
  font-weight:900;
  text-transform:uppercase;
  font-size:12px;
}

.figure8-bar b{
  font-size:36px;
  color:var(--purple);
}

.figure8-bar i{
  font-style:normal;
  color:var(--cyan);
  font-weight:800;
  font-size:12px;
  text-transform:uppercase;
}

.figure8-bar em{
  font-style:normal;
  color:var(--purple);
}

.error-card{
  border:1px solid rgba(255,91,101,.35);
  border-radius:14px;
  background:rgba(255,91,101,.08);
  padding:16px;
  color:#fff;
}

body[data-figure8="retrieve"] .figure8-bar,
body[data-figure8="reason"] .answer-panel,
body[data-figure8="branch"] .branches-panel,
body[data-figure8="safety"] .right-column,
body[data-figure8="return"] .grounding{
  box-shadow:0 0 34px rgba(94,231,255,.16),var(--shadow);
}

@media(max-width:1200px){
  .atlas-shell{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto}
  .ava-mark{position:relative;left:auto;right:auto;bottom:auto;margin-top:18px}
  .consult-grid{grid-template-columns:1fr}
}

@media(max-width:760px){
  .input-grid,
  .branches-grid,
  .bottom-panels{
    grid-template-columns:1fr;
  }

  .check-list,
  .alert-list{
    columns:1;
  }

  .topbar{
    align-items:flex-start;
    flex-direction:column;
  }
}
/* ============================================================
   CONSULT DR. ATLAS FACELIFT PATCH
============================================================ */

.question-panel textarea#questionInput{
  min-height:104px;
  font-size:16px;
  font-weight:600;
  line-height:1.55;
  letter-spacing:.01em;
  color:#eef7ff;
}

.question-panel textarea#questionInput::placeholder{
  color:rgba(174,188,209,.72);
  font-weight:500;
}

.note-panel{
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--glass);
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
  padding:18px;
}

.note-actions{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:10px;
  margin-bottom:12px;
}

.note-actions button{
  border:1px solid rgba(130,190,255,.18);
  border-radius:12px;
  padding:12px;
  cursor:pointer;
  color:#eaf6ff;
  font-weight:850;
  background:
    linear-gradient(145deg,rgba(255,255,255,.07),rgba(255,255,255,.02)),
    rgba(8,18,34,.62);
}

.note-actions button:hover{
  border-color:rgba(94,231,255,.34);
  box-shadow:0 0 24px rgba(94,231,255,.12);
}

#noteOutput{
  min-height:360px;
  font-size:13px;
  font-weight:500;
  line-height:1.55;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
}

.evidence-box{
  max-height:720px;
  overflow:auto;
}

.evidence-summary{
  border:1px solid rgba(94,231,255,.16);
  border-radius:12px;
  padding:10px;
  color:var(--muted);
  margin-bottom:10px;
  background:rgba(94,231,255,.045);
  font-size:12px;
}

.evidence-summary b{
  color:var(--cyan);
}

.figure8-bar span{
  color:var(--cyan);
}

.figure8-bar span::after{
  content:"";
}

@media(max-width:760px){
  .note-actions{
    grid-template-columns:1fr;
  }
}
.citation-integrity-note{
  border:1px solid rgba(255,200,95,.24);
  border-radius:12px;
  padding:10px;
  margin-bottom:10px;
  background:rgba(255,200,95,.07);
  color:var(--gold);
  font-size:12px;
  line-height:1.4;
}

.evidence-card.suppressed{
  opacity:.72;
  border-left:3px solid rgba(255,91,101,.55);
}

.evidence-card.cited{
  border-left:3px solid rgba(45,255,176,.55);
}

.evidence-card.suppressed small b{
  color:var(--red);
}

.evidence-card.cited small b{
  color:var(--green);
}
