/* ============================================================
   EION — interface styles
   Visual language modelled on the ChatGPT mobile app:
   white interior, near-black ink, one accent-free monochrome
   palette, 1.5px round-cap line icons, pill composer.
   Branding stays EION (helm mark, wordmark, voice).
   ============================================================ */

:root{
  --bg:#ffffff;
  --panel:#f9f9f9;
  --ink:#0d0d0d;
  --ink-2:#5d5d5d;
  --ink-3:#9b9b9b;
  --line:#ececec;
  --line-2:#e3e3e3;
  --bubble:#f4f4f4;
  --hover:#f0f0f0;
  --live:#19c37d;

  --r-sm:8px;
  --r-md:12px;
  --r-lg:18px;
  --r-pill:999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --panel-w: min(82vw, 320px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font);
  font-size:16px;
  line-height:1.55;
  letter-spacing:-0.011em;
  -webkit-font-smoothing:antialiased;
  overflow:hidden;
}
button,textarea{font:inherit;letter-spacing:inherit;color:inherit}
button{background:none;border:0;cursor:pointer}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px;border-radius:6px}

/* ---- icon system: one stroke weight, round caps ---- */
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6;
    stroke-linecap:round;stroke-linejoin:round;display:block}

.icon-btn{
  width:40px;height:40px;border-radius:var(--r-sm);
  display:grid;place-items:center;color:var(--ink);
  transition:background .15s;
}
.icon-btn:hover{background:var(--hover)}

/* ============================ Side panel ==================== */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.32);z-index:40;
       animation:fade .18s ease}
@keyframes fade{from{opacity:0}}

.panel{
  position:fixed;inset:0 auto 0 0;width:var(--panel-w);
  background:var(--panel);z-index:50;
  display:flex;flex-direction:column;
  transform:translateX(-100%);
  transition:transform .24s cubic-bezier(.32,.72,0,1);
  padding-bottom:var(--safe-b);
}
.panel.open{transform:none}

.panel-top{display:flex;justify-content:space-between;padding:10px 10px 4px}

.panel-nav,.panel-section{padding:4px 10px}
.row{
  width:100%;display:flex;align-items:center;gap:12px;
  padding:10px;border-radius:var(--r-sm);
  font-size:15px;text-align:left;transition:background .15s;
}
.row:hover{background:var(--hover)}
.row span:first-of-type{flex:1}

.panel-label{
  padding:16px 10px 6px;font-size:12px;font-weight:500;
  color:var(--ink-3);letter-spacing:0;
}
.panel-section{flex:1;overflow-y:auto;min-height:0}
.thread-empty{margin:0;padding:6px 10px;font-size:14px;color:var(--ink-3)}
.thread-item{
  width:100%;text-align:left;padding:9px 10px;border-radius:var(--r-sm);
  font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.thread-item:hover{background:var(--hover)}

.panel-foot{border-top:1px solid var(--line-2);padding:8px 10px}
.pill{
  font-size:12px;color:var(--ink-2);background:var(--bg);
  border:1px solid var(--line-2);border-radius:var(--r-pill);padding:2px 9px;
}
#incognito-toggle[aria-pressed="true"]{background:var(--ink);color:#fff}
#incognito-toggle[aria-pressed="true"] .pill{background:transparent;border-color:#555;color:#fff}

.identity{display:flex;align-items:center;gap:10px;padding:10px}
.avatar{
  width:28px;height:28px;border-radius:50%;background:var(--ink);color:#fff;
  display:grid;place-items:center;font-size:13px;font-weight:600;
}
.identity-name{font-size:14.5px}

/* ============================ App shell ===================== */
.app{height:100%;display:flex;flex-direction:column}

.topbar{
  display:flex;align-items:center;gap:4px;
  padding:6px 8px;border-bottom:1px solid transparent;
  background:var(--bg);
}
.wordmark{
  flex:1;text-align:center;font-size:17px;font-weight:600;
  letter-spacing:.14em;display:flex;align-items:center;justify-content:center;gap:7px;
}
.dot{width:6px;height:6px;border-radius:50%;background:var(--ink-3);transition:background .3s}
.dot.live{background:var(--live)}
.dot.down{background:#e5484d}

/* ============================ Thread ======================== */
.thread{
  flex:1;overflow-y:auto;overscroll-behavior:contain;
  padding:8px 0 12px;
}
.thread-inner{max-width:720px;margin:0 auto;padding:0 16px}

.welcome{
  height:100%;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:18px;padding:24px;
}
.helm{width:56px;height:56px;color:var(--ink);opacity:.9}
.welcome h1{
  margin:0;font-size:25px;font-weight:600;letter-spacing:-0.02em;text-align:center;
}
.starters{display:flex;flex-direction:column;gap:8px;width:100%;max-width:340px}
.starter{
  border:1px solid var(--line-2);border-radius:var(--r-md);
  padding:11px 14px;font-size:14.5px;color:var(--ink-2);text-align:left;
  transition:background .15s,color .15s;
}
.starter:hover{background:var(--hover);color:var(--ink)}

/* messages: user = right pill, assistant = plain full-width text */
.msg{max-width:720px;margin:0 auto;padding:6px 16px;animation:rise .22s ease both}
@keyframes rise{from{opacity:0;transform:translateY(6px)}}

.msg.user{display:flex;justify-content:flex-end}
.msg.user .body{
  background:var(--bubble);border-radius:var(--r-lg);
  padding:10px 15px;max-width:85%;white-space:pre-wrap;
}
.msg.eion .body{white-space:pre-wrap}
.msg.eion .who{
  font-size:12px;font-weight:600;color:var(--ink-3);
  letter-spacing:.1em;margin-bottom:5px;
}

.thinking{display:flex;gap:5px;padding:10px 16px;max-width:720px;margin:0 auto}
.thinking i{width:6px;height:6px;border-radius:50%;background:var(--ink-3);
            animation:blink 1.2s infinite}
.thinking i:nth-child(2){animation-delay:.18s}
.thinking i:nth-child(3){animation-delay:.36s}
@keyframes blink{0%,80%,100%{opacity:.25}40%{opacity:1}}

.notice{
  max-width:720px;margin:6px auto;padding:10px 16px;
  font-size:14px;color:var(--ink-2);
}
.notice b{color:var(--ink);font-weight:600}

/* ============================ Composer ====================== */
.composer-wrap{
  padding:6px 12px calc(10px + var(--safe-b));
  background:var(--bg);
}
.composer{
  max-width:720px;margin:0 auto;
  display:flex;align-items:flex-end;gap:6px;
  background:var(--bg);border:1px solid var(--line-2);
  border-radius:26px;padding:5px 6px 5px 5px;
  transition:border-color .15s;
}
.composer:focus-within{border-color:#c9c9c9}
.composer textarea{
  flex:1;border:0;resize:none;background:transparent;
  padding:9px 4px;max-height:170px;font-size:16px;line-height:1.45;
}
.composer textarea:focus{outline:none}
.composer textarea::placeholder{color:var(--ink-3)}
.composer-btn{
  width:36px;height:36px;border-radius:50%;display:grid;place-items:center;
  color:var(--ink-2);flex:none;transition:background .15s,color .15s;
}
.composer-btn:hover{background:var(--hover);color:var(--ink)}
.composer-btn.on{background:var(--ink);color:#fff}

.send{
  width:36px;height:36px;border-radius:50%;flex:none;
  display:grid;place-items:center;background:var(--ink);color:#fff;
  transition:opacity .15s,transform .15s;
}
.send:disabled{opacity:.22;cursor:default}
.send:not(:disabled):active{transform:scale(.94)}

.tools{
  max-width:720px;margin:0 auto 8px;display:flex;flex-direction:column;gap:2px;
  border:1px solid var(--line-2);border-radius:var(--r-md);padding:5px;
  animation:rise .18s ease both;
}
.tool{
  display:flex;align-items:center;gap:11px;padding:9px 10px;
  border-radius:var(--r-sm);font-size:14.5px;text-align:left;
}
.tool:hover{background:var(--hover)}

.disclaimer{
  margin:8px auto 0;text-align:center;font-size:11.5px;color:var(--ink-3);
}

/* ==================== Neural Interface ====================== */
.orb-launch{
  position:fixed;right:16px;bottom:calc(96px + var(--safe-b));z-index:30;
  width:48px;height:48px;border-radius:50%;
  background:var(--ink);display:grid;place-items:center;
  box-shadow:0 6px 20px rgba(0,0,0,.18);
  transition:transform .18s;
}
.orb-launch:active{transform:scale(.93)}
.orb-launch-core{
  width:16px;height:16px;border-radius:50%;
  background:#fff;animation:breathe 3.2s ease-in-out infinite;
}
@keyframes breathe{50%{transform:scale(.62);opacity:.6}}

.neural{
  position:fixed;inset:0;z-index:60;background:var(--bg);
  display:flex;flex-direction:column;
  padding-bottom:var(--safe-b);
  animation:sheet .26s cubic-bezier(.32,.72,0,1) both;
}
@keyframes sheet{from{transform:translateY(14px);opacity:0}}

.neural-top{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 12px 8px;
}
.neural-title{font-size:16px;font-weight:600}
.neural-sub{font-size:12.5px;color:var(--ink-3);letter-spacing:.06em;text-transform:uppercase}

.neural-stage{
  padding:22px 16px 10px;display:flex;flex-direction:column;
  align-items:center;gap:14px;
}
.orb{position:relative;width:132px;height:132px;display:grid;place-items:center}
.orb .ring,.orb .core{position:absolute;border-radius:50%}
.orb .ring{inset:0;border:1px solid var(--line-2);animation:spin 14s linear infinite}
.orb .ring.r2{inset:16px;border-style:dashed;animation-duration:22s;animation-direction:reverse}
.orb .core{
  width:56px;height:56px;background:var(--ink);
  animation:pulse 3s ease-in-out infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pulse{50%{transform:scale(.82)}}
.orb.busy .core{animation-duration:.9s}
.orb.listening .core{background:var(--live)}

.neural-hint{margin:0;font-size:14px;color:var(--ink-3)}
.neural-log{flex:1;overflow-y:auto;padding:6px 0 10px;min-height:0}
.neural-composer{margin:0 12px 10px}

/* ============================ Desktop ======================= */
@media (min-width:900px){
  body{overflow:auto}
  .panel{transform:none;box-shadow:none;border-right:1px solid var(--line-2)}
  .scrim{display:none}
  .app{margin-left:var(--panel-w)}
  #panel-open,#panel-close{display:none}
  .topbar{justify-content:flex-start}
  .wordmark{justify-content:flex-start;padding-left:6px}
  .welcome h1{font-size:30px}
  .starters{flex-direction:row;max-width:640px;flex-wrap:wrap;justify-content:center}
  .starter{flex:1 1 190px}
  .neural{
    inset:auto 20px 20px auto;width:400px;height:620px;
    border:1px solid var(--line-2);border-radius:20px;
    box-shadow:0 18px 50px rgba(0,0,0,.16);overflow:hidden;
  }
  .orb-launch{bottom:20px}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition:none!important}
}

/* ============================================================
   Side-panel additions.
   Same type scale, same icon weight, same greys as the chat —
   only the option set is new. Nothing below this line touches
   the thread or the composer.
   ============================================================ */

.search{
  display:flex;align-items:center;gap:8px;margin:2px 10px 6px;
  padding:8px 10px;background:var(--bg);border:1px solid var(--line-2);
  border-radius:var(--r-sm);
}
.search svg{width:18px;height:18px;color:var(--ink-3);flex:none}
.search input{
  flex:1;border:0;background:transparent;font-size:14.5px;
  letter-spacing:inherit;min-width:0;
}
.search input:focus{outline:none}
.search input::placeholder{color:var(--ink-3)}
.search input::-webkit-search-cancel-button{-webkit-appearance:none}

.count{
  font-size:12px;color:var(--ink-3);background:var(--bg);
  border:1px solid var(--line-2);border-radius:var(--r-pill);
  padding:1px 8px;flex:none;
}
.count.muted{color:var(--ink-3);border-style:dashed}
.row.is-off{opacity:.5;cursor:default}
.row.is-off:hover{background:none}

.panel-label{display:flex;align-items:center;justify-content:space-between}
.mini{
  width:26px;height:26px;border-radius:var(--r-sm);display:grid;place-items:center;
  color:var(--ink-3);transition:background .15s,color .15s;
}
.mini:hover{background:var(--hover);color:var(--ink)}
.mini svg{width:17px;height:17px}

.empty-note{margin:0;padding:4px 10px 8px;font-size:13px;color:var(--ink-3);line-height:1.45}

.thread-item,.project-item{
  width:100%;display:flex;align-items:center;gap:9px;
  padding:9px 10px;border-radius:var(--r-sm);font-size:14.5px;
  text-align:left;transition:background .15s;
}
.thread-item:hover,.project-item:hover{background:var(--hover)}
.thread-item.active,.project-item.active{background:var(--hover);font-weight:500}
.thread-item .label,.project-item .label{
  flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.project-item svg{width:17px;height:17px;color:var(--ink-3);flex:none}
.thread-item .kill{
  width:24px;height:24px;border-radius:6px;display:grid;place-items:center;
  color:var(--ink-3);opacity:0;flex:none;
}
.thread-item:hover .kill{opacity:1}
.thread-item .kill:hover{background:var(--line-2);color:var(--ink)}
.thread-item .kill svg{width:15px;height:15px}

/* ---- sheets: projects, artifacts, instructions ---- */
.sheet{
  position:fixed;inset:0;z-index:70;background:rgba(0,0,0,.32);
  display:grid;place-items:end center;animation:fade .18s ease;
}
.sheet-card{
  width:100%;max-width:560px;max-height:86vh;background:var(--bg);
  border-radius:20px 20px 0 0;display:flex;flex-direction:column;
  padding-bottom:var(--safe-b);animation:sheet .24s cubic-bezier(.32,.72,0,1) both;
}
.sheet-top{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 10px 10px 18px;border-bottom:1px solid var(--line);
}
.sheet-top h2{margin:0;font-size:16px;font-weight:600;letter-spacing:-0.01em}
.sheet-body{flex:1;overflow-y:auto;padding:12px 18px}
.sheet-foot:not(:empty){padding:10px 18px 16px;border-top:1px solid var(--line)}

.field{width:100%;border:1px solid var(--line-2);border-radius:var(--r-md);
  padding:10px 12px;font-size:15px;background:var(--bg);resize:vertical}
.field:focus{outline:none;border-color:#c9c9c9}
.field + .field{margin-top:8px}
.field-hint{margin:6px 0 14px;font-size:12.5px;color:var(--ink-3);line-height:1.5}

.btn{
  border-radius:var(--r-pill);padding:10px 18px;font-size:14.5px;font-weight:500;
  background:var(--ink);color:#fff;
}
.btn.ghost{background:transparent;color:var(--ink-2);border:1px solid var(--line-2)}
.btn:active{transform:scale(.98)}

.artifact{
  border:1px solid var(--line-2);border-radius:var(--r-md);
  margin-bottom:10px;overflow:hidden;
}
.artifact-head{
  display:flex;align-items:center;gap:10px;padding:9px 12px;
  border-bottom:1px solid var(--line);font-size:13px;color:var(--ink-2);
}
.artifact-head .lang{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;
  text-transform:uppercase;letter-spacing:.08em;flex:1;
}
.artifact pre{
  margin:0;padding:12px;overflow-x:auto;background:var(--bubble);
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;line-height:1.55;
}

@media (min-width:900px){
  .sheet{place-items:center}
  .sheet-card{border-radius:20px;max-height:78vh}
}
