.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 540px;
  border: var(--glass-border);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(124, 58, 237, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34), 0 0 44px rgba(124, 58, 237, 0.08);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border-right: var(--glass-border);
  background: rgba(0, 0, 0, 0.16);
}

.eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--color-violet-light);
  font-size: 10px;
  font-weight: var(--font-bold);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.caption {
  margin: var(--space-1) 0 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.railButton,
.sessionButton,
.searchInput,
.shareButton {
  width: 100%;
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.045);
  color: var(--color-text-secondary);
}

.railButton,
.shareButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  cursor: pointer;
  font-weight: var(--font-semibold);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), color var(--duration-fast), background var(--duration-fast);
}

.railButton:hover,
.shareButton:hover {
  border-color: rgba(124, 58, 237, 0.48);
  background: rgba(124, 58, 237, 0.13);
  color: var(--color-text-primary);
  box-shadow: 0 0 26px rgba(124, 58, 237, 0.16);
}

.primaryButton {
  color: white;
  border-color: rgba(124, 58, 237, 0.55);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(59, 130, 246, 0.55));
}

.searchInput {
  min-height: 42px;
  padding: 0 var(--space-4);
  outline: none;
  font: inherit;
}

.searchInput:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
}

.sectionLabel {
  margin: var(--space-2) 0 0;
  color: var(--color-text-tertiary);
  font-size: 10px;
  font-weight: var(--font-bold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.sessions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow: auto;
  min-height: 0;
}

.sessionButton {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
  text-align: left;
}

.sessionButton:hover,
.sessionActive {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(59, 130, 246, 0.11);
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.14);
}

.sessionGlyph {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.16);
  color: var(--color-text-primary);
  font-weight: var(--font-bold);
}

.sessionMeta {
  min-width: 0;
}

.sessionTitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.sessionSub {
  margin-top: 3px;
  color: var(--color-text-tertiary);
  font-size: 11px;
}

.emptySessions {
  padding: var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.main {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: var(--glass-border);
}

.topbarTitle {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}

.topbarSub {
  margin: 3px 0 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.statusPill {
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.09);
  color: #86efac;
  font-size: 11px;
  font-weight: var(--font-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6);
  overflow: auto;
}

.emptyCanvas {
  margin: auto;
  max-width: 430px;
  text-align: center;
  color: var(--color-text-secondary);
}

.emptyIcon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto var(--space-4);
  border-radius: 24px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.10);
  box-shadow: 0 0 34px rgba(124, 58, 237, 0.16);
  color: var(--color-violet-light);
  font-size: 26px;
}

.emptyCanvas h3 {
  margin: 0 0 var(--space-2);
  color: var(--color-text-primary);
}

.turn {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.userBubble {
  align-self: flex-end;
  max-width: min(780px, 88%);
  padding: var(--space-3) var(--space-4);
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.28), rgba(59, 130, 246, 0.16));
  border: 1px solid rgba(124, 58, 237, 0.28);
  color: var(--color-text-primary);
}

.thinkingCard {
  min-height: 120px;
  border-radius: var(--radius-xl);
}

.composer {
  padding: var(--space-5) var(--space-6);
  border-top: var(--glass-border);
  background: rgba(0, 0, 0, 0.14);
}

.composerInner {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 34px rgba(124, 58, 237, 0.12);
}

.composerInput {
  flex: 1;
  min-height: 38px;
  max-height: 130px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  line-height: 1.5;
}

.composerInput::placeholder {
  color: var(--color-text-tertiary);
}

.sendButton {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--color-violet), #2563eb);
  color: white;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 0 26px rgba(124, 58, 237, 0.36);
}

.sendButton:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.notice {
  margin-top: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: 11px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    border-right: 0;
    border-bottom: var(--glass-border);
  }

  .sessions {
    max-height: 220px;
  }
}
