:root {
  color-scheme: dark;
  --bg: #1f1f1d;
  --sidebar: #1b1b19;
  --surface: #292927;
  --surface-hover: #30302e;
  --surface-active: #3a3a37;
  --border: rgba(255, 255, 255, 0.105);
  --border-strong: rgba(255, 255, 255, 0.19);
  --text: #e9e7e2;
  --muted: #aaa7a0;
  --faint: #73716c;
  --accent: #d9aa35;
  --accent-soft: #3e371e;
  --danger: #ef7b72;
  --sidebar-width: 330px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

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

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

button,
select {
  color: inherit;
}

button {
  border: 0;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.loading-screen,
.auth-shell {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 26%, rgba(213, 171, 68, 0.065), transparent 31%),
    var(--bg);
}

.loading-screen {
  align-content: center;
  gap: 20px;
}

.loading-dots {
  display: flex;
  gap: 5px;
}

.loading-dots i {
  width: 5px;
  height: 5px;
  animation: loading-pulse 1.1s infinite;
  border-radius: 50%;
  background: var(--muted);
}

.loading-dots i:nth-child(2) {
  animation-delay: 0.12s;
}

.loading-dots i:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes loading-pulse {
  0%,
  70%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  35% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.loading-line {
  width: 104px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.loading-line::after {
  display: block;
  width: 42px;
  height: 100%;
  animation: loading-line 1.15s ease-in-out infinite;
  border-radius: inherit;
  background: var(--accent);
  content: "";
}

@keyframes loading-line {
  from {
    transform: translateX(-44px);
  }

  to {
    transform: translateX(110px);
  }
}

.claude-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: #e7e2d7;
  color: #24231f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.08em;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.24);
}

.auth-card {
  display: grid;
  width: min(100%, 414px);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(38, 38, 35, 0.94);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.32);
}

.auth-card-wide {
  width: min(100%, 520px);
}

.auth-card .claude-symbol {
  margin: 0 auto 22px;
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 580;
  letter-spacing: -0.04em;
  text-align: center;
}

.auth-card > p {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

.auth-card label,
.oauth-code-form label {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.auth-card label > span,
.oauth-code-form label > span {
  color: #cbc8c1;
  font-size: 13px;
}

.auth-card input,
.auth-card textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #191917;
  color: var(--text);
  line-height: 1.45;
  resize: vertical;
  transition: border-color 0.15s;
}

.auth-card input {
  height: 47px;
}

.auth-card input:focus,
.auth-card textarea:focus {
  border-color: rgba(217, 170, 53, 0.65);
}

.primary-button,
.secondary-button,
.oauth-link {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 620;
  text-decoration: none;
}

.primary-button {
  margin-top: 4px;
  background: #e6e2d9;
  color: #20201e;
}

.primary-button:hover {
  background: #f3f0e9;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.secondary-button {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}

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

.oauth-link {
  gap: 8px;
  margin-bottom: 22px;
  border: 1px solid rgba(217, 170, 53, 0.3);
  background: var(--accent-soft);
  color: #e9c86c;
}

.oauth-link svg {
  width: 15px;
  height: 15px;
}

.oauth-code-form {
  display: grid;
}

.form-error {
  min-height: 19px;
  margin: -4px 0 8px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

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

.wordmark {
  color: #e8e5de;
  font-size: 18px;
  font-weight: 590;
  letter-spacing: -0.025em;
}

.wordmark span {
  color: var(--muted);
  font-weight: 450;
}

.icon-button,
.tool-button,
.send-button {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
  color: var(--muted);
}

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

.sidebar-close,
.mobile-menu {
  display: none;
}

.new-chat {
  display: flex;
  width: calc(100% - 24px);
  min-height: 43px;
  align-items: center;
  gap: 11px;
  margin: 8px 12px 23px;
  padding: 0 13px;
  border-radius: 9px;
  background: transparent;
  color: #d9d6cf;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
}

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

.new-chat svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.sidebar-label {
  padding: 0 21px 10px;
  color: #797771;
  font-size: 13px;
  font-weight: 510;
}

.chat-list {
  min-height: 0;
  padding: 0 9px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #5a5955 transparent;
  scrollbar-width: thin;
}

.chat-row {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 8px;
}

.chat-row:hover {
  background: #292927;
}

.chat-row.active {
  background: #363633;
}

.chat-select {
  display: grid;
  min-width: 0;
  min-height: 39px;
  grid-template-columns: 13px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: inherit;
  background: transparent;
  color: #b9b6af;
  cursor: pointer;
  text-align: left;
}

.chat-row.active .chat-select {
  color: #f0eee9;
}

.chat-select > span:last-child {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-dot {
  width: 6px;
  height: 6px;
  border: 1px solid #686661;
  border-radius: 50%;
}

.chat-dot.running {
  border-color: var(--accent);
  animation: dot-pulse 1.2s infinite;
  background: var(--accent);
}

@keyframes dot-pulse {
  50% {
    box-shadow: 0 0 0 3px rgba(217, 170, 53, 0.14);
  }
}

.chat-delete {
  display: none;
  width: 30px;
  height: 30px;
  margin-right: 4px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.chat-row:hover .chat-delete,
.chat-row.active .chat-delete {
  display: grid;
}

.chat-delete:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--danger);
}

.chat-delete svg {
  width: 16px;
  height: 16px;
}

.sidebar-empty {
  padding: 8px 12px;
  color: #66645f;
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-footer {
  display: grid;
  min-height: 67px;
  grid-template-columns: 34px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.account-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #343431;
  color: #d9d6cf;
  font-size: 13px;
  font-weight: 650;
}

.account-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-copy strong,
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  color: #d8d5ce;
  font-size: 13px;
  font-weight: 570;
}

.account-copy span {
  color: var(--faint);
  font-size: 11px;
}

.sidebar-backdrop {
  display: none;
}

.main {
  position: relative;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: 64px minmax(0, 1fr);
  background: var(--bg);
}

.topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  background: rgba(31, 31, 29, 0.9);
  backdrop-filter: blur(15px);
}

.topbar-title {
  overflow: hidden;
  color: #e9e7e2;
  font-size: 15px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.online-dot {
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

.topbar-spinner {
  width: 12px;
  height: 12px;
  animation: spin 0.9s linear infinite;
  border: 2px solid rgba(217, 170, 53, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
}

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

.conversation {
  min-height: 0;
  padding: 10px 26px 190px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: #53524e transparent;
  scrollbar-width: thin;
}

.messages {
  width: min(100%, 920px);
  margin: 18px auto 0;
}

.message {
  display: flex;
  width: 100%;
  margin: 0 0 25px;
}

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

.message-content {
  min-width: 0;
  color: #d4d1ca;
  font-size: 15px;
  line-height: 1.65;
}

.message.assistant .message-content {
  width: 100%;
}

.message.user .message-content {
  width: fit-content;
  max-width: min(74%, 680px);
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: 13px;
  background: #30302e;
  color: #dedbd5;
  line-height: 1.5;
}

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

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

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

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 25px 0 11px;
  color: #e4e1da;
  font-weight: 600;
  letter-spacing: -0.025em;
}

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

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

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

.message-content ul,
.message-content ol {
  margin: 8px 0 17px;
  padding-left: 24px;
}

.message-content li {
  margin: 5px 0;
}

.message-content strong {
  color: #e5e2dc;
  font-weight: 650;
}

.message-content a {
  color: #c7b67d;
}

.message-content code:not(.code-block code) {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #292927;
  color: #dbd8d1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}

.code-block {
  margin: 17px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #191917;
}

.code-label {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--faint);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: lowercase;
}

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

.code-block code {
  color: #d5d2cb;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.assistant-image {
  margin: 15px 0;
}

.assistant-image img {
  display: block;
  max-width: min(100%, 720px);
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 12px;
  object-fit: contain;
}

.artifact-link {
  display: grid;
  max-width: 470px;
  min-height: 48px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #292927;
  color: #d8d5ce !important;
  text-decoration: none;
}

.artifact-link svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.artifact-link b {
  color: var(--muted);
  font-size: 11px;
}

.message-attachments,
.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-attachments {
  margin: 0 0 10px;
}

.attachment-chip {
  display: grid;
  max-width: 280px;
  min-height: 40px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #292927;
  color: #c9c6bf;
  font-size: 12px;
}

.attachment-chip > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip img,
.attachment-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  background: #1c1c1a;
  object-fit: cover;
}

.attachment-icon svg {
  width: 15px;
  height: 15px;
}

.attachment-chip button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.attachment-chip button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.attachment-chip button svg {
  width: 14px;
  height: 14px;
}

.thinking,
.work-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 25px;
  color: #8e8b85;
  font-size: 13px;
}

.thinking-ring {
  width: 13px;
  height: 13px;
  animation: spin 0.9s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: #9b9892;
  border-radius: 50%;
}

.stream-caret {
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 2px;
  animation: caret 0.85s steps(1) infinite;
  background: #a8a49d;
  vertical-align: -2px;
}

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

.empty-state {
  display: grid;
  width: min(100%, 650px);
  min-height: calc(100vh - 290px);
  align-content: center;
  justify-items: center;
  margin: 0 auto;
  text-align: center;
}

.empty-orbit {
  position: relative;
  width: 34px;
  height: 34px;
  margin-bottom: 20px;
  border: 1px solid rgba(217, 170, 53, 0.4);
  border-radius: 50%;
}

.empty-orbit::before,
.empty-orbit::after {
  position: absolute;
  inset: 6px -7px;
  border: 1px solid rgba(217, 170, 53, 0.22);
  border-radius: 50%;
  content: "";
  transform: rotate(55deg);
}

.empty-orbit::after {
  transform: rotate(-55deg);
}

.empty-orbit span {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.empty-state h1 {
  margin: 0;
  color: #dfdcd6;
  font-size: 27px;
  font-weight: 520;
  letter-spacing: -0.04em;
}

.empty-state p {
  max-width: 470px;
  margin: 10px 0 0;
  color: #85827c;
  font-size: 14px;
  line-height: 1.55;
}

.composer-dock {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 40px 26px 22px;
  background: linear-gradient(to bottom, transparent, var(--bg) 42%);
  pointer-events: none;
}

.composer-dock.dragging .composer {
  border-color: rgba(217, 170, 53, 0.62);
}

.attachment-preview,
.composer {
  width: min(100%, 920px);
  margin-right: auto;
  margin-left: auto;
  pointer-events: auto;
}

.attachment-preview {
  margin-bottom: 8px;
}

.attachment-preview:empty {
  display: none;
}

.composer {
  padding: 13px 14px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #292927;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.22);
  transition: border-color 0.15s;
}

.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 30px;
  max-height: 180px;
  padding: 2px 2px 8px;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #dedbd5;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
}

.composer textarea::placeholder {
  color: #74716c;
}

.composer-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-left,
.composer-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.permission-pill {
  display: flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid rgba(217, 170, 53, 0.16);
  border-radius: 7px;
  background: var(--accent-soft);
}

.permission-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.permission-pill select,
.compact-select select {
  height: 28px;
  max-width: 166px;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
}

.permission-pill select {
  color: #dfb849;
  font-size: 12px;
  font-weight: 570;
}

.compact-select select {
  max-width: 112px;
  padding: 0 2px;
  color: #aaa7a1;
  font-size: 12px;
}

.tool-button {
  width: 30px;
  height: 30px;
  color: #a6a39d;
}

.tool-button svg {
  width: 18px;
  height: 18px;
}

.tool-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.send-button {
  width: 31px;
  height: 31px;
  background: #dedbd3;
  color: #242421;
}

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

.send-button:disabled {
  cursor: default;
  opacity: 0.26;
}

.send-button.stop {
  background: #55524c;
  color: #f1eee7;
}

.send-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #353532;
  color: #e2dfd8;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: min(86vw, 330px);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }

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

  .sidebar-close,
  .mobile-menu {
    display: grid;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 15;
    inset: 0;
    background: rgba(0, 0, 0, 0.54);
    cursor: pointer;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .main {
    width: 100%;
  }

  .topbar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 12px;
  }

  .conversation {
    padding-right: 16px;
    padding-left: 16px;
  }

  .composer-dock {
    padding-right: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: 10px;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .topbar-meta > span {
    display: none;
  }

  .conversation {
    padding-bottom: 176px;
  }

  .messages {
    margin-top: 8px;
  }

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

  .permission-pill select {
    max-width: 110px;
  }

  .compact-select select {
    max-width: 76px;
  }

  .composer-toolbar {
    align-items: flex-end;
  }

  .composer-left,
  .composer-right {
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
