/* KAIRO v2 — fresh mint identity, mobile-first */
:root{
  --emerald:#2dd4a7;
  --rose:#f472b6; --azure:#38bdf8; --violet:#a78bfa; --amber:#fbbf24;
  --accent:var(--emerald);
}
[data-theme="dark"]{
  --bg:#0a1210; --bg2:#0e1714; --card:#121d18; --line:#1e2f28;
  --text:#e8f3ee; --text2:#7fa296; --user:#0f2b22;
}
[data-theme="light"]{
  --bg:#eef7f3; --bg2:#ffffff; --card:#ffffff; --line:#d5e5de;
  --text:#0c1f18; --text2:#4e6f63; --user:#d7f3e8;
}
[data-fontsize="small"]{ --fs:14px; }
[data-fontsize="medium"]{ --fs:16px; }
[data-fontsize="large"]{ --fs:18px; }

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
body{
  font-family:'Segoe UI', Tahoma,'Noto Naskh Arabic', system-ui,sans-serif;
  font-size:var(--fs); background:var(--bg); color:var(--text);
}
#shell{ max-width:720px; margin:0 auto; height:100dvh; display:flex; flex-direction:column; padding:env(safe-area-inset-top) 12px 0; }

/* ---- top ---- */
#top{ display:flex; align-items:center; justify-content:space-between; padding:12px 2px 10px; border-bottom:1px solid var(--line); }
#brand{ display:flex; gap:8px; align-items:center; font-weight:800; letter-spacing:.06em; }
#logo{ color:var(--accent); font-size:18px; animation:pulse 3s ease-in-out infinite; }
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.45} }
@media (prefers-reduced-motion:reduce){ #logo{ animation:none } *{ transition:none !important } }
#topActions{ display:flex; gap:8px; }
.chip-btn{
  background:var(--card); border:1px solid var(--line); color:var(--text2);
  border-radius:999px; padding:6px 14px; font-size:13px; cursor:pointer; font-family:inherit;
}
.chip-btn[aria-expanded="true"]{ color:var(--accent); border-color:var(--accent); }

/* ---- feed ---- */
#feed{ flex:1; overflow-y:auto; padding:16px 2px 8px; scroll-behavior:smooth; }
.msg{ max-width:86%; margin:0 0 14px; }
.msg--user{ margin-inline-start:auto; }
.msg--ai{ margin-inline-end:auto; }
.msg__who{ font-size:11px; color:var(--text2); margin-bottom:4px; letter-spacing:.05em; }
.msg__body{
  padding:11px 14px; border-radius:18px; line-height:1.75;
  unicode-bidi:plaintext; overflow-wrap:anywhere; white-space:pre-wrap;
}
.msg--user .msg__body{ background:var(--accent); color:#03130d; border-end-end-radius:6px; }
.msg--ai .msg__body{ background:var(--card); border:1px solid var(--line); border-end-start-radius:6px; }
.msg--ai .msg__body--ok{ border-color:color-mix(in srgb, var(--accent) 45%, var(--line)); }
.msg--ai .msg__body--err{ border-color:#e0596b; }

/* inline citations */
.cite{ display:inline-block; min-width:16px; text-align:center; background:color-mix(in srgb, var(--accent) 20%, transparent); color:var(--accent); border-radius:6px; font-size:.75em; padding:0 4px; margin:0 1px; cursor:pointer; }

/* sources */
.sources{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.source-chip{
  background:var(--card); border:1px solid var(--line); color:var(--text2);
  font-size:11px; padding:4px 10px; border-radius:999px; max-width:240px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-decoration:none;
}

/* welcome */
.welcome{ text-align:center; padding:12vh 12px 20px; }
.welcome__orb{
  width:72px; height:72px; margin:0 auto 18px; border-radius:24px;
  display:grid; place-items:center; font-size:30px; color:#03130d;
  background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #38bdf8));
  box-shadow:0 10px 40px -10px var(--accent);
}
.welcome h1{ font-size:22px; margin-bottom:8px; }
.welcome p{ color:var(--text2); font-size:14px; line-height:1.8; max-width:400px; margin:0 auto 22px; }
.welcome__chips{ display:grid; grid-template-columns:1fr 1fr; gap:10px; max-width:340px; margin:0 auto; }
.hint-chip{
  background:var(--card); border:1px solid var(--line); color:var(--text);
  padding:12px 10px; border-radius:14px; font-size:13px; cursor:pointer; font-family:inherit;
}
.hint-chip:active{ border-color:var(--accent); }

/* ---- activity zone (statuses) ---- */
#activityZone{ min-height:0; }
.activity{
  display:flex; align-items:center; gap:8px; font-size:13px; color:var(--accent);
  padding:6px 12px; margin:0 2px 8px; width:fit-content;
  background:color-mix(in srgb, var(--accent) 10%, var(--bg)); border-radius:999px;
}
.activity i{ font-style:normal; animation:blink 1s ease-in-out infinite; }
@keyframes blink{ 50%{opacity:.3} }

/* ---- dock ---- */
#dock{ padding:8px 0 10px; }
#composer{
  display:flex; align-items:flex-end; gap:8px;
  background:var(--card); border:1px solid var(--line); border-radius:24px;
  padding:8px 8px 8px 14px; transition:border-color .2s;
}
#composer:focus-within{ border-color:var(--accent); }
#input{
  flex:1; background:none; border:none; outline:none; resize:none; color:var(--text);
  font:inherit; line-height:1.5; max-height:40dvh; unicode-bidi:plaintext;
}
#sendBtn,#stopBtn{
  flex:none; width:38px; height:38px; border-radius:50%; border:none; cursor:pointer;
  background:var(--accent); color:#03130d; font-size:15px;
}
#stopBtn{ background:#e0596b; color:#fff; }
#footnote{ text-align:center; font-size:10.5px; color:var(--text2); opacity:.7; margin-top:8px; }

/* ---- settings sheet ---- */
#sheetBackdrop{ position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:40; }
#sheet{
  position:fixed; z-index:41; inset-inline:0; bottom:0; margin:0 auto; max-width:720px;
  background:var(--bg2); border:1px solid var(--line); border-bottom:none;
  border-radius:24px 24px 0 0; padding:10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height:82dvh; overflow-y:auto;
}
.sheet__grab{ width:44px; height:4px; border-radius:99px; background:var(--line); margin:2px auto 14px; }
#sheet h2{ font-size:17px; margin-bottom:14px; }
.row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:13px 0; border-bottom:1px solid var(--line); }
.row > span{ color:var(--text2); font-size:14px; }
.row--end{ border:none; }
.seg{ display:flex; background:var(--card); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.seg button{
  background:none; border:none; color:var(--text2); font:inherit; font-size:13px;
  padding:7px 13px; cursor:pointer;
}
.seg button[aria-pressed="true"]{ background:var(--accent); color:#03130d; font-weight:700; }
#accents{ display:flex; gap:8px; }
#accents button{
  width:30px; height:30px; border-radius:50%; border:2px solid transparent; cursor:pointer; background:var(--c);
}
#accents button[aria-pressed="true"]{ border-color:var(--text); }
.switch{ position:relative; width:48px; height:28px; display:inline-block; }
.switch input{ opacity:0; width:0; height:0; }
.switch span{ position:absolute; inset:0; background:var(--line); border-radius:99px; transition:.2s; }
.switch span::after{ content:''; position:absolute; top:3px; inset-inline-start:3px; width:22px; height:22px; background:#fff; border-radius:50%; transition:.2s; }
.switch input:checked + span{ background:var(--accent); }
.switch input:checked + span::after{ transform:translateX(-20px); }
[dir="ltr"] .switch input:checked + span::after{ transform:translateX(20px); }
.danger{ background:none; border:1px solid #e0596b; color:#e0596b; border-radius:10px; padding:8px 16px; font:inherit; cursor:pointer; }

/* ---- toast ---- */
#toast{
  position:fixed; bottom:90px; left:50%; transform:translateX(-50%);
  background:var(--accent); color:#03130d; padding:9px 18px; border-radius:99px;
  font-size:13px; font-weight:600; z-index:60; box-shadow:0 8px 24px rgba(0,0,0,.3);
}

button{ font-family:inherit; }
button:focus-visible, textarea:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
