/* ===== Design tokens ===== */
:root {
  --bg: #070b18;
  --bg-2: #0b1226;
  --glow-1: rgba(124, 92, 255, 0.22);
  --glow-2: rgba(34, 211, 238, 0.14);
  --panel: rgba(14, 22, 45, 0.78);
  --panel-solid: #0f1730;
  --surface: rgba(21, 31, 60, 0.88);
  --surface-2: rgba(28, 40, 74, 0.72);
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e9edfb;
  --text-soft: #b3bed9;
  --text-muted: #7f8bab;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --user-grad: linear-gradient(135deg, #6d5cff 0%, #8b5cf6 52%, #a855f7 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow-lg: 0 24px 70px -28px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 12px 34px -18px rgba(0, 0, 0, 0.65);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas,
    "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg: #eef2fb;
  --bg-2: #f7f9ff;
  --glow-1: rgba(124, 92, 255, 0.12);
  --glow-2: rgba(34, 211, 238, 0.1);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4fc;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-soft: #46536b;
  --text-muted: #6b7891;
  --shadow-lg: 0 24px 60px -30px rgba(15, 23, 42, 0.35);
  --shadow-md: 0 12px 30px -20px rgba(15, 23, 42, 0.3);
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 600px at 12% -10%, var(--glow-1), transparent 60%),
    radial-gradient(800px 500px at 105% 0%, var(--glow-2), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-2) 60%, var(--bg));
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(124, 92, 255, 0.65);
  outline-offset: 2px;
}

/* ===== Layout ===== */
.app {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  height: 100dvh;
}

/* ===== Sidebar ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 22px 16px 16px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--user-grad);
  box-shadow: 0 10px 26px -8px rgba(124, 92, 255, 0.75);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.9;
}

.brand-copy h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.brand-copy p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(124, 92, 255, 0.45);
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.22),
    rgba(34, 211, 238, 0.1)
  );
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.new-chat:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 92, 255, 0.8);
  box-shadow: 0 12px 26px -14px rgba(124, 92, 255, 0.9);
}

.new-chat svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.conv-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-label {
  padding: 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}

.conv-empty {
  margin: 0;
  padding: 10px 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 26px 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}

.conv-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.conv-item.active {
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.2),
    rgba(34, 211, 238, 0.08)
  );
  border-color: rgba(124, 92, 255, 0.32);
  color: var(--text);
}

.conv-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-del {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.conv-item:hover .conv-del,
.conv-item:focus-within .conv-del {
  opacity: 1;
}

.conv-del:hover {
  background: rgba(251, 113, 133, 0.16);
  color: var(--danger);
}

.conv-del svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.sidebar-footer {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.soft-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.soft-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Main ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(14px);
}

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

.topbar-main h2 {
  margin: 0;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: 0.1px;
}

.pill {
  padding: 3px 8px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  transition: background 0.2s, box-shadow 0.2s;
}

.status[data-mode="busy"] .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14);
  animation: pulse 1.2s ease-in-out infinite;
}

.status[data-mode="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.14);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.only-mobile {
  display: none;
}

/* ===== Messages ===== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 30px 26px 12px;
  scroll-behavior: smooth;
}

.messages-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 8px;
}

/* ===== Empty state ===== */
.empty {
  position: relative;
  max-width: 820px;
  margin: 4vh auto 0;
  padding: 24px 8px 40px;
  text-align: center;
}

.empty-glow {
  position: absolute;
  inset: -40px 10% auto;
  height: 240px;
  background: radial-gradient(
    closest-side,
    rgba(124, 92, 255, 0.28),
    transparent 72%
  );
  filter: blur(14px);
  pointer-events: none;
}

.empty-badge {
  position: relative;
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 12px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.07);
  color: var(--accent-2);
  font-size: 10.5px;
  letter-spacing: 0.24em;
}

.empty h2 {
  position: relative;
  margin: 0 auto;
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty h2 span {
  background: linear-gradient(100deg, #a78bfa, #22d3ee 55%, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.empty > p {
  position: relative;
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.suggestions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
  text-align: left;
}

.suggestion {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease,
    background 0.18s ease, box-shadow 0.18s ease;
}

.suggestion:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.42);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}

.suggestion-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 9px;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.2),
    rgba(34, 211, 238, 0.12)
  );
  color: var(--accent-2);
}

.suggestion-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggestion-title {
  font-size: 13.5px;
  font-weight: 650;
}

.suggestion-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ===== Message rows ===== */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: rise 0.28s ease both;
}

.msg.user {
  flex-direction: row-reverse;
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.msg.assistant .avatar {
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.18),
    rgba(124, 92, 255, 0.28)
  );
  color: var(--accent-2);
}

.msg.user .avatar {
  background: var(--user-grad);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(124, 92, 255, 0.8);
}

.bubble {
  max-width: min(78%, 720px);
  padding: 13px 17px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.msg.user .bubble {
  border-bottom-right-radius: 6px;
  background: var(--user-grad);
  color: #fff;
  box-shadow: 0 14px 32px -18px rgba(124, 92, 255, 0.9);
}

.msg.assistant .bubble {
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

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

/* ===== Markdown ===== */
.bubble-content > :first-child {
  margin-top: 0;
}

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

.bubble-content p {
  margin: 0 0 0.8em;
}

.bubble-content h1,
.bubble-content h2,
.bubble-content h3,
.bubble-content h4 {
  margin: 1.1em 0 0.5em;
  line-height: 1.35;
  font-weight: 650;
}

.bubble-content h1 {
  font-size: 1.35em;
}

.bubble-content h2 {
  font-size: 1.2em;
}

.bubble-content h3 {
  font-size: 1.08em;
}

.bubble-content ul,
.bubble-content ol {
  margin: 0.5em 0 0.8em;
  padding-left: 1.35em;
}

.bubble-content li {
  margin: 0.25em 0;
}

.bubble-content li > p {
  margin: 0.2em 0;
}

.bubble-content a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
}

.bubble-content strong {
  color: var(--text);
  font-weight: 650;
}

.bubble-content blockquote {
  margin: 0.7em 0;
  padding: 0.1em 0 0.1em 12px;
  border-left: 2px solid rgba(124, 92, 255, 0.6);
  color: var(--text-soft);
}

.bubble-content code {
  padding: 0.1em 0.38em;
  border: 1px solid rgba(124, 92, 255, 0.18);
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.14);
  font-family: var(--mono);
  font-size: 0.88em;
}

.bubble-content pre {
  margin: 0.8em 0;
  padding: 14px 15px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: #080d1c;
  overflow-x: auto;
}

[data-theme="light"] .bubble-content pre {
  background: #0f172a;
}

.bubble-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: #dbe4ff;
  font-size: 12.5px;
  line-height: 1.6;
}

.bubble-content table {
  width: 100%;
  margin: 0.8em 0;
  border-collapse: collapse;
  font-size: 0.92em;
}

.bubble-content th,
.bubble-content td {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  text-align: left;
}

.bubble-content th {
  background: rgba(124, 92, 255, 0.1);
  font-weight: 600;
}

.bubble-content hr {
  margin: 1em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.12em;
  border-radius: 2px;
  background: var(--accent-2);
  animation: blink 0.9s steps(2, start) infinite;
}

.tool-call {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 6px 10px 0;
  padding: 5px 11px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--accent-2);
  font-size: 12px;
  line-height: 1.4;
}
.tool-call-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1s steps(2, start) infinite;
}
.tool-call.done {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.09);
  color: var(--ok);
}
.tool-call.done .tool-call-dot {
  animation: none;
}

.msg-error {
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ===== Composer ===== */
.composer-area {
  padding: 6px 26px 16px;
}

.composer {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 14px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer:focus-within {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12), var(--shadow-lg);
}

.composer textarea {
  width: 100%;
  min-height: 28px;
  max-height: 190px;
  padding: 4px 4px 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  resize: none;
}

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

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-hint {
  padding-left: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.composer-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.send-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--user-grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(124, 92, 255, 0.9);
  transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
  filter: brightness(1.08);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stop-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
  font-size: 12.5px;
  cursor: pointer;
}

.stop-btn:hover {
  background: rgba(251, 113, 133, 0.2);
}

.disclaimer {
  max-width: 880px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 7, 18, 0.62);
  backdrop-filter: blur(8px);
  animation: fade 0.18s ease;
}

.modal {
  width: min(560px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.22s ease;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.field > span {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.field small {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.field textarea,
.field select,
.field input[type="range"] {
  width: 100%;
}

.field textarea {
  min-height: 110px;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

.field select {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.field textarea:focus,
.field select:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

.field input[type="range"] {
  accent-color: var(--accent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.primary-btn {
  padding: 10px 20px;
  border: 0;
  border-radius: 11px;
  background: var(--user-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(124, 92, 255, 0.9);
}

.primary-btn:hover {
  filter: brightness(1.07);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  max-width: min(520px, calc(100vw - 40px));
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Mobile ===== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(3, 7, 18, 0.55);
  backdrop-filter: blur(3px);
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }

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

  .only-mobile {
    display: grid;
  }

  .topbar {
    padding: 12px 16px;
  }

  .messages {
    padding: 22px 16px 10px;
  }

  .composer-area {
    padding: 6px 14px 14px;
  }

  .topbar-main h2 {
    max-width: 40vw;
  }

  .status {
    font-size: 11px;
  }

  .suggestions {
    grid-template-columns: 1fr;
    margin-top: 26px;
  }

  .bubble {
    max-width: 86%;
  }

  .empty {
    margin-top: 2vh;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .status #statusText {
    display: none;
  }

  .pill {
    display: none;
  }

  .composer-hint {
    display: none;
  }

  .empty h2 {
    font-size: 26px;
  }
}

/* ===== Scrollbars & motion ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.22);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.35);
}

::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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