* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; background: #04060c; color: #d8eaff; overflow: hidden; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(circle at 20% 10%, rgba(0,212,255,.08), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(91,141,239,.06), transparent 50%);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(0,212,255,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
}
#app { height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 3; }

/* === LOGIN === */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; }
.login-wrap::before {
  content: ""; position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,.15) 0%, transparent 60%);
  filter: blur(40px); animation: float 8s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0) scale(1);} 50% { transform: translateY(-20px) scale(1.05);} }
.login-card {
  background: rgba(14,18,30,.85); backdrop-filter: blur(20px);
  border: 1px solid rgba(0,212,255,.25); border-radius: 18px; padding: 36px;
  width: 100%; max-width: 400px; position: relative;
  box-shadow: 0 20px 80px rgba(0,0,0,.6), 0 0 60px rgba(0,212,255,.1), inset 0 1px 0 rgba(255,255,255,.05);
}
.login-card h1 { margin: 0 0 4px; font-size: 28px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(90deg, #00d4ff, #5b8def); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(0,212,255,.4); }
.login-card p.muted { margin: 0 0 28px; color: #6a8ab8; font-size: 13px; letter-spacing: 1px; }
label { display: block; font-size: 11px; color: #5b8db8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 2px; }
input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%; padding: 11px 14px; background: rgba(8,12,20,.8); border: 1px solid rgba(0,212,255,.2);
  color: #d8eaff; border-radius: 8px; font-size: 14px; font-family: inherit;
  transition: all .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #00d4ff; box-shadow: 0 0 0 3px rgba(0,212,255,.15), 0 0 20px rgba(0,212,255,.2); }
.field { margin-bottom: 16px; }
button { cursor: pointer; border: none; padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; font-family: inherit; transition: all .15s; }
.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #5b8def); color: #03101e; width: 100%; padding: 13px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  box-shadow: 0 4px 20px rgba(0,212,255,.3), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(0,212,255,.5); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: rgba(0,212,255,.08); color: #aac8ff; border: 1px solid rgba(0,212,255,.2); }
.btn-secondary:hover { background: rgba(0,212,255,.15); border-color: rgba(0,212,255,.4); }
.btn-danger { background: rgba(255,60,80,.15); color: #ff7a8a; border: 1px solid rgba(255,60,80,.3); }
.btn-icon { background: transparent; color: #5b8db8; padding: 4px 8px; font-size: 12px; }
.btn-icon:hover { color: #00d4ff; }
.error { background: rgba(255,60,80,.1); border: 1px solid rgba(255,60,80,.3); color: #ff9999; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.notice { background: rgba(0,212,255,.08); border: 1px solid rgba(0,212,255,.2); color: #aac8ff; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* === HEADER === */
header {
  display: flex; align-items: center; padding: 12px 24px;
  border-bottom: 1px solid rgba(0,212,255,.15);
  background: rgba(8,12,20,.6); backdrop-filter: blur(10px);
}
header h1 {
  margin: 0; font-size: 18px; flex: 1; letter-spacing: 4px; text-transform: uppercase; font-weight: 600;
  background: linear-gradient(90deg, #00d4ff, #5b8def); -webkit-background-clip: text; background-clip: text; color: transparent;
}
header .who { font-size: 12px; color: #5b8db8; margin-right: 14px; letter-spacing: 1px; }
header .status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #00ff88; margin-right: 8px;
  box-shadow: 0 0 8px #00ff88; animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid rgba(0,212,255,.15); background: rgba(8,12,20,.4); }
.tab {
  background: transparent; color: #5b8db8; padding: 12px 18px; border-radius: 0; cursor: pointer; border: none;
  font-size: 13px; letter-spacing: 1px; text-transform: uppercase; border-bottom: 2px solid transparent;
  transition: all .2s;
}
.tab:hover { color: #aac8ff; }
.tab.active { color: #00d4ff; border-bottom-color: #00d4ff; text-shadow: 0 0 10px rgba(0,212,255,.5); }
.view { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* === ORB === */
.orb-stage { display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 18px 0 6px; position: relative; }
.orb {
  position: relative; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(120,220,255,.95) 0%, rgba(0,150,255,.7) 25%, rgba(0,60,160,.4) 60%, transparent 75%);
  box-shadow:
    0 0 40px rgba(0,212,255,.5),
    0 0 80px rgba(0,212,255,.25),
    inset 0 0 30px rgba(150,230,255,.4);
  animation: orb-pulse 3.5s ease-in-out infinite;
}
.orb::before, .orb::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 1px solid rgba(0,212,255,.3);
  animation: ring-spin 8s linear infinite;
}
.orb::after { inset: -28px; border-color: rgba(0,212,255,.15); border-style: dashed; animation-duration: 14s; animation-direction: reverse; }
@keyframes orb-pulse { 0%,100% { transform: scale(1); filter: hue-rotate(0deg);} 50% { transform: scale(1.05); filter: hue-rotate(15deg);} }
@keyframes ring-spin { to { transform: rotate(360deg); } }
.orb.speaking { animation: orb-speak .6s ease-in-out infinite; }
@keyframes orb-speak {
  0%,100% { transform: scale(1); box-shadow: 0 0 40px rgba(0,212,255,.5), 0 0 80px rgba(0,212,255,.25), inset 0 0 30px rgba(150,230,255,.4); }
  50% { transform: scale(1.12); box-shadow: 0 0 70px rgba(0,255,200,.7), 0 0 140px rgba(0,212,255,.5), inset 0 0 40px rgba(180,255,230,.6); }
}
.orb.listening { animation: orb-listen .9s ease-in-out infinite; }
@keyframes orb-listen {
  0%,100% { transform: scale(1); box-shadow: 0 0 40px rgba(255,80,120,.5), 0 0 80px rgba(255,80,120,.25), inset 0 0 30px rgba(255,180,200,.4); filter: hue-rotate(-90deg);}
  50% { transform: scale(1.08); filter: hue-rotate(-100deg) brightness(1.2);}
}
.orb.thinking { animation: orb-think 1.2s linear infinite; }
@keyframes orb-think { 0% { filter: hue-rotate(0deg) brightness(1);} 100% { filter: hue-rotate(360deg) brightness(1.1);} }
.orb-label { margin-top: 14px; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: #5b8db8; min-height: 16px; }

/* === CHAT === */
.chat-body { flex: 1; overflow-y: auto; padding: 16px 24px; max-width: 960px; margin: 0 auto; width: 100%; }
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: rgba(0,212,255,.2); border-radius: 3px; }
.msg { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; max-width: 78%; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; animation: msg-in .3s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }
.msg.user { background: linear-gradient(135deg, rgba(91,141,239,.25), rgba(0,212,255,.18)); border: 1px solid rgba(0,212,255,.25); color: #e8f4ff; margin-left: auto; }
.msg.assistant { background: rgba(14,22,40,.7); border: 1px solid rgba(0,212,255,.15); color: #d8eaff; box-shadow: 0 0 20px rgba(0,212,255,.05); }
.msg.system-info { background: transparent; border: 1px dashed rgba(0,212,255,.2); color: #6a8ab8; font-size: 12px; text-align: center; max-width: 100%; }
.chat-footer { border-top: 1px solid rgba(0,212,255,.15); padding: 12px 16px; background: rgba(8,12,20,.5); backdrop-filter: blur(10px); }
.chat-input { max-width: 960px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { resize: none; min-height: 46px; max-height: 200px; flex: 1; }
.mic-btn, .speaker-btn {
  width: 46px; height: 46px; border-radius: 50%; padding: 0;
  background: rgba(0,212,255,.08); border: 1px solid rgba(0,212,255,.25); color: #00d4ff;
  font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mic-btn:hover, .speaker-btn:hover { background: rgba(0,212,255,.15); box-shadow: 0 0 15px rgba(0,212,255,.3); }
.mic-btn.recording { background: rgba(255,60,80,.2); border-color: #ff5070; color: #ff5070; animation: rec-pulse 1s ease-in-out infinite; }
.speaker-btn.muted { color: #5b8db8; opacity: .5; }
@keyframes rec-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,80,120,.5);} 50% { box-shadow: 0 0 0 8px rgba(255,80,120,0);} }
.send-btn { width: auto; padding: 12px 22px; min-height: 46px; }
.chat-meta { font-size: 11px; color: #5b8db8; margin-top: 8px; text-align: center; letter-spacing: 1px; }

/* === BOOT === */
.boot-overlay { position: fixed; inset: 0; background: #04060c; z-index: 9999;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  animation: boot-out 1.4s ease-out .8s forwards; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }
.boot-orb { width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #78dcff 0%, #0096ff 40%, transparent 75%);
  box-shadow: 0 0 60px #00d4ff; animation: boot-orb 1.2s ease-out; }
@keyframes boot-orb { from { transform: scale(0);} to { transform: scale(1);} }
.boot-text { color: #00d4ff; letter-spacing: 6px; font-size: 14px; margin-top: 24px; text-transform: uppercase; }

/* === LISTS === */
.list-body { flex: 1; overflow-y: auto; padding: 24px; max-width: 960px; margin: 0 auto; width: 100%; }
.list-body::-webkit-scrollbar { width: 6px; }
.list-body::-webkit-scrollbar-thumb { background: rgba(0,212,255,.2); border-radius: 3px; }
.list-body h2 { margin: 0 0 6px; letter-spacing: 2px; text-transform: uppercase; font-size: 18px; color: #00d4ff; }
.list-body h3 { margin: 24px 0 10px; color: #aac8ff; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.list-actions { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.list-actions input { flex: 1; min-width: 200px; }
.card { background: rgba(14,22,40,.6); border: 1px solid rgba(0,212,255,.15); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; transition: all .2s; }
.card:hover { border-color: rgba(0,212,255,.3); box-shadow: 0 0 20px rgba(0,212,255,.08); }
.card .kind-tag { display: inline-block; font-size: 10px; padding: 3px 8px; border-radius: 4px; background: rgba(0,212,255,.15); color: #00d4ff; margin-right: 8px; letter-spacing: 1px; text-transform: uppercase; }
.card .source { font-size: 11px; color: #5b8db8; }
.card .content { margin: 8px 0; line-height: 1.55; }
.card .footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: #5b8db8; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #00d4ff; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg);} }
.empty { text-align: center; color: #5b8db8; padding: 50px 20px; letter-spacing: 1px; }

/* === VOICE PANEL === */
.voice-panel {
  position: fixed; bottom: 90px; right: 20px; z-index: 1000;
  background: rgba(8,12,20,.96); backdrop-filter: blur(20px);
  border: 1px solid rgba(0,212,255,.35); border-radius: 14px;
  padding: 18px; width: 320px; max-width: calc(100vw - 24px);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(0,212,255,.15);
  animation: vp-in .2s ease-out;
}
@keyframes vp-in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }
.voice-panel .vp-title {
  color: #00d4ff; letter-spacing: 2px; text-transform: uppercase; font-size: 12px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,212,255,.15);
}
.voice-panel select { margin-bottom: 12px; }
.voice-panel .vp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.voice-panel .vp-row label { margin: 0; flex-shrink: 0; width: 70px; }
.voice-panel .vp-row input[type=range] {
  flex: 1; padding: 0; height: 4px; appearance: none; background: rgba(0,212,255,.15); border: none;
  border-radius: 2px; outline: none;
}
.voice-panel .vp-row input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #00d4ff;
  cursor: pointer; box-shadow: 0 0 8px rgba(0,212,255,.6);
}
.voice-panel .vp-row input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #00d4ff; border: none;
  cursor: pointer; box-shadow: 0 0 8px rgba(0,212,255,.6);
}
.voice-panel .vp-val { color: #aac8ff; font-size: 12px; min-width: 36px; text-align: right; }
.voice-panel .vp-actions { display: flex; gap: 8px; margin-top: 14px; }
.voice-panel .vp-actions button { flex: 1; padding: 10px; }

/* === ONBOARDING OVERLAY === */
.onb-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(4,6,12,.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: vp-in .25s ease-out;
}
.onb-card {
  background: rgba(14,18,30,.95); border: 1px solid rgba(0,212,255,.3);
  border-radius: 16px; padding: 28px; width: 100%; max-width: 520px;
  box-shadow: 0 20px 80px rgba(0,0,0,.6), 0 0 60px rgba(0,212,255,.12);
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.onb-card h2 { margin: 0 0 6px; color: #00d4ff; letter-spacing: 2px; text-transform: uppercase; font-size: 18px; }
.onb-card p.muted { margin: 0 0 22px; color: #6a8ab8; font-size: 13px; line-height: 1.5; }
.onb-card .field { margin-bottom: 14px; }
.onb-card textarea { resize: vertical; min-height: 50px; }
.onb-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }
.onb-actions button { flex-shrink: 0; }
@media (max-width: 720px) {
  .onb-card { padding: 20px; border-radius: 14px; }
  .onb-card h2 { font-size: 15px; }
  .onb-actions { flex-direction: column-reverse; }
  .onb-actions button { width: 100%; padding: 13px; }
}

/* === MOBILE === */
@media (max-width: 720px) {
  body::after { background: repeating-linear-gradient(0deg, rgba(0,212,255,.02) 0 1px, transparent 1px 4px); }
  /* Header */
  header { padding: 10px 14px; gap: 8px; }
  header h1 { font-size: 15px; letter-spacing: 2px; }
  header .who { display: none; }
  header .who .status-dot { display: inline-block; }
  header .status-dot { display: inline-block; }
  /* Tabs scrollable */
  .tabs {
    padding: 0 6px; overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 12px; font-size: 12px; letter-spacing: .5px; flex-shrink: 0; }
  /* Login */
  .login-card { padding: 24px 20px; border-radius: 14px; }
  .login-card h1 { font-size: 22px; }
  /* Orb smaller */
  .orb-stage { padding: 12px 0 4px; }
  .orb { width: 90px; height: 90px; }
  .orb::before { inset: -8px; }
  .orb::after { inset: -20px; }
  .orb-label { margin-top: 10px; font-size: 10px; letter-spacing: 3px; }
  /* Chat body */
  .chat-body { padding: 12px 14px; }
  .msg { max-width: 90%; padding: 10px 14px; font-size: 14px; }
  /* Chat input - wrap on mobile */
  .chat-footer { padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .chat-input { gap: 6px; flex-wrap: wrap; }
  .chat-input textarea {
    order: 1; flex-basis: 100%; min-height: 50px; font-size: 16px; /* 16px = no zoom on iOS */
  }
  .mic-btn, .speaker-btn { order: 2; width: 44px; height: 44px; font-size: 17px; }
  .send-btn { order: 3; flex: 1; padding: 12px; font-size: 13px; }
  .chat-meta { font-size: 10px; margin-top: 6px; }
  /* Lists */
  .list-body { padding: 14px; }
  .list-actions { flex-direction: column; }
  .list-actions input { width: 100%; }
  .list-actions button { width: 100%; }
  .card { padding: 12px; }
  .card .footer { flex-direction: column; align-items: flex-start; gap: 4px; }
  /* Voice panel - bottom sheet */
  .voice-panel {
    position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none;
    border-radius: 16px;
  }
  /* Buttons general */
  input[type=text], input[type=password], input[type=email], textarea, select { font-size: 16px; }
}
@media (max-width: 380px) {
  header h1 { letter-spacing: 1px; font-size: 13px; }
  .tab { padding: 9px 10px; font-size: 11px; }
}
