:root{
  --bg:#eef3f8;
  --panel:#ffffff;
  --side:#f6f9fc;
  --text:#16212d;
  --muted:#8b98a9;
  --line:#e6ecf3;
  --accent:#2f6bff;
  --me:#dce8ff;
  --them:#f2f5f9;
  --ok:#2f9e6e;
  --err:#e2564d;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;color:var(--text);overflow:hidden;background:var(--bg);
  font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:15px;letter-spacing:-.01em;
}
.hidden{display:none!important}
.muted{color:var(--muted)}
.small{font-size:11.5px}

/* iconos */
.ic{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;display:block}

/* ---------- login ---------- */
.login{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;z-index:5;
  background:radial-gradient(900px 500px at 20% 0%,#e7eefb 0%,transparent 60%),var(--bg)}
.login-card{width:100%;max-width:390px;text-align:center;background:var(--panel);border-radius:28px;padding:32px 28px 24px;
  box-shadow:0 30px 80px -40px rgba(25,45,85,.4),0 1px 0 #fff inset;border:1px solid var(--line)}
.login-avatar{width:140px;height:140px;margin:0 auto 10px;border-radius:50%;background:#eef3f8;display:flex;align-items:center;justify-content:center;padding:10px}
.login h1{margin:0 0 4px;font-size:23px;font-weight:650;letter-spacing:-.02em}
.login p{margin:0 0 22px;font-size:13px}
#loginForm{display:flex;flex-direction:column;gap:9px}
#loginForm input{background:#f4f7fb;border:1px solid transparent;color:var(--text);padding:14px 16px;border-radius:14px;font-size:15px;outline:none;transition:.15s;font-family:inherit}
#loginForm input:focus{background:#fff;border-color:#cfdcf5;box-shadow:0 0 0 4px #eaf0ff}
#loginForm button{background:linear-gradient(180deg,#3d78ff,#2b63f0);color:#fff;border:0;padding:14px;border-radius:14px;font-size:15.5px;font-weight:600;margin-top:4px;cursor:pointer;box-shadow:0 10px 24px -12px #2b63f0}
.remember{font-size:12.5px;color:var(--muted);display:flex;gap:8px;align-items:center;justify-content:center;margin-top:2px}
.error{color:var(--err);font-size:13px;min-height:18px}

/* ---------- layout ---------- */
.app{display:grid;grid-template-columns:minmax(0,1fr) clamp(360px,33vw,520px);grid-template-rows:100%;height:100vh;height:100dvh;overflow:hidden;min-height:0}
.side{
  position:relative;display:flex;flex-direction:column;min-height:0;overflow:hidden;background:linear-gradient(160deg,#f8fbfe 0%,#eaf1f8 100%);
  border-right:1px solid var(--line);overflow:hidden;
}
.side::before{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(600px 400px at 30% 20%,#ffffff 0%,transparent 60%),
             radial-gradient(500px 400px at 80% 90%,#e7f0fb 0%,transparent 60%);
}
.side-head{position:relative;padding:26px 30px 0;display:flex;align-items:baseline;gap:12px}
.brand{font-size:22px;font-weight:700;letter-spacing:-.03em}
.side-status{font-size:12.5px;color:var(--muted)}
.stage{position:relative;flex:1;display:grid;place-items:center;min-height:0;cursor:pointer}
.avatar-wrap{width:min(44vh,340px);height:min(44vh,340px);max-width:64%;max-height:64%;position:relative}
.mood{position:absolute;bottom:26px;left:50%;transform:translateX(-50%);font-size:12px;color:#7d8ea3;background:#ffffffcc;border:1px solid var(--line);padding:5px 12px;border-radius:999px}
.mood:empty{display:none}
.side-foot{position:relative;padding:0 30px 22px;text-align:center}
.hint-side{font-size:11.5px;color:#a3b1c2}

.panel{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--panel);height:100%}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--line);flex:0 0 auto}
.who{display:flex;align-items:center;gap:10px}
.mini{width:34px;height:34px;border-radius:50%;background:#eef3f8;padding:3px}
.who-text{display:flex;flex-direction:column}
.name{font-weight:650;font-size:14.5px;letter-spacing:-.02em}
.status{font-size:11.5px;color:var(--muted)}
.actions{display:flex;gap:2px}
.actions .act{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;color:#93a1b3;background:transparent;border:0;cursor:pointer;transition:.15s}
.actions .act:hover{background:#f1f5fa;color:#4f6076}
.actions .act:disabled{opacity:.3;cursor:default}
.actions .act.on{color:var(--accent);background:#eaf0ff}

/* chat */
.chat{flex:1 1 auto;overflow-y:auto;padding:16px 18px 10px;display:flex;flex-direction:column;gap:8px;min-height:0}
.hello{margin:4px 2px 12px}
.hello-line{font-size:24px;font-weight:600;letter-spacing:-.03em;color:#5b7cff}
.hello h2{margin:2px 0 0;font-size:24px;font-weight:650;letter-spacing:-.035em;color:#1c2733}
.suggest{display:flex;flex-direction:column;gap:7px;margin-top:2px}
.suggest button{display:flex;align-items:center;gap:9px;text-align:left;background:#fbfcfe;border:1px solid var(--line);border-radius:14px;padding:11px 13px;font-size:13.5px;color:#41505f;cursor:pointer;font-family:inherit;transition:.15s}
.suggest button:hover{border-color:#cfdcf5;background:#fff}
.suggest button .ic{width:16px;height:16px;color:#7d8ca0;flex:0 0 auto}
.msg{max-width:88%;padding:10px 13px;border-radius:16px;line-height:1.45;font-size:14.8px;white-space:pre-wrap;word-wrap:break-word;animation:pop .16s ease-out}
@keyframes pop{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.msg.me{align-self:flex-end;background:var(--me);border-bottom-right-radius:5px;color:#12243d}
.msg.bot{align-self:flex-start;background:var(--them);border-bottom-left-radius:5px;color:#1b2735}
.msg.sys{align-self:center;background:#f3f6fa;color:#8e9aab;font-size:11.5px;padding:5px 11px;border-radius:999px}
.msg .meta{display:block;font-size:9.5px;color:#93a3b6;text-align:right;margin-top:4px}
.typing{display:inline-flex;gap:4px;align-items:center;padding:2px 0}
.typing i{width:6px;height:6px;border-radius:50%;background:#aab8c9;display:inline-block;animation:b 1.1s infinite}
.typing i:nth-child(2){animation-delay:.16s}.typing i:nth-child(3){animation-delay:.32s}
@keyframes b{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-3px);opacity:1}}

/* composer */
.composer{flex:0 0 auto;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}
.composer-inner{display:flex;align-items:flex-end;gap:6px;background:#f6f9fc;border:1px solid var(--line);border-radius:20px;padding:6px 6px 6px 10px}
.composer textarea{flex:1;resize:none;background:transparent;border:0;color:var(--text);padding:9px 2px;font-size:15px;line-height:1.35;max-height:110px;outline:none;font-family:inherit}
.icon{background:transparent;border:0;font-size:17px;padding:7px;color:#9aa8ba;cursor:pointer;border-radius:50%}
.icon:hover{background:#eef3f9}
.icon .ic{width:19px;height:19px}
.icon.rec{color:var(--err);animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.35}}
.send{background:linear-gradient(180deg,#3d78ff,#2b63f0);border:0;color:#fff;width:38px;height:38px;border-radius:50%;cursor:pointer;flex:0 0 auto;display:grid;place-items:center;box-shadow:0 6px 14px -6px #2b63f0}
.send .ic{width:19px;height:19px;stroke-width:2.2}
.send:disabled{opacity:.35;box-shadow:none}
.composer-foot{display:flex;align-items:center;gap:7px;padding:8px 6px 0}
.pill{font-size:11px;font-weight:600;color:#4363a8;background:#e9effb;border-radius:999px;padding:3px 9px}
.dots{margin-left:auto;display:flex;gap:3px}
.dots i{width:5px;height:5px;border-radius:50%;background:#c7d1df}
.dots i:first-child{background:#7fa2e8}

/* ---------- móvil ---------- */
@media(max-width:860px){
  .app{grid-template-columns:1fr;grid-template-rows:150px 1fr}
  .side{border-right:0;border-bottom:1px solid var(--line)}
  .side-head{padding:14px 16px 0}
  .brand{font-size:16px}
  .avatar-wrap{width:112px;height:112px;max-width:112px;max-height:112px}
  .side-foot{display:none}
  .mood{bottom:8px;font-size:10.5px;padding:3px 9px}
  .topbar{padding:10px 12px}
  .chat{padding:12px 12px 8px}
  .hello-line,.hello h2{font-size:21px}
}
@media(max-height:640px) and (min-width:861px){
  .avatar-wrap{width:min(44vh,340px);height:min(44vh,340px)}
}
