:root {
  --bg: hsl(260 40% 5.882%);
  --bg-soft: hsl(261.429 23.333% 11.765%);
  --panel: hsl(258.462 28.889% 8.824%);
  --panel-2: hsl(261 33.333% 11.765%);
  --line: hsl(258.75 19.51% 16.08%);
  --line-strong: hsl(257.65 18.68% 22%);
  --text: hsl(260 100% 97.059%);
  --muted: hsl(261.818 20.245% 68.039%);
  --dim: hsl(261.818 13% 49%);
  --amber: hsl(258.621 100% 65.882%);
  --amber-light: hsl(257.962 100% 69.216%);
  --amber-soft: hsl(258.621 100% 65.882% / 0.13);
  --green: #38b978;
  --red: hsl(0 72% 62%);
  --shadow: 0 25px 55px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

html.light {
  --bg: hsl(252 100% 99.02%);
  --bg-soft: hsl(255 36.364% 95.686%);
  --panel: hsl(0 0% 100%);
  --panel-2: hsl(255 36.364% 95.686%);
  --line: hsl(256.36 18.03% 88.04%);
  --line-strong: hsl(256.36 15.94% 82%);
  --text: hsl(268.421 57.576% 6.471%);
  --muted: hsl(258.182 14.163% 45.686%);
  --dim: hsl(258.182 10% 55%);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 48px 16px;
}

.auth-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, hsl(258.621 100% 65.882% / 0.13), transparent 35%),
    radial-gradient(circle at 85% 80%, hsl(258.621 100% 65.882% / 0.07), transparent 32%);
}

.auth-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}

.login-card {
  width: min(448px, 100%);
  padding: 24px;
  border: 1px solid hsl(258.75 19.51% 16.08% / 0.7);
  border-radius: 12px;
  color: var(--text);
  background: hsl(258.462 28.889% 8.824% / 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: fade-in 350ms ease-out;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 16px hsl(258.621 100% 65.882% / 0.2));
}

.brand > span:last-child {
  min-width: 0;
  display: grid;
}

.brand strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

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

.login-copy {
  margin: 16px 0 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-copy h1,
.empty-state h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.login-copy > p:last-child,
.hero-copy {
  color: var(--muted);
  line-height: 1.6;
}

.login-card form {
  display: grid;
  gap: 20px;
}

.login-card label {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.login-card input {
  width: 100%;
  height: 36px;
  padding: 4px 12px;
  border: 1px solid hsl(257.65 18.68% 17.84%);
  border-radius: 6px;
  outline: none;
  color: var(--text);
  background: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-card input:focus {
  border-color: var(--amber-light);
  box-shadow: 0 0 0 1px var(--amber-light);
}

.field-group {
  display: grid;
  gap: 8px;
}

.password-shell {
  position: relative;
}

.password-shell input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.password-toggle svg,
.primary svg,
.theme-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--amber);
  background: var(--amber-soft);
}

.login-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  color: #fff;
  background: linear-gradient(90deg, #6040a5 0%, #4b327c 50%, #3d2964 100%);
  box-shadow: 0 1px 2px rgba(61, 41, 100, 0.25);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
}

.primary:hover {
  filter: brightness(1.1);
}

.primary:active {
  filter: brightness(0.95);
}

.wide {
  width: 100%;
}

.form-error {
  min-height: 0;
  margin: -4px 0;
  color: var(--red);
  font-size: 12px;
}

.form-error:empty {
  display: none;
}

.auth-footer {
  position: absolute;
  bottom: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  background: hsl(261.429 23.333% 11.765% / 0.2);
}

.sidebar {
  position: relative;
  z-index: 20;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: hsl(260 40% 5.882% / 0.96);
  backdrop-filter: blur(20px);
}

.sidebar-head {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.new-chat {
  height: 36px;
  margin: 12px 14px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(90deg, #6040a5 0%, #4b327c 50%, #3d2964 100%);
  box-shadow: 0 1px 2px rgba(61, 41, 100, 0.25);
  cursor: pointer;
}

.new-chat:hover {
  filter: brightness(1.1);
}

.new-chat .plus {
  color: #fff;
  font-size: 20px;
  font-weight: 300;
}

.new-chat kbd {
  margin-left: auto;
  color: var(--dim);
  font-size: 10px;
  font-family: inherit;
}

.sidebar-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 9px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-button,
.logout-button {
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.thread-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 0 8px;
}

.thread-row {
  position: relative;
  width: 100%;
  min-height: 42px;
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.thread-row:hover,
.thread-row.active {
  color: var(--text);
  background: var(--panel-2);
}

.thread-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 2px;
  height: 20px;
  border-radius: 2px;
  background: var(--amber);
}

.thread-row > span:first-child {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.thread-open {
  min-width: 0;
  min-height: 30px;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.thread-open span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.thread-menu {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: transparent;
  background: none;
  cursor: pointer;
}

.thread-row:hover .thread-menu,
.thread-row.active .thread-menu {
  color: var(--muted);
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: hsl(260 40% 5.882% / 0.9);
}

.account-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.account-row:hover {
  background: var(--panel-2);
}

.account-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.account-row strong {
  font-size: 12px;
}

.account-row small {
  color: var(--muted);
  font-size: 10px;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--amber-light);
  background: var(--amber-soft);
  font-size: 13px;
}

.chevron {
  color: var(--dim);
}

.logout-button {
  width: 100%;
  padding: 7px;
  color: var(--dim);
  font-size: 10px;
  text-align: left;
}

.chat-shell {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: hsl(261.429 23.333% 11.765% / 0.12);
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: hsl(260 40% 5.882% / 0.9);
  backdrop-filter: blur(20px);
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h2 {
  max-width: min(42vw, 560px);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.connection {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.connection-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 7px hsl(258.621 100% 65.882% / 0.55);
}

.connection-dot.ready {
  background: var(--green);
  box-shadow: 0 0 7px rgba(103, 193, 140, 0.55);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-shell {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(258.462 28.889% 8.824% / 0.8);
}

.select-shell > span {
  color: var(--dim);
  font-size: 9px;
  text-transform: uppercase;
}

.select-shell select {
  max-width: 150px;
  border: 0;
  outline: none;
  color: var(--text);
  background: var(--panel);
  font-size: 11px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-2);
}

.theme-button {
  border-color: transparent;
}

.files-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.empty-state {
  width: min(760px, calc(100% - 40px));
  min-height: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 50px 0 90px;
  text-align: center;
}

.hero-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 24px;
  filter: drop-shadow(0 14px 24px hsl(258.621 100% 65.882% / 0.22));
}

.empty-state h1 {
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 700;
  line-height: 1.08;
}

.hero-copy {
  max-width: 540px;
  margin: 14px 0 35px;
}

.suggestions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.suggestions button {
  min-height: 112px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: hsl(258.462 28.889% 8.824% / 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover {
  border-color: hsl(258.621 100% 65.882% / 0.35);
  background: var(--amber-soft);
  transform: translateY(-1px);
}

.suggestions span {
  color: var(--amber);
  font-size: 20px;
}

.suggestions strong {
  font-size: 12px;
}

.suggestions small {
  color: var(--muted);
  font-size: 10px;
}

.message-stack {
  width: min(850px, calc(100% - 38px));
  margin: 0 auto;
  padding: 30px 0 80px;
}

.message {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  column-gap: 12px;
  margin: 0 0 30px;
}

.message-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--amber-light);
  background: var(--amber-soft);
  font-size: 10px;
}

.message.user .message-avatar {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #6040a5, #3d2964);
}

.message-main {
  min-width: 0;
}

.message-meta {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-content {
  color: hsl(260 100% 97.059% / 0.9);
  font-size: 14px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.message.user .message-content {
  white-space: pre-wrap;
}

.message-content p {
  margin: 0 0 13px;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 24px 0 10px;
  color: var(--text);
  font-weight: 650;
}

.message-content h1 {
  font-size: 25px;
}

.message-content h2 {
  font-size: 20px;
}

.message-content h3 {
  font-size: 17px;
}

.message-content ul,
.message-content ol {
  padding-left: 22px;
}

.message-content a {
  color: var(--amber-light);
  text-decoration-color: hsl(257.962 100% 69.216% / 0.35);
}

.message-content code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: hsl(257.962 100% 82%);
  background: hsl(261 33.333% 11.765% / 0.9);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}

.code-block {
  position: relative;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: hsl(260 42% 4.4%);
  overflow: hidden;
}

.code-head {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 9px;
  text-transform: uppercase;
}

.copy-code {
  border: 0;
  color: var(--muted);
  background: none;
  font-size: 9px;
  cursor: pointer;
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
}

.code-block pre code {
  padding: 0;
  border: 0;
  color: hsl(260 45% 91%);
  background: none;
  font-size: 12px;
  line-height: 1.6;
}

.message.commentary {
  margin-bottom: 18px;
}

.message.commentary .message-content {
  color: var(--muted);
  font-size: 12px;
}

.typing-caret::after {
  content: "";
  width: 6px;
  height: 15px;
  display: inline-block;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--amber);
  animation: blink 0.9s infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.activity {
  margin: 8px 0 18px 43px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: hsl(258.462 28.889% 8.824% / 0.65);
  overflow: hidden;
}

.activity summary {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.activity pre,
.activity-body {
  margin: 0;
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  color: #aaa89f;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.55;
  overflow: auto;
}

.generated-image {
  max-width: min(100%, 720px);
  margin-top: 12px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.approval-tray {
  width: min(850px, calc(100% - 38px));
  margin: 0 auto 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid hsl(258.621 100% 65.882% / 0.35);
  border-radius: 10px;
  background: hsl(258.462 28.889% 8.824% / 0.98);
  box-shadow: var(--shadow);
}

.approval-tray p {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--text);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-tray button {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 9px;
  background: var(--panel-2);
  font-size: 10px;
  cursor: pointer;
}

.approval-tray .approve {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(90deg, #6040a5 0%, #4b327c 50%, #3d2964 100%);
}

.composer-zone {
  padding: 7px 20px 14px;
  background: linear-gradient(180deg, transparent, var(--bg) 26%);
}

.composer {
  width: min(850px, 100%);
  min-height: 54px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: hsl(258.462 28.889% 8.824% / 0.98);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
}

.composer:focus-within {
  border-color: var(--amber-light);
  box-shadow: 0 0 0 1px hsl(257.962 100% 69.216% / 0.6);
}

.composer textarea {
  min-height: 36px;
  max-height: 180px;
  flex: 1;
  resize: none;
  padding: 8px 3px 5px;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--dim);
}

.composer-tool,
.send-button,
.stop-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.composer-tool {
  color: var(--muted);
  background: transparent;
  font-size: 21px;
}

.composer-tool:hover {
  background: var(--panel-2);
}

.send-button {
  color: #fff;
  background: linear-gradient(135deg, #6040a5, #3d2964);
  font-size: 20px;
}

.send-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stop-button {
  color: var(--text);
  background: hsl(0 62% 32%);
  font-size: 12px;
}

.composer-note {
  width: min(850px, 100%);
  margin: 6px auto 0;
  color: var(--dim);
  font-size: 9px;
  text-align: center;
}

.attachment-list {
  width: min(850px, 100%);
  min-height: 0;
  margin: 0 auto 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-chip {
  max-width: 240px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
  font-size: 10px;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip button {
  border: 0;
  color: var(--dim);
  background: none;
  cursor: pointer;
}

.file-panel {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  width: min(390px, 92vw);
  height: 100%;
  padding: 20px;
  border-left: 1px solid var(--line-strong);
  background: hsl(258.462 28.889% 8.824% / 0.98);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.file-panel.open {
  transform: translateX(0);
}

.file-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.file-panel h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}

.panel-actions {
  display: flex;
  gap: 6px;
}

.file-panel-copy {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.file-list {
  height: calc(100% - 112px);
  overflow: auto;
}

.file-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  padding: 9px 5px;
  border-bottom: 1px solid var(--line);
}

.file-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 9px;
  text-transform: uppercase;
}

.file-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-meta a {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta small {
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-delete {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  color: transparent;
  background: none;
  cursor: pointer;
}

.file-row:hover .file-delete {
  color: var(--dim);
}

.file-empty {
  padding: 40px 20px;
  color: var(--dim);
  font-size: 11px;
  text-align: center;
}

.backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.48);
}

.backdrop.visible {
  display: block;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 360px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  font-size: 11px;
  animation: toast-in 160ms ease;
}

.toast.error {
  border-color: rgba(231, 128, 112, 0.42);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.mobile-only {
  display: none;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: grid;
  }

  .topbar {
    padding: 0 12px;
  }

  .effort-select {
    display: none;
  }
}

@media (max-width: 650px) {
  .auth-header {
    padding: 20px;
  }

  .login-shell {
    padding-right: 16px;
    padding-left: 16px;
  }

  .topbar h2 {
    max-width: 31vw;
  }

  .select-shell > span {
    display: none;
  }

  .select-shell select {
    max-width: 110px;
  }

  .files-button {
    display: none;
  }

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

  .suggestions button {
    min-height: 78px;
  }

  .empty-state {
    padding-bottom: 40px;
  }

  .composer-zone {
    padding-right: 10px;
    padding-left: 10px;
  }

  .message-stack {
    width: calc(100% - 24px);
  }

  .message {
    grid-template-columns: 27px minmax(0, 1fr);
    column-gap: 8px;
  }

  .activity {
    margin-left: 35px;
  }
}

/* Product chat layout */
html {
  height: 100%;
  max-width: 100vw;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100vw;
  height: 100%;
  max-width: 100vw;
  overscroll-behavior: none;
}

button,
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.login-shell,
.app-shell {
  position: fixed;
  top: var(--viewport-top, 0px);
  right: 0;
  left: 0;
  height: var(--viewport-height, 100dvh);
  max-height: var(--viewport-height, 100dvh);
}

.chat-shell,
.sidebar,
.file-panel {
  height: 100%;
  max-height: 100%;
}

.app-shell,
.chat-shell,
.topbar,
.topbar-left,
.topbar-controls,
.messages,
.composer-zone,
.composer,
.message-stack,
.message,
.message-main,
.message-content {
  min-width: 0;
}

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

.chat-shell {
  min-height: 0;
}

.messages {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.message-stack {
  width: min(920px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 96px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.message {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message.user {
  justify-content: flex-end;
}

.message-main {
  max-width: min(82%, 760px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.user .message-main {
  max-width: min(72%, 660px);
  align-items: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 0;
  border-radius: 10px;
  color: var(--amber-light);
  background: var(--amber-soft);
  overflow: hidden;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.message.user .message-avatar {
  display: none;
}

.message-meta {
  min-height: auto;
  margin: 0 0 7px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
}

.message.user .message-meta {
  text-align: right;
}

.message-content {
  width: fit-content;
  max-width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 5px 16px 16px 16px;
  color: hsl(260 100% 97.059% / 0.92);
  background: hsl(258.462 28.889% 8.824% / 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.65;
}

.message.user .message-content {
  padding: 10px 14px;
  border: 0;
  border-radius: 16px 16px 5px 16px;
  color: #fff;
  background: linear-gradient(135deg, #6848ad 0%, #4b327c 70%, #3d2964 100%);
  box-shadow: 0 8px 22px rgba(61, 41, 100, 0.24);
  font-size: 15px;
  line-height: 1.48;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.message.commentary {
  margin: -8px 0 0;
}

.message.commentary .message-content {
  padding: 9px 12px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}

.activity {
  width: min(760px, calc(100% - 42px));
  margin: -10px 0 0 42px;
  border-radius: 12px;
  background: hsl(258.462 28.889% 8.824% / 0.68);
}

.composer-zone {
  position: relative;
  z-index: 10;
  padding: 8px 20px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 22%);
}

.composer {
  position: relative;
  width: min(920px, 100%);
  min-height: 58px;
  align-items: flex-end;
  padding: 8px;
  border-radius: 18px;
  background: hsl(258.462 28.889% 8.824% / 0.98);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
}

.composer textarea {
  min-width: 0;
  min-height: 40px;
  padding: 9px 4px 8px;
  font-size: 16px;
  line-height: 1.42;
}

.composer-tool,
.send-button,
.voice-button,
.stop-button {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 12px;
}

.composer-tool {
  font-size: 23px;
}

.send-button {
  box-shadow: 0 6px 18px rgba(96, 64, 165, 0.32);
}

.send-button svg,
.voice-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #6040a5, #3d2964);
  box-shadow: 0 6px 18px rgba(96, 64, 165, 0.32);
  cursor: pointer;
}

.voice-button.recording {
  background: hsl(0 68% 50%);
  box-shadow: 0 6px 18px hsl(0 68% 42% / 0.32);
}

.voice-button.transcribing {
  cursor: wait;
}

.voice-button:disabled {
  opacity: 0.8;
}

.voice-stop {
  fill: currentColor !important;
  stroke: none !important;
}

.voice-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid hsl(0 0% 100% / 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: voice-spin 700ms linear infinite;
}

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

.recording-bar {
  min-width: 0;
  min-height: 40px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.recording-bar button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.recording-bar button:hover {
  color: var(--text);
  background: var(--panel-2);
}

.recording-pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: hsl(0 72% 58%);
  box-shadow: 0 0 0 0 hsl(0 72% 58% / 0.5);
  animation: recording-pulse 1.4s ease-out infinite;
}

@keyframes recording-pulse {
  65%, 100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

.recording-bar time {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.recording-bar > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-menu {
  position: absolute;
  z-index: 60;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(390px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: hsl(258.462 28.889% 8.824% / 0.98);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(24px);
  transform-origin: bottom left;
  animation: attachment-menu-in 150ms ease-out;
}

@keyframes attachment-menu-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.attachment-menu > button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 5px 8px;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.attachment-menu > button:hover {
  background: var(--panel-2);
}

.attachment-menu > button > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: center;
}

.attachment-menu strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.attachment-menu small {
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-menu-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
}

.attachment-menu-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-icon {
  background: linear-gradient(145deg, #6b52bf, #49327f);
}

.camera-icon {
  background: linear-gradient(145deg, #d06483, #9d3658);
}

.file-choice-icon {
  background: linear-gradient(145deg, #4a8ed8, #2f5f9d);
}

.composer-note {
  width: min(920px, 100%);
  margin-top: 7px;
  font-size: 10px;
}

.attachment-list {
  width: min(920px, 100%);
}

.attachment-chip img {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 6px;
  object-fit: cover;
}

.approval-tray {
  width: min(920px, calc(100% - 40px));
}

@media (max-width: 900px) {
  .app-shell {
    width: 100vw;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .sidebar {
    width: min(320px, 88vw);
    max-width: 88vw;
    padding-top: env(safe-area-inset-top);
  }

  .topbar {
    height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
  }

  .topbar h2 {
    max-width: min(56vw, 420px);
    margin-bottom: 3px;
    font-size: 14px;
  }

  .connection {
    font-size: 10px;
  }

  .select-shell {
    display: none;
  }

  .files-button {
    display: grid;
  }

  .topbar .icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
  }

  .empty-state {
    width: min(560px, calc(100% - 28px));
    min-height: auto;
    justify-content: flex-start;
    padding: clamp(28px, 8vh, 64px) 0 100px;
  }

  .hero-mark {
    width: 56px;
    height: 56px;
    margin-bottom: 17px;
  }

  .empty-state h1 {
    font-size: clamp(27px, 8vw, 34px);
  }

  .hero-copy {
    margin: 12px 0 22px;
    font-size: 14px;
    line-height: 1.5;
  }

  .suggestions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .suggestions button {
    min-height: 68px;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 10px;
    row-gap: 2px;
    padding: 11px 13px;
  }

  .suggestions span {
    grid-row: 1 / 3;
    align-self: center;
  }

  .suggestions strong,
  .suggestions small {
    grid-column: 2;
  }

  .message-stack {
    width: calc(100% - 24px);
    padding: 20px 0 72px;
    gap: 18px;
  }

  .message-main {
    max-width: calc(100% - 42px);
  }

  .message.user .message-main {
    max-width: 84%;
  }

  .message-content {
    padding: 11px 13px;
    font-size: 15px;
    line-height: 1.58;
  }

  .message.user .message-content {
    font-size: 16px;
  }

  .activity {
    width: calc(100% - 42px);
  }

  .composer-zone {
    padding: 7px 10px max(8px, env(safe-area-inset-bottom));
  }

  .composer {
    min-height: 54px;
    border-radius: 17px;
  }

  .composer-note {
    display: none;
  }

  .composer textarea,
  .login-card input,
  select {
    font-size: 16px;
  }

  .attachment-list {
    margin-bottom: 4px;
  }

  .toast-region {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .auth-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .auth-footer {
    right: 16px;
    left: 16px;
  }

  .login-card {
    padding: 20px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .sidebar-open {
    flex: 0 0 auto;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .message-main {
    max-width: calc(100% - 38px);
  }

  .message.user .message-main {
    max-width: 88%;
  }

  .code-block {
    max-width: calc(100vw - 76px);
  }

  .file-panel {
    width: 100vw;
    max-width: 100vw;
    padding: calc(16px + env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }
}
