:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #f5f7fa;
  --hover: #e9eef5;
  --line: #e2e7ee;
  --text: #172033;
  --muted: #667085;
  --soft: #98a2b3;
  --bubble: #eef3f8;
  --black: #172033;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --danger: #b42318;
  --shadow: 0 18px 52px rgba(20, 20, 20, 0.1);
  --prompt-shadow: 0 18px 48px rgba(38, 55, 86, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body.is-login { background: #f7f7f5; }

.startup-view {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #f7f7f5;
  color: var(--muted);
  font-size: 14px;
}

.startup-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dededb;
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.ui-icon {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: cover;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 12px;
  font-weight: 900;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.25;
}

.login-copy {
  margin: 34px 0 24px;
}

.login-copy h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-copy p,
.login-hint {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form,
.field {
  display: grid;
  gap: 14px;
}

.field {
  gap: 8px;
}

.field span {
  color: #353535;
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #d9d9d7;
  border-radius: 8px;
  outline: 0;
}

.field input:focus {
  border-color: #111;
}

.primary-button {
  min-height: 46px;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
  font-weight: 750;
}

.primary-button:hover {
  background: #30302e;
}

.text-button {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.text-button:hover {
  color: var(--text);
  background: var(--hover);
  border-radius: 8px;
}

.primary-button:disabled,
.secondary-button:disabled,
.table-actions button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.login-hint {
  text-align: center;
  font-size: 13px;
}

.language-toggle {
  min-width: 42px;
  min-height: 32px;
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 10px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  transition: margin-left 180ms ease;
}

.sidebar-header,
.brand,
.nav-button,
.search-box,
.history-item,
.profile,
.topbar,
.chat-switch {
  display: flex;
  align-items: center;
}

.sidebar-header {
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 14px;
}

.brand {
  min-width: 0;
  gap: 10px;
  padding: 2px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand-copy small {
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: #475467;
}

.icon-button:hover {
  background: var(--hover);
}

.icon-button.active {
  background: var(--accent);
  color: #ffffff;
}

.icon-button.active .ui-icon {
  filter: invert(1);
}

.nav-button {
  width: 100%;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.nav-link {
  margin-top: 2px;
}

.nav-button.active,
.nav-button:hover {
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.search-box {
  gap: 10px;
  min-height: 42px;
  margin-top: 4px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
}

.search-box:hover {
  background: var(--hover);
}

.search-box svg {
  width: 19px;
  height: 19px;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.sidebar-section {
  display: grid;
  gap: 6px;
  min-height: 0;
  margin-top: 22px;
  padding: 0 8px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.text-button {
  padding: 4px 7px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.text-button:hover {
  background: var(--hover);
  color: var(--text);
}

.history-list {
  display: grid;
  gap: 2px;
  overflow: auto;
  max-height: calc(100vh - 330px);
}

.history-empty {
  padding: 8px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 4px 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.history-item:hover,
.history-item.active {
  background: var(--hover);
}

.history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.history-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex: 1;
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.history-item:hover .history-actions,
.history-item:focus-within .history-actions {
  opacity: 1;
}

.history-time {
  flex: 0 0 auto;
  color: var(--soft);
  font-size: 12px;
}

.profile {
  gap: 10px;
  margin-top: auto;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-text {
  display: grid;
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  line-height: 1.2;
}

.profile-text strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-text span {
  color: var(--muted);
  font-size: 12px;
}

.profile-plan {
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-plan b {
  padding: 2px 6px;
  border-radius: 999px;
  background: #ece7ff;
  color: #6d46d9;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
}

.logout-button {
  flex: 0 0 auto;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  background: #fbfcfe;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid rgba(226, 231, 238, 0.8);
  background: rgba(251, 252, 254, 0.9);
  backdrop-filter: blur(12px);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 180px;
  padding: 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.configured {
  background: #ecfdf3;
  color: #027a48;
}

.chat-switch {
  gap: 4px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
}

.chat-switch:hover {
  background: var(--hover);
}

.dropdown-icon {
  width: 14px;
  height: 14px;
}

.floating-menu {
  display: none;
}

.chat-stage {
  overflow: auto;
  display: flex;
  flex-direction: column;
  width: min(900px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 44px 0 190px;
}

.empty-state {
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: stretch;
  gap: 34px;
  padding-bottom: 70px;
  text-align: left;
}

.welcome-copy {
  display: grid;
  gap: 10px;
  width: min(720px, 100%);
  margin: 0 auto;
}

.welcome-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.empty-state h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.welcome-copy p {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 100%);
  margin: 0 auto;
}

.starter-grid button {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  text-align: left;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.starter-grid button:hover {
  border-color: #b9cdfd;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.starter-grid strong {
  font-size: 15px;
}

.starter-copy {
  display: grid;
  align-content: start;
  gap: 7px;
}

.starter-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.starter-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.starter-icon svg {
  width: 19px;
  height: 19px;
}

.starter-arrow {
  position: absolute;
  right: 15px;
  bottom: 15px;
  width: 17px;
  height: 17px;
  color: #b2bac7;
}

.message-list {
  display: grid;
  width: min(780px, 100%);
  gap: 22px;
  margin: 0 auto;
}

.message {
  display: grid;
  gap: 8px;
}

.message.user {
  justify-items: end;
}

.bubble {
  max-width: min(620px, 82%);
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.68;
  word-break: break-word;
  white-space: pre-wrap;
}

.bot .bubble {
  white-space: normal;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 14px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 22px 0 10px;
  color: var(--text);
  line-height: 1.3;
}

.markdown-body h1 { font-size: 24px; }
.markdown-body h2 { font-size: 20px; }
.markdown-body h3 { font-size: 17px; }

.markdown-body ul,
.markdown-body ol {
  padding-left: 24px;
}

.markdown-body li + li {
  margin-top: 5px;
}

.markdown-body blockquote {
  padding: 2px 0 2px 14px;
  border-left: 3px solid #b9cdfd;
  color: var(--muted);
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef2f6;
  color: #344054;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101828;
  color: #f2f4f7;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  white-space: pre;
}

.markdown-body a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.markdown-body hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.generated-gallery {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.generated-gallery figure {
  display: grid;
  gap: 8px;
  margin: 0;
}

.generated-gallery img {
  width: min(520px, 100%);
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  background: #f7f7f5;
}

.generated-gallery figcaption {
  display: flex;
  gap: 8px;
}

.generated-gallery figcaption span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-gallery a,
.generated-gallery button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.generated-gallery button:hover,
.generated-gallery a:hover {
  background: var(--hover);
}

.bot .bubble {
  max-width: 100%;
  padding-left: 0;
  background: transparent;
}

.user .bubble {
  background: var(--bubble);
}

.message-tools {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.message:hover .message-tools,
.message:focus-within .message-tools {
  opacity: 1;
}

.mini-button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.mini-button:hover {
  background: var(--hover);
  color: var(--text);
}

.mini-icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.mini-icon-button:hover,
.mini-icon-button.active {
  background: var(--hover);
  color: var(--text);
}

.mini-icon-button svg {
  width: 17px;
  height: 17px;
}

.bubble.loading::after {
  display: inline-block;
  width: 18px;
  content: " ";
  animation: pulseDots 900ms infinite;
}

@keyframes pulseDots {
  0% { content: " "; }
  35% { content: "."; }
  65% { content: ".."; }
  100% { content: "..."; }
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 18px 24px 20px;
  background: linear-gradient(180deg, rgba(251, 252, 254, 0), #fbfcfe 28%);
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(780px, 100%);
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: min(360px, 100%);
  padding: 6px 6px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attachment-preview {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: var(--hover);
}

.file-icon {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--hover);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.file-name {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-size {
  flex: 0 0 auto;
  color: var(--soft);
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1fr) 40px 46px;
  align-items: end;
  gap: 6px;
  width: min(820px, 100%);
  min-height: 64px;
  padding: 8px 9px;
  border: 1px solid #d8e0ea;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--prompt-shadow);
}

.composer.is-image-mode {
  border-color: var(--accent);
}

.composer.is-dragging {
  border-color: #111111;
  background: #f4f4f2;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(234, 241, 255, 0.82);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.drop-overlay-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(440px, 100%);
  padding: 42px 28px;
  border: 2px dashed #7da2f7;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: var(--prompt-shadow);
  text-align: center;
}

.drop-overlay-card svg {
  width: 46px;
  height: 46px;
  color: var(--accent);
}

.drop-overlay-card strong {
  font-size: 20px;
}

.drop-overlay-card span {
  color: var(--muted);
  font-size: 13px;
}

.composer.is-image-mode .add-button {
  opacity: 0.4;
}

.composer textarea {
  display: block;
  min-height: 44px;
  max-height: 150px;
  padding: 9px 4px;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

textarea::placeholder,
input::placeholder {
  color: var(--soft);
}

.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.send-button:hover {
  background: #1849a9;
}

.send-button:disabled {
  cursor: not-allowed;
  background: #d4d4d2;
}

.stop-icon,
.is-generating .send-icon {
  display: none;
}

.is-generating .stop-icon {
  display: block;
}

.composer-note {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
  text-align: center;
}

.scroll-bottom {
  position: absolute;
  right: 28px;
  bottom: 132px;
  z-index: 3;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.scroll-bottom:hover {
  background: var(--hover);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 20, 20, 0.28);
}

.modal-backdrop.open {
  display: flex;
}

.settings-dialog {
  width: min(720px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(20, 20, 20, 0.18);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.settings-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px 22px 22px;
}

.settings-form .field {
  gap: 8px;
}

.settings-form .field input,
.settings-form .field select,
.settings-form .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d9d9d7;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: 0;
}

.settings-form .field textarea {
  resize: vertical;
  line-height: 1.5;
}

.wide {
  grid-column: 1 / -1;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--black);
}

.settings-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.secondary-button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #373632;
  font-weight: 650;
}

.secondary-button:hover {
  background: #f5f5f3;
}

body.sidebar-collapsed .sidebar { margin-left: -262px; }
body.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
body.sidebar-collapsed .floating-menu { display: inline-grid; }

:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

#voiceBtn.is-listening {
  border-color: #d83b3b;
  background: #fff0f0;
  color: #c92727;
  animation: voice-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(216, 59, 59, 0.14);
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 4;
    width: 270px;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.12);
  }

  body.sidebar-open::after {
    position: fixed;
    inset: 0;
    z-index: 3;
    background: rgba(17, 17, 17, 0.28);
    content: "";
  }

  body:not(.sidebar-open) .sidebar { margin-left: -270px; }
  body:not(.sidebar-open) .floating-menu { display: inline-grid; }

  .topbar {
    padding: 0 14px;
  }

  .top-actions {
    gap: 4px;
  }

  .status-pill {
    display: none;
  }

  .top-actions .icon-button {
    width: 36px;
    height: 36px;
  }

  .chat-switch {
    font-size: 16px;
    max-width: calc(100vw - 182px);
  }

  .chat-switch span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-stage {
    width: min(100% - 28px, 820px);
    padding: 28px 0 180px;
  }

  .empty-state {
    align-content: start;
    gap: 24px;
    padding: 22px 0 30px;
  }

  .empty-state h1 {
    font-size: 36px;
    letter-spacing: -0.04em;
  }

  .welcome-copy p {
    font-size: 15px;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

  .starter-grid button {
    min-height: 96px;
  }

  .composer-wrap {
    padding: 16px 14px max(18px, env(safe-area-inset-bottom));
  }

  .attachment-tray {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .attachment-chip {
    flex: 0 0 auto;
    max-width: 300px;
  }

  .composer {
    grid-template-columns: 40px 40px minmax(0, 1fr) 40px 42px;
    min-height: 62px;
    border-radius: 18px;
  }

  .history-actions {
    opacity: 1;
  }

  .scroll-bottom {
    right: 16px;
    bottom: 132px;
  }

  .login-panel {
    padding: 24px;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    flex-wrap: wrap;
  }

  .settings-actions button {
    flex: 1 1 140px;
  }
}

/* Reference-style local candidate */
.app-shell {
  grid-template-columns: 246px minmax(0, 1fr);
}

.sidebar {
  padding: 14px 12px 12px;
  border-right: 1px solid #ececec;
  background: #f8f8f8;
}

.sidebar-header {
  min-height: 48px;
  padding: 0 4px 12px;
}

.sidebar-header .brand-mark {
  width: 30px;
  height: 30px;
  background: transparent;
  color: #3d3d3d;
}

.sidebar-header .brand-mark svg {
  width: 23px;
  height: 23px;
}

.primary-nav {
  margin: 8px 0 10px;
  border: 1px solid #e5e5e5;
  background: #fff !important;
}

.sidebar-tools {
  display: grid;
  gap: 2px;
}

.sidebar-tools .nav-button,
.sidebar-search {
  min-height: 40px;
}

.sidebar-search {
  margin-top: 4px;
}

.sidebar-section {
  margin-top: 18px;
}

.guest-mode .sidebar-section {
  display: none;
}

.guest-auth-actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding: 8px 2px 0;
}

.sidebar-login-button,
.sidebar-register-button {
  min-height: 40px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar-login-button {
  background: #272727;
  color: #fff;
}

.sidebar-login-button:hover {
  background: #111;
}

.sidebar-register-button {
  border: 1px solid #e2e2e2;
  background: transparent;
  color: #222;
}

.sidebar-register-button:hover {
  background: #efefef;
}

.workspace {
  grid-template-rows: 64px minmax(0, 1fr) auto;
}

.topbar {
  padding: 0 28px;
}

.chat-switch {
  font-size: 16px;
  font-weight: 650;
}

.top-actions {
  gap: 10px;
}

.top-actions .share-button {
  width: 36px;
  padding: 0;
  justify-content: center;
  background: transparent;
}

.top-actions .share-button span {
  display: none;
}

.chat-stage {
  width: min(820px, calc(100vw - 44px));
  padding-top: 30px;
}

.welcome-orb {
  display: none;
}

.empty-state h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.chat-empty .empty-state {
  min-height: 0;
}

.chat-empty .welcome-copy {
  position: fixed;
  top: 31%;
  left: calc(50% + 123px);
  z-index: 1;
  width: min(820px, calc(100vw - 310px));
  transform: translateX(-50%);
}

.chat-empty .composer-wrap {
  position: fixed;
  top: 39%;
  left: calc(50% + 123px);
  z-index: 4;
  width: min(820px, calc(100vw - 310px));
  padding: 0;
  background: transparent;
  transform: translateX(-50%);
}

.chat-empty .composer {
  grid-template-columns: 44px minmax(0, 1fr) 40px 44px;
  grid-template-rows: 52px 42px;
  align-items: center;
  width: 100%;
  min-height: 112px;
  padding: 8px 12px;
  border: 1px solid #dedede;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-empty .composer textarea {
  grid-row: 1;
  grid-column: 1 / -1;
  align-self: stretch;
  min-height: 48px;
  padding: 12px 8px 4px;
  font-size: 16px;
}

.chat-empty .composer-tools {
  grid-row: 2;
  grid-column: 1;
}

.chat-empty #voiceBtn {
  grid-row: 2;
  grid-column: 3;
}

.chat-empty .send-button {
  grid-row: 2;
  grid-column: 4;
  width: 38px;
  height: 38px;
  background: #eeeeee;
  color: #a0a0a0;
}

.chat-empty .send-button:not(:disabled) {
  background: #1f1f1f;
  color: #fff;
}

.chat-empty .starter-grid {
  position: fixed;
  top: calc(39% + 130px);
  left: calc(50% + 123px);
  z-index: 2;
  display: flex;
  justify-content: center;
  width: min(820px, calc(100vw - 310px));
  gap: 8px;
  transform: translateX(-50%);
}

.chat-empty .starter-grid button {
  min-height: 38px;
  width: auto;
  padding: 0 14px;
  gap: 7px;
  border-radius: 999px;
  background: #fff;
}

.chat-empty .starter-icon {
  width: 20px;
  height: 20px;
  background: transparent;
}

.chat-empty .starter-icon svg {
  width: 16px;
  height: 16px;
}

.chat-empty .starter-copy strong {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.chat-empty .starter-copy span {
  display: none;
}

.chat-empty .composer-note {
  position: fixed;
  right: 24px;
  bottom: 16px;
  left: 270px;
  color: #555;
  font-size: 11px;
}

.auth-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(3px);
}

.auth-dialog-backdrop .login-panel {
  position: relative;
  border-radius: 18px;
}

.auth-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

@media (max-width: 760px) {
  .chat-empty .welcome-copy,
  .chat-empty .composer-wrap,
  .chat-empty .starter-grid {
    left: 50%;
    width: min(100% - 28px, 680px);
  }

  .chat-empty .welcome-copy {
    top: 22%;
  }

  .chat-empty .composer-wrap {
    top: 31%;
  }

  .chat-empty .starter-grid {
    top: calc(31% + 130px);
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .chat-empty .starter-grid button {
    flex: 0 0 auto;
  }

  .chat-empty .composer-note {
    right: 14px;
    bottom: 10px;
    left: 14px;
  }
}

/* GPT-style customer workspace */
:root {
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --hover: #ececec;
  --line: #e5e5e5;
  --text: #0d0d0d;
  --muted: #676767;
  --soft: #8f8f8f;
  --bubble: #f4f4f4;
  --black: #0d0d0d;
  --accent: #0d0d0d;
  --accent-soft: #f2f2f2;
  --prompt-shadow: 0 0 0 1px rgba(13, 13, 13, 0.05), 0 8px 28px rgba(13, 13, 13, 0.08);
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 10px 8px;
  border-right: 0;
}

.sidebar-header {
  padding: 0 4px 10px;
}

.brand-mark {
  border-radius: 50%;
  background: #0d0d0d;
}

.brand-copy strong {
  font-size: 15px;
}

.nav-button,
.search-box,
.history-item,
.icon-button,
.text-button {
  border-radius: 10px;
}

.nav-button.active,
.nav-button:hover {
  background: #ececec;
  box-shadow: none;
}

.sidebar-section {
  margin-top: 18px;
  padding: 0 4px;
}

.section-row {
  color: #8f8f8f;
  font-size: 12px;
  font-weight: 600;
}

.profile {
  margin: auto 2px 0;
  padding: 10px 6px 2px;
  border-top: 0;
  border-radius: 12px;
}

.profile:hover {
  background: #ececec;
}

.avatar {
  background: #0d0d0d;
}

.workspace {
  grid-template-rows: 52px minmax(0, 1fr) auto;
  background: #fff;
}

.topbar {
  padding: 0 18px;
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.92);
}

.chat-switch {
  font-size: 18px;
  font-weight: 600;
}

.model-switch-wrap,
.composer-tools {
  position: relative;
}

.popover-menu {
  position: absolute;
  z-index: 20;
  display: grid;
  gap: 4px;
  min-width: 280px;
  padding: 8px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.14);
}

.model-menu {
  top: calc(100% + 6px);
  left: 0;
}

.tools-menu {
  bottom: calc(100% + 12px);
  left: 0;
}

.popover-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.popover-item:hover {
  background: #f4f4f4;
}

.popover-item > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.popover-item strong {
  font-size: 14px;
}

.popover-item small,
.menu-note {
  color: var(--muted);
  font-size: 12px;
}

.popover-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: #f2f2f2;
}

.popover-icon svg {
  width: 19px;
  height: 19px;
}

.menu-check {
  width: 18px;
  height: 18px;
}

.menu-note {
  padding: 8px 10px 4px;
  border-top: 1px solid #ededed;
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: #f4f4f4;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.share-button:hover {
  background: #e8e8e8;
}

.share-button svg {
  width: 17px;
  height: 17px;
}

.status-pill {
  display: none;
}

.chat-stage {
  width: min(800px, calc(100vw - 40px));
  padding: 24px 0 184px;
}

.empty-state {
  align-content: center;
  gap: 34px;
  padding-bottom: 70px;
}

.welcome-copy {
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.welcome-orb {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #0d0d0d;
  color: #fff;
}

.welcome-orb svg {
  width: 28px;
  height: 28px;
}

.welcome-kicker,
.welcome-copy p {
  display: none;
}

.welcome-plus-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eee8ff;
  color: #6945d1;
  font-size: 12px;
  font-weight: 750;
}

.welcome-copy .welcome-subtitle:not([hidden]) {
  display: block;
  max-width: 520px;
  margin: -8px 0 0;
  color: #777;
  font-size: 14px;
  line-height: 1.5;
}

.empty-state h1 {
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.starter-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(680px, 100%);
}

.starter-grid button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 13px 14px;
  border-color: #e5e5e5;
  border-radius: 16px;
  box-shadow: none;
}

.starter-grid button:hover {
  border-color: #d3d3d3;
  background: #f9f9f9;
  box-shadow: none;
  transform: none;
}

.starter-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #f2f2f2;
  color: #424242;
}

.starter-copy {
  gap: 3px;
}

.starter-copy span {
  font-size: 12px;
}

.starter-arrow {
  display: none;
}

.message-list {
  width: min(740px, 100%);
  gap: 28px;
}

.bubble {
  line-height: 1.72;
}

.user .bubble {
  max-width: min(560px, 85%);
  padding: 10px 16px;
  border-radius: 20px;
}

.composer-wrap {
  padding: 18px 20px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
}

.composer {
  grid-template-columns: 42px minmax(0, 1fr) 40px 44px;
  width: min(768px, 100%);
  min-height: 58px;
  padding: 7px 8px;
  border: 0;
  border-radius: 28px;
  background: #f4f4f4;
  box-shadow: var(--prompt-shadow);
}

.composer textarea {
  min-height: 42px;
  padding: 9px 4px;
  background: transparent;
}

.composer.is-image-mode {
  box-shadow: 0 0 0 1px #bdbdbd, 0 8px 28px rgba(13, 13, 13, 0.08);
}

.composer.is-image-mode .add-button {
  background: #0d0d0d;
  color: #fff;
  opacity: 1;
}

.send-button {
  width: 40px;
  height: 40px;
  background: #0d0d0d;
}

.send-button:hover {
  background: #333;
}

.composer-note {
  color: #8f8f8f;
  font-size: 12px;
}

.attachment-tray {
  width: min(740px, 100%);
}

.scroll-bottom {
  right: 24px;
  bottom: 118px;
}

body.sidebar-collapsed .sidebar {
  margin-left: -260px;
}

@media (max-width: 760px) {
  .empty-state {
    align-content: center;
    padding: 10px 0 50px;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

  .starter-grid button {
    min-height: 70px;
  }

  .composer-wrap {
    padding: 12px 10px max(10px, env(safe-area-inset-bottom));
  }

  .composer {
    grid-template-columns: 38px minmax(0, 1fr) 38px 40px;
    border-radius: 24px;
  }

  .share-button span {
    display: none;
  }

  .share-button {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .model-menu {
    left: -42px;
  }

  .tools-menu {
    min-width: 260px;
  }
}

/* Final reference-layout overrides */
.app-shell { grid-template-columns: 246px minmax(0, 1fr); }
.sidebar {
  padding: 14px 12px 12px;
  border-right: 1px solid #ececec;
  background: #f8f8f8;
}
.sidebar-header { min-height: 48px; padding: 0 4px 12px; }
.sidebar-header .brand-mark { width: 30px; height: 30px; color: #111; }
.sidebar-header .brand-mark svg { width: 23px; height: 23px; }
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
}
.primary-nav { margin: 8px 0 10px; border: 1px solid #e5e5e5; background: #fff !important; }
.sidebar-tools { display: grid; gap: 2px; }
.sidebar-tools .nav-button,
.sidebar-search { min-height: 40px; }
.sidebar-search { margin-top: 4px; }
.guest-mode .sidebar-section { display: none; }
.section-row b {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-left: 3px;
  place-items: center;
  border-radius: 999px;
  background: #e7e7e7;
  color: #666;
  font-size: 10px;
}
.history-group-label {
  padding: 8px 8px 4px;
  color: #8b8b8b;
  font-size: 11px;
  font-weight: 600;
}
.guest-auth-actions { display: grid; gap: 9px; margin-top: auto; padding: 8px 2px 0; }
.sidebar-login-button,
.sidebar-register-button { min-height: 40px; border-radius: 999px; font-weight: 600; }
.sidebar-login-button { background: #272727; color: #fff; }
.sidebar-register-button { border: 1px solid #e2e2e2; background: transparent; color: #222; }
.workspace { grid-template-rows: 64px minmax(0, 1fr) auto; }
.topbar { padding: 0 28px; }
.chat-switch { font-size: 16px; font-weight: 650; }
.chat-stage { width: min(820px, calc(100% - 44px)); padding: 30px 0 240px; }
.welcome-orb { display: none; }
.empty-state h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; }

.chat-empty .empty-state { min-height: 0; }
.chat-empty .welcome-copy {
  position: fixed;
  top: 31%;
  left: calc(50% + 123px);
  width: min(820px, calc(100vw - 310px));
  transform: translateX(-50%);
}
.chat-empty .composer-wrap {
  position: fixed;
  top: 39%;
  right: auto;
  bottom: auto;
  left: calc(50% + 123px);
  display: block;
  width: min(820px, calc(100vw - 310px));
  height: auto;
  padding: 0;
  background: transparent;
  transform: translateX(-50%);
}
.chat-empty .composer {
  position: relative;
  grid-template-columns: 44px minmax(0, 1fr) 40px 44px;
  grid-template-rows: 52px 42px;
  width: 100%;
  height: 112px;
  min-height: 112px;
  padding: 8px 12px;
  border: 1px solid #dedede;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.composer {
  position: relative;
}
.composer-mode-chip {
  position: absolute;
  top: -38px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 5px 0 10px;
  border: 1px solid #dedede;
  border-radius: 999px;
  background: #fff;
  color: #333;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 600;
}
.composer-mode-chip svg {
  width: 16px;
  height: 16px;
}
.composer-mode-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: #777;
  font-size: 17px;
  line-height: 1;
}
.composer-mode-chip button:hover {
  background: #eee;
  color: #222;
}
.image-mode-active #sidebarImageBtn {
  background: #e9e9e9;
}
.chat-empty .composer textarea {
  grid-row: 1;
  grid-column: 1 / -1;
  align-self: stretch;
  min-height: 48px;
  padding: 12px 8px 4px;
  font-size: 16px;
}
.chat-empty .composer-tools { grid-row: 2; grid-column: 1; }
.chat-empty #voiceBtn { grid-row: 2; grid-column: 3; }
.chat-empty .send-button { grid-row: 2; grid-column: 4; width: 38px; height: 38px; background: #eee; color: #a0a0a0; }
.chat-empty .send-button:not(:disabled) { background: #1f1f1f; color: #fff; }
.chat-empty .starter-grid {
  position: fixed;
  top: calc(39% + 130px);
  left: calc(50% + 123px);
  display: flex;
  justify-content: center;
  width: min(820px, calc(100vw - 310px));
  gap: 8px;
  transform: translateX(-50%);
}
.chat-empty .starter-grid button { min-height: 38px; width: auto; padding: 0 14px; gap: 7px; border-radius: 999px; background: #fff; }
.chat-empty .starter-icon { width: 20px; height: 20px; background: transparent; }
.chat-empty .starter-icon svg { width: 16px; height: 16px; }
.chat-empty .starter-copy strong { font-size: 13px; font-weight: 500; white-space: nowrap; }
.chat-empty .starter-copy span { display: none; }
.chat-empty .composer-note {
  position: fixed;
  right: 24px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 270px;
  width: auto;
  margin: 0;
  color: #777;
  font-size: 11px;
  text-align: center;
  pointer-events: none;
}
.composer-note button {
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  pointer-events: auto;
}
.composer-note button:hover { color: #222; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .chat-empty .welcome-copy,
  .chat-empty .composer-wrap,
  .chat-empty .starter-grid { left: 50%; width: min(100% - 28px, 680px); }
  .chat-empty .welcome-copy { top: 22%; }
  .chat-empty .composer-wrap { top: 31%; padding: 0; }
  .chat-empty .composer { grid-template-columns: 38px minmax(0, 1fr) 38px 40px; }
  .chat-empty .starter-grid { top: calc(31% + 130px); overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; }
  .chat-empty .starter-grid button { flex: 0 0 auto; }
  .chat-empty .composer-note { right: 14px; bottom: 10px; left: 14px; }
}

/* ChatGPT-inspired guest shell */
.guest-top-actions { display: flex; align-items: center; gap: 8px; }
.guest-top-login,
.guest-top-register { min-height: 36px; padding: 0 15px; border-radius: 999px; font-size: 13px; font-weight: 650; }
.guest-top-login { background: #111; color: #fff; }
.guest-top-register { border: 1px solid #dedede; background: #fff; color: #222; }
.guest-links { display: grid; gap: 2px; margin-bottom: 12px; }
.guest-links button { min-height: 34px; padding: 0 8px; border-radius: 8px; background: transparent; text-align: left; }
.guest-links button:hover { background: #ececec; }
.guest-auth-actions strong { padding: 10px 8px 0; font-size: 12px; }
.guest-auth-actions > span { padding: 0 8px 8px; color: #888; font-size: 11px; line-height: 1.45; }
#voiceBtn span, .rail-account-button, .rail-account-menu { display: none; }

.guest-mode.sidebar-collapsed .app-shell { grid-template-columns: 52px minmax(0, 1fr); }
.guest-mode.sidebar-collapsed .sidebar {
  width: 52px; margin-left: 0; padding: 10px 6px; overflow: hidden; background: #fff;
}
.guest-mode.sidebar-collapsed .sidebar-header { display: block; padding: 0; }
.guest-mode.sidebar-collapsed .sidebar-header .brand { display: grid; width: 40px; height: 40px; place-items: center; }
.guest-mode.sidebar-collapsed #collapseBtn,
.guest-mode.sidebar-collapsed .sidebar-search,
.guest-mode.sidebar-collapsed .sidebar-section,
.guest-mode.sidebar-collapsed .guest-auth-actions { display: none !important; }
.guest-mode.sidebar-collapsed .nav-button {
  width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center;
  overflow: hidden; color: transparent; white-space: nowrap;
}
.guest-mode.sidebar-collapsed .nav-button svg { flex: 0 0 20px; color: #333; margin: 0; }
.guest-mode.sidebar-collapsed .nav-button { font-size: 0; }
.guest-mode.sidebar-collapsed .nav-button svg + * { display: none; }
.guest-mode.sidebar-collapsed .primary-nav { margin: 8px 0 2px; border: 0; background: transparent !important; }
.guest-mode.sidebar-collapsed .floating-menu { display: none; }
.guest-mode.sidebar-collapsed .rail-account-button {
  position: fixed; bottom: 10px; left: 8px; z-index: 40; display: grid; width: 36px; height: 36px;
  place-items: center; border-radius: 50%; background: #f4f4f4;
}
.rail-account-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rail-account-menu {
  position: fixed; bottom: 54px; left: 7px; z-index: 60; width: 250px; padding: 8px; border: 1px solid #ddd;
  border-radius: 16px; background: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}
.rail-account-menu:not([hidden]) { display: grid; }
.rail-account-menu button { min-height: 36px; padding: 0 10px; border-radius: 8px; background: transparent; text-align: left; }
.rail-account-menu button:hover { background: #f2f2f2; }
.rail-account-menu hr { width: 100%; margin: 5px 0; border: 0; border-top: 1px solid #eee; }

.guest-mode .top-actions > :not(.guest-top-actions) { display: none; }
.guest-mode.chat-empty .starter-grid { display: none; }
.guest-mode.chat-empty .welcome-copy {
  top: 35%; left: calc(50% + 26px); width: min(760px, calc(100vw - 110px));
}
.guest-mode.chat-empty .composer-wrap {
  top: 43%; left: calc(50% + 26px); width: min(760px, calc(100vw - 110px));
}
.guest-mode.chat-empty .composer {
  grid-template-columns: 42px minmax(0, 1fr) 42px auto; grid-template-rows: 54px;
  height: 54px; min-height: 54px; padding: 0 8px; border-radius: 999px;
  box-shadow: 0 12px 38px rgba(0, 0, 0, .08);
}
.guest-mode.chat-empty .composer textarea {
  grid-row: 1; grid-column: 2; min-height: 38px; padding: 9px 6px; align-self: center;
}
.guest-mode.chat-empty .composer-tools { grid-row: 1; grid-column: 1; align-self: center; }
.guest-mode.chat-empty #voiceBtn {
  grid-row: 1; grid-column: 4; display: flex; width: auto; min-width: 72px; padding: 0 13px; gap: 6px;
  border-radius: 999px; background: #f2f2f2;
}
.guest-mode.chat-empty #voiceBtn span { display: inline; font-size: 12px; font-weight: 650; }
.guest-mode.chat-empty .send-button { grid-row: 1; grid-column: 3; align-self: center; }
.guest-mode.chat-empty .send-button:disabled { display: none; }
.guest-mode.chat-empty .composer-note { left: 70px; }
.auth-dialog-backdrop { backdrop-filter: blur(3px); background: rgba(245, 245, 245, .78); }
.auth-dialog-backdrop .login-panel {
  width: min(390px, calc(100% - 28px)); border-radius: 18px; box-shadow: 0 14px 42px rgba(0, 0, 0, .16);
}

@media (max-width: 760px) {
  .guest-mode.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
  .guest-mode.sidebar-collapsed .sidebar,
  .guest-mode.sidebar-collapsed .rail-account-button { display: none; }
  .guest-mode.chat-empty .welcome-copy,
  .guest-mode.chat-empty .composer-wrap { left: 50%; width: calc(100% - 24px); }
  .guest-mode.chat-empty .composer-note { left: 14px; }
}

/* Account content center */
.info-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(245, 245, 245, .8);
  backdrop-filter: blur(4px);
}
.info-panel-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(900px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 70px rgba(0, 0, 0, .16);
}
.pricing-panel-open { padding: 12px; background: #f7f7f7; }
.pricing-panel-open .info-panel-card {
  width: 100%;
  height: calc(100vh - 24px);
  max-height: none;
  border-radius: 18px;
  box-shadow: none;
}
.pricing-panel-open .info-panel-header {
  position: relative;
  justify-content: center;
  padding: 24px 60px 14px;
  border-bottom: 0;
  text-align: center;
}
.pricing-panel-open .info-panel-header > div { display: grid; gap: 4px; }
.pricing-panel-open .info-panel-header #closeInfoPanelBtn { position: absolute; top: 14px; right: 14px; }
.pricing-panel-open .info-panel-body { padding: 8px 28px 26px; }
.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 26px 18px;
  border-bottom: 1px solid #eee;
}
.info-panel-header h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: -.03em; }
.info-panel-kicker { color: #7a55df; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.info-panel-body { min-height: 280px; padding: 24px 26px 28px; overflow: auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; min-height: 100%; }
.plan-card { position: relative; display: grid; align-content: start; padding: 24px; border: 1px solid #e2e2e2; border-radius: 18px; background: #fff; }
.plan-card.featured { border-color: #8b6be2; box-shadow: 0 8px 28px rgba(112, 79, 203, .12); }
.plan-card.current-plan { background: linear-gradient(180deg, #f3f0ff 0, #fff 34%); }
.plan-card > span { color: #7956d8; font-size: 11px; font-weight: 750; }
.plan-card h3 { margin: 12px 0 3px; font-size: 27px; }
.plan-card p { min-height: 42px; margin: 0; color: #777; font-size: 12px; line-height: 1.45; }
.plan-card strong { margin: 20px 0 15px; font-size: 17px; }
.plan-card h4 { margin: 22px 0 4px; font-size: 12px; }
.plan-card ul { display: grid; gap: 12px; min-height: 190px; padding: 0; color: #333; font-size: 12px; list-style: none; }
.plan-card li::before { content: "✓"; margin-right: 7px; color: #7652dc; }
.plan-card button { min-height: 42px; border-radius: 999px; background: #202020; color: #fff; font-weight: 650; }
.plan-card button:disabled { border: 1px solid #ddd; background: #fff; color: #999; }
.plan-card small { align-self: end; color: #888; font-size: 10px; line-height: 1.55; }
.settings-panel { display: grid; grid-template-columns: 180px minmax(0, 1fr); min-height: 390px; gap: 20px; }
.settings-nav { display: grid; align-content: start; gap: 3px; padding-right: 16px; border-right: 1px solid #eee; }
.settings-nav button { min-height: 40px; padding: 0 11px; border-radius: 9px; background: transparent; text-align: left; }
.settings-nav button.active, .settings-nav button:hover { background: #f0f0f0; }
.settings-content { display: grid; align-content: start; gap: 4px; }
.setting-row { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #eee; }
.setting-row span { display: grid; gap: 4px; }
.setting-row small, .account-summary span { color: #888; font-size: 11px; }
.setting-row button { min-width: 100px; min-height: 34px; padding: 0 11px; border: 1px solid #ddd; border-radius: 9px; background: #fff; }
.setting-row .danger-setting { color: #b23838; }
.account-summary { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; background: #f7f7f7; }
.account-summary > div:last-child { display: grid; gap: 4px; }
.help-search { display: grid; gap: 8px; margin-bottom: 20px; font-size: 12px; font-weight: 650; }
.help-search input { height: 48px; padding: 0 15px; border: 1px solid #ddd; border-radius: 13px; outline: none; }
.faq-list { display: grid; gap: 7px; }
.faq-list details { padding: 15px 16px; border: 1px solid #e7e7e7; border-radius: 12px; }
.faq-list summary { cursor: pointer; font-weight: 650; }
.faq-list p { margin: 11px 0 0; color: #666; font-size: 13px; line-height: 1.6; }
.release-list { display: grid; gap: 0; }
.release-list article { position: relative; padding: 4px 0 25px 24px; border-left: 1px solid #ddd; }
.release-list article::before { content: ""; position: absolute; top: 5px; left: -5px; width: 9px; height: 9px; border-radius: 50%; background: #7652dc; }
.release-list time { color: #888; font-size: 11px; }
.release-list h3 { margin: 6px 0; font-size: 16px; }
.release-list p { margin: 0; color: #666; font-size: 13px; }
.release-list span { display: inline-block; margin-top: 9px; padding: 3px 7px; border-radius: 999px; background: #eee8ff; color: #6d49d0; font-size: 10px; }
.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.download-grid button { display: grid; gap: 5px; padding: 20px; border: 1px solid #e4e4e4; border-radius: 15px; background: #fff; text-align: left; }
.download-grid button:hover { border-color: #aaa; background: #fafafa; }
.download-grid b { font-size: 17px; }
.download-grid span, .download-grid small, .panel-note { color: #888; font-size: 11px; }
.panel-note { margin: 18px 0 0; }
.legal-content { max-width: 680px; margin: 0 auto; color: #4e4e4e; line-height: 1.75; }
.legal-content > p { padding: 15px; border-radius: 12px; background: #f6f4fc; }
.legal-content h3 { margin: 25px 0 5px; color: #222; font-size: 16px; }
.legal-content p { font-size: 13px; }

@media (max-width: 1100px) {
  .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .info-panel-backdrop { padding: 10px; align-items: end; }
  .info-panel-card { max-height: calc(100vh - 20px); border-radius: 20px 20px 12px 12px; }
  .info-panel-header, .info-panel-body { padding-right: 18px; padding-left: 18px; }
  .pricing-panel-open { padding: 0; }
  .pricing-panel-open .info-panel-card { height: 100vh; max-height: 100vh; border-radius: 0; }
  .pricing-panel-open .info-panel-body { padding: 8px 14px 24px; }
  .pricing-grid { grid-template-columns: 1fr; min-width: 0; }
  .download-grid { grid-template-columns: 1fr; }
  .settings-panel { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid #eee; }
  .settings-nav button { flex: 0 0 auto; }
}
