
:root{
  --bg:#07111d;
  --bg2:#0b1726;
  --card:#101c2e;
  --card2:#132338;
  --card3:#172a45;
  --line:#203552;
  --text:#eaf3ff;
  --muted:#93a7c3;
  --blue:#4da3ff;
  --blue2:#2f7be8;
  --blue3:#1f5bcf;
  --danger:#ff6d7a;
  --shadow: 0 14px 40px rgba(0,0,0,.26);
  --radius: 22px;
  --radius-sm: 16px;
  --max: 520px;
  --ease:cubic-bezier(.2,.8,.2,1);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 20% 0%, rgba(77,163,255,.14), transparent 54%),
    radial-gradient(900px 600px at 100% 100%, rgba(47,123,232,.10), transparent 55%),
    linear-gradient(180deg, var(--bg), #050b12 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x:hidden;
}

button,input,textarea,a{font:inherit}
button{cursor:pointer}
a{text-decoration:none;color:inherit}

.hidden{display:none !important}
.screen{
  min-height:100dvh;
  width:100%;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:16px;
}

.splash-screen{
  background:
    radial-gradient(800px 500px at 50% 25%, rgba(77,163,255,.15), transparent 60%),
    linear-gradient(180deg, #07111d 0%, #09111c 100%);
}
.splash-brand{
  display:flex;
  align-items:center;
  gap:14px;
  animation:splashIn .8s var(--ease) both;
}
.splash-mark{
  width:58px;height:58px;
  border-radius:20px;
  background: linear-gradient(180deg, rgba(77,163,255,.22), rgba(31,91,207,.08));
  border:1px solid rgba(148,187,255,.16);
  box-shadow: var(--shadow);
  display:grid;
  place-items:center;
  position:relative;
  overflow:hidden;
}
.splash-mark span{
  position:absolute;
  inset:auto;
  width:11px;height:11px;
  border-radius:999px;
  background:var(--blue);
  box-shadow:0 0 0 6px rgba(77,163,255,.12);
}
.splash-mark span:nth-child(1){top:14px;left:14px}
.splash-mark span:nth-child(2){top:24px;left:24px;background:#7dc1ff}
.splash-mark span:nth-child(3){top:34px;left:34px;background:#d6e9ff}
.splash-text h1{margin:0;font-size:42px;letter-spacing:.28em}
.splash-text p{margin:6px 0 0;color:var(--muted);font-size:13px;letter-spacing:.12em;text-transform:uppercase}

.auth-screen{align-items:flex-start;padding-top:28px}
.auth-shell{
  width:100%;
  max-width:var(--max);
  display:grid;
  gap:18px;
}
.hero-copy{
  padding:8px 4px;
  animation:rise .55s var(--ease) both;
}
.eyebrow{
  margin:0 0 10px;
  color:var(--blue);
  font-size:12px;
  letter-spacing:.22em;
  text-transform:uppercase;
  font-weight:700;
}
.hero-copy h2{
  margin:0;
  font-size:34px;
  line-height:1.05;
  letter-spacing:-.03em;
}
.subcopy{
  margin:12px 0 0;
  color:var(--muted);
  line-height:1.6;
  max-width:34ch;
}

.auth-card, .panel, .account-card{
  background: linear-gradient(180deg, rgba(16,28,46,.98), rgba(12,22,37,.98));
  border:1px solid rgba(128,159,198,.13);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.auth-card{
  padding:16px;
  animation:rise .7s .06s var(--ease) both;
}
.segmented{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:14px;
}
.segmented-btn{
  border:1px solid transparent;
  background:#0e1a2c;
  color:var(--muted);
  border-radius:16px;
  padding:13px 12px;
  transition:all .25s var(--ease);
}
.segmented-btn.active{
  background:linear-gradient(180deg, rgba(77,163,255,.18), rgba(47,123,232,.10));
  color:var(--text);
  border-color:rgba(77,163,255,.20);
  box-shadow: inset 0 0 0 1px rgba(77,163,255,.08);
}
.form-panel{display:grid;gap:12px}
.field{display:grid;gap:8px}
.field span{font-size:13px;color:#bdd0ea}
.field input,.field textarea{
  width:100%;
  border:1px solid var(--line);
  background:#0c1726;
  color:var(--text);
  border-radius:16px;
  padding:14px 15px;
  outline:none;
  transition:border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea{resize:none;min-height:132px}
.field input::placeholder,.field textarea::placeholder{color:#6f84a0}
.field input:focus,.field textarea:focus{
  border-color:rgba(77,163,255,.65);
  box-shadow:0 0 0 4px rgba(77,163,255,.10);
  transform:translateY(-1px);
}
.primary-btn,.ghost-btn,.danger-btn{
  border:none;
  border-radius:16px;
  padding:14px 16px;
  transition:transform .2s var(--ease), filter .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.primary-btn{
  color:#fff;
  font-weight:700;
  background: linear-gradient(180deg, var(--blue), var(--blue3));
  box-shadow:0 12px 26px rgba(47,123,232,.28);
}
.primary-btn:active,.ghost-btn:active,.danger-btn:active,.nav-btn:active,.segmented-btn:active,.icon-btn:active{transform:scale(.98)}
.primary-btn:hover{filter:brightness(1.05)}
.ghost-btn{
  background:#0d1725;
  color:var(--text);
  border:1px solid var(--line);
}
.danger-btn{
  width:100%;
  font-weight:700;
  background:rgba(255,109,122,.12);
  color:#ffd1d6;
  border:1px solid rgba(255,109,122,.22);
}
.hint{
  margin:2px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

.app-screen,.settings-screen{
  align-items:flex-start;
  padding:10px 10px 18px;
}
.app-frame{
  width:100%;
  max-width:var(--max);
  min-height:calc(100dvh - 20px);
  display:flex;
  flex-direction:column;
  gap:14px;
}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 4px 0;
}
.topbar-label{
  margin:0 0 4px;
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--muted);
}
.topbar h2{
  margin:0;
  font-size:28px;
  letter-spacing:-.03em;
}
.icon-btn{
  width:48px;height:48px;
  border:none;
  border-radius:16px;
  background:rgba(13,23,37,.90);
  border:1px solid rgba(128,159,198,.12);
  color:var(--text);
  display:grid;
  place-items:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.icon-btn:hover{background:#111d2f;border-color:rgba(77,163,255,.18)}
.icon-gear,.icon-close,.ico-send,.ico-inbox,.ico-account{
  width:18px;height:18px;display:inline-block;position:relative
}
.icon-gear::before,.icon-gear::after,
.icon-close::before,.icon-close::after,
.ico-send::before,.ico-send::after,
.ico-inbox::before,.ico-inbox::after,
.ico-account::before,.ico-account::after{
  content:"";position:absolute;inset:0;margin:auto;background:currentColor
}
.icon-gear{
  border:2px solid currentColor;border-radius:50%;
}
.icon-gear::before{width:4px;height:4px;border-radius:50%}
.icon-gear::after{width:22px;height:2px;transform:rotate(45deg);box-shadow:0 0 0 1px currentColor}
.icon-close::before{width:18px;height:2px;transform:rotate(45deg)}
.icon-close::after{width:18px;height:2px;transform:rotate(-45deg)}
.ico-send::before{width:16px;height:16px;border:2px solid currentColor;border-left-color:transparent;border-bottom-color:transparent;transform:rotate(45deg);border-radius:4px}
.ico-send::after{width:10px;height:2px;transform:translate(4px,0) rotate(45deg)}
.ico-inbox::before{width:16px;height:12px;border:2px solid currentColor;border-top:none;border-radius:0 0 4px 4px;top:4px}
.ico-inbox::after{width:10px;height:2px;top:4px}
.ico-account::before{width:10px;height:10px;border:2px solid currentColor;border-radius:50%;top:1px}
.ico-account::after{width:18px;height:8px;border:2px solid currentColor;border-top:none;border-radius:0 0 12px 12px;top:10px;background:transparent}

.stats-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.stat-card{
  padding:14px;
  border-radius:20px;
  background:linear-gradient(180deg, rgba(16,28,46,.98), rgba(12,22,37,.98));
  border:1px solid rgba(128,159,198,.13);
  box-shadow: var(--shadow);
}
.stat-card span{color:var(--muted);font-size:12px}
.stat-card strong{display:block;margin-top:7px;font-size:24px;letter-spacing:-.03em}

.content-area{
  flex:1;
  display:grid;
}
.view{display:none;animation:viewIn .3s var(--ease) both}
.view.active{display:block}
.panel{
  padding:16px;
}
.panel-head{display:flex;flex-direction:column;gap:4px;margin-bottom:14px}
.panel-head h3{margin:0;font-size:18px}
.panel-head p{margin:0;color:var(--muted);font-size:13px;line-height:1.5}
.stack{display:grid;gap:12px}
.list{
  display:grid;
  gap:12px;
}
.message-item, .history-item{
  border-radius:18px;
  background:#0d1827;
  border:1px solid rgba(128,159,198,.12);
  padding:14px;
  display:grid;
  gap:8px;
}
.message-item strong, .history-item strong{font-size:14px}
.message-item p, .history-item p{
  margin:0;
  color:#dfe9f8;
  line-height:1.55;
  white-space:pre-wrap;
  word-break:break-word;
}
.meta-line{
  color:var(--muted);
  font-size:12px;
  display:flex;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.message-item.empty{
  color:var(--muted);
  text-align:center;
  padding:28px 16px;
}
.empty-state{
  min-height:220px;
  display:grid;
  place-items:center;
  text-align:center;
  padding:22px 10px 8px;
}
.empty-icon{
  width:58px;height:58px;border-radius:18px;
  background:linear-gradient(180deg, rgba(77,163,255,.18), rgba(47,123,232,.04));
  border:1px solid rgba(77,163,255,.15);
  margin-bottom:12px;
  position:relative;
}
.empty-icon::before,.empty-icon::after{
  content:"";position:absolute;background:rgba(167,203,255,.9);border-radius:999px;
}
.empty-icon::before{width:18px;height:2px;top:24px;left:20px}
.empty-icon::after{width:2px;height:18px;top:16px;left:29px}
.empty-state h4{margin:0 0 6px;font-size:17px}
.empty-state p{margin:0;color:var(--muted);line-height:1.55;max-width:26ch}

.account-card{
  padding:16px;
  display:grid;
  gap:12px;
}
.account-row{
  display:grid;
  gap:8px;
}
.account-row span{
  color:var(--muted);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.12em;
}
.account-row strong{font-size:18px}
.copy-group{
  display:grid;
  gap:10px;
}
.copy-group code{
  background:#0b1522;
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(128,159,198,.10);
  color:#dceaff;
  word-break:break-all;
}
.text-box{
  padding:14px;
  border-radius:18px;
  border:1px dashed rgba(128,159,198,.18);
  background:#0b1522;
  color:#d8e4f5;
}
.text-box p{margin:0;line-height:1.65;color:#d8e4f5}
.social-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.social-link{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  border-radius:16px;
  background:#0b1522;
  border:1px solid rgba(128,159,198,.12);
  color:#dceaff;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.social-link:hover{transform:translateY(-1px);border-color:rgba(77,163,255,.20);background:#111d2e}

.bottom-nav{
  position:sticky;
  bottom:10px;
  z-index:10;
  margin-top:auto;
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:10px;
  padding:10px;
  background:rgba(9,16,28,.72);
  border:1px solid rgba(128,159,198,.12);
  border-radius:24px;
  backdrop-filter: blur(0px);
  box-shadow: var(--shadow);
}
.nav-btn{
  border:none;
  background:transparent;
  color:var(--muted);
  border-radius:18px;
  padding:12px 8px;
  display:grid;
  place-items:center;
  gap:6px;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-btn small{font-size:12px}
.nav-btn.active{
  color:#fff;
  background:linear-gradient(180deg, rgba(77,163,255,.20), rgba(47,123,232,.10));
}
.nav-ico{
  width:18px;height:18px;
  display:inline-block;
  color:currentColor;
}

.toast{
  position:fixed;
  left:50%;
  bottom:88px;
  transform:translateX(-50%) translateY(12px);
  min-width:220px;
  max-width:min(92vw, 420px);
  padding:12px 14px;
  border-radius:16px;
  background:rgba(16,28,46,.96);
  border:1px solid rgba(128,159,198,.13);
  box-shadow: var(--shadow);
  text-align:center;
  z-index:99;
  animation:toastIn .25s var(--ease) both;
}

.is-busy{opacity:.78;pointer-events:none}
.fade-out{animation:fadeOut .24s var(--ease) both}
.fade-in{animation:fadeIn .28s var(--ease) both}

@keyframes splashIn{
  from{opacity:0;transform:translateY(10px) scale(.96)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@keyframes rise{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes viewIn{
  from{opacity:0;transform:translateY(8px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes toastIn{
  from{opacity:0;transform:translateX(-50%) translateY(18px)}
  to{opacity:1;transform:translateX(-50%) translateY(0)}
}
@keyframes fadeOut{to{opacity:0;transform:translateY(8px)}}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

@media (min-width: 860px){
  .screen{padding:24px}
  .app-frame,.auth-shell{max-width:560px}
  .hero-copy h2{font-size:42px}
  .topbar h2{font-size:34px}
}
