:root {
  --bg: #080b12;
  --bg-2: #0d111c;
  --panel: rgba(255, 255, 255, .82);
  --panel-solid: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: rgba(148, 163, 184, .24);
  --green: #16c784;
  --teal: #17bebb;
  --blue: #6aa7ff;
  --shadow: 0 28px 90px rgba(2, 6, 23, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(22, 199, 132, .28), transparent 28rem),
    radial-gradient(circle at 90% 8%, rgba(106, 167, 255, .20), transparent 26rem),
    linear-gradient(135deg, #f7fafc 0%, #eef4f8 45%, #f8fafc 100%);
  color: var(--ink);
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  color: white;
  background: linear-gradient(180deg, rgba(8, 11, 18, .98), rgba(13, 17, 28, .98));
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.primary-action, .history-panel button {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  color: white;
  background: rgba(255,255,255,.055);
  text-align: left;
  padding: 10px 12px;
}
.primary-action {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(22, 199, 132, .14);
}
.primary-action span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
}
.history-panel, .account-panel { display: grid; gap: 8px; }
.history-panel p, .account-panel p {
  margin: 10px 0 0;
  color: #98a2b3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 850;
}
.account-panel, .engine-card {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.engine-card { margin-top: auto; }
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-row small, .user-card small { display: block; color: #98a2b3; }
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, .14);
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 199, 132, .14);
}
.status-dot.offline {
  background: #94a3b8;
  box-shadow: 0 0 0 5px rgba(148, 163, 184, .12);
}
.user-card {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: 10px;
  align-items: center;
}
.user-card img { width: 36px; height: 36px; border-radius: 999px; }

.orb {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.98), rgba(255,255,255,.18) 21%, transparent 39%),
    conic-gradient(from 150deg, var(--green), var(--teal), var(--blue), #7dd3fc, var(--green));
  box-shadow: 0 26px 70px rgba(22,199,132,.26), inset 0 0 32px rgba(255,255,255,.34);
  animation: orbFloat 5s ease-in-out infinite;
}
.orb::before, .orb::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(22,199,132,.22);
  border-radius: inherit;
  animation: orbPulse 3s ease-out infinite;
}
.orb::after { inset: -18px; animation-delay: .45s; }
.orb span {
  width: 27%;
  height: 27%;
  border-radius: inherit;
  background: rgba(255,255,255,.88);
  box-shadow: 0 0 28px rgba(255,255,255,.78);
}
.orb.mini {
  width: 38px;
  height: 38px;
  animation: none;
}
.orb.mini::before, .orb.mini::after { display: none; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-7px) scale(1.025); }
}
@keyframes orbPulse {
  from { opacity: .72; transform: scale(.92); }
  to { opacity: 0; transform: scale(1.18); }
}

.chat-surface {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  min-height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 26px;
}
.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 850;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar select, .toolbar button, .switch {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: var(--ink);
  padding: 8px 12px;
  backdrop-filter: blur(14px);
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 760;
}
.switch input { accent-color: var(--green); }

.settings-drawer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 26px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 34px rgba(16,24,40,.06);
  backdrop-filter: blur(18px);
}
.settings-drawer label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.settings-drawer select, .settings-drawer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  padding: 10px;
}

.messages {
  overflow-y: auto;
  padding: 28px max(22px, calc((100% - 920px) / 2));
}
.hero-state {
  min-height: 72%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.hero-orb { width: 82px; height: 82px; margin-bottom: 26px; }
.hero-state h2 {
  margin: 0 0 10px;
  font-size: clamp(36px, 6vw, 62px);
  line-height: .96;
  letter-spacing: 0;
}
.hero-state p { margin: 0; color: var(--muted); }
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(700px, 100%);
  margin-top: 30px;
}
.prompt-grid button {
  min-height: 62px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 20px;
  background: rgba(255,255,255,.7);
  box-shadow: 0 14px 44px rgba(16,24,40,.07);
  text-align: left;
  padding: 16px;
  color: var(--ink);
}

.message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 15px;
  padding: 24px 0;
}
.message + .message { border-top: 1px solid rgba(148,163,184,.22); }
.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  font-weight: 900;
}
.message.user .avatar { background: linear-gradient(135deg, #475467, #667085); }
.bubble {
  padding: 6px 0 0;
  line-height: 1.72;
}
.bubble strong { display: block; margin-bottom: 6px; }
.bubble p { margin: 0; }
.bubble small { display: block; margin-top: 10px; color: var(--muted); }
.thinking {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 16px;
  background: rgba(255,255,255,.66);
  color: #475467;
}
.thinking summary { cursor: pointer; font-weight: 850; }
pre {
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: #0f172a;
  color: white;
}
code { padding: 2px 5px; border-radius: 6px; background: #eef2f7; }
pre code { padding: 0; background: transparent; }

.composer-wrap {
  width: min(940px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 22px;
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 9px;
}
.attachment-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  max-width: 290px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.82);
}
.attachment-chip img, .file-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  background: #eef2f7;
}
.file-icon { display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 850; }
.attachment-chip strong, .attachment-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip small { color: var(--muted); }
.attachment-chip button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: #475467;
}
.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 26px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.attach-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 17px;
  background: #f2f4f7;
  color: #344054;
  font-size: 24px;
}
.attach-button input { display: none; }
.composer textarea {
  min-height: 48px;
  max-height: 190px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 13px 4px;
}
.composer button {
  min-height: 48px;
  border: 0;
  border-radius: 17px;
  padding: 0 16px;
  font-weight: 850;
}
.composer button[data-improve] { background: #eef2f7; color: #344054; }
.composer .send {
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  box-shadow: 0 12px 28px rgba(22,199,132,.2);
}
.composer .send:disabled { opacity: .58; cursor: wait; }
.fine-print {
  display: block;
  margin-top: 9px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail {
    display: grid;
    grid-template-columns: 1fr auto;
    max-height: 88px;
    overflow: hidden;
  }
  .history-panel, .account-panel, .engine-card { display: none; }
  .topbar { flex-direction: column; align-items: stretch; }
  .toolbar { overflow-x: auto; }
  .settings-drawer { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .prompt-grid { grid-template-columns: 1fr; }
  .composer { grid-template-columns: auto 1fr; }
  .composer button { grid-column: 1 / -1; }
}
