:root,
[data-theme="mint"] {
  --bg: #f0f4f2;
  --bg-soft: rgba(235, 242, 238, 0.95);
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(0, 60, 40, 0.12);
  --text: #162420;
  --text-secondary: #1e3830;
  --muted: #4a6960;
  --accent: #1e7a5a;
  --accent-2: #146048;
  --accent-soft: rgba(30, 122, 90, 0.1);
  --accent-border: rgba(30, 122, 90, 0.22);
  --danger: #b82e22;
  --danger-soft: rgba(184, 46, 34, 0.08);
  --danger-border: rgba(184, 46, 34, 0.18);
  --danger-text: #b82e22;
  --success: #1a8a4a;
  --shadow: 0 16px 40px rgba(0, 30, 20, 0.1);
  --bg-gradient: radial-gradient(circle at top left, rgba(30, 122, 90, 0.07), transparent 35%),
    radial-gradient(circle at bottom right, rgba(20, 96, 72, 0.05), transparent 35%),
    linear-gradient(180deg, #f0f4f2 0%, #e8ede9 50%, #e2e8e4 100%);
  --glow-1: rgba(30, 122, 90, 0.06);
  --glow-2: rgba(20, 96, 72, 0.04);
  --input-bg: rgba(0, 40, 25, 0.05);
  --card-hover: rgba(30, 122, 90, 0.08);
  --surface: rgba(0, 40, 25, 0.05);
  --surface-border: rgba(0, 60, 40, 0.12);
  --surface-hover: rgba(30, 122, 90, 0.07);
  --user-msg: linear-gradient(135deg, rgba(30, 122, 90, 0.18), rgba(30, 122, 90, 0.1));
  --assistant-msg: rgba(0, 40, 25, 0.05);
  --msg-border: rgba(0, 60, 40, 0.1);
  --role-bg: rgba(0, 40, 25, 0.08);
  --btn-gradient: linear-gradient(135deg, #1e7a5a, #146048);
  --scrollbar: rgba(30, 122, 90, 0.22);
  --focus-ring: rgba(30, 122, 90, 0.5);
  --focus-shadow: rgba(30, 122, 90, 0.12);
  --thinking-line: rgba(30, 122, 90, 0.25);
  --thinking-glow: rgba(30, 122, 90, 0.3);
  --radius-card: 20px;
  --radius-large: 16px;
  --radius-medium: 12px;
  --radius-small: 10px;
}

[data-theme="midnight"] {
  --bg: #07111f;
  --bg-soft: rgba(14, 27, 49, 0.78);
  --card: rgba(11, 21, 38, 0.88);
  --line: rgba(148, 163, 184, 0.18);
  --text: #edf2ff;
  --text-secondary: #c9d8ff;
  --muted: #9fb0cf;
  --accent: #5b8cff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --accent-border: rgba(91, 140, 255, 0.22);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, 0.1);
  --danger-border: rgba(255, 107, 129, 0.18);
  --danger-text: #ffcad6;
  --success: #18c29c;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
  --bg-gradient: radial-gradient(circle at top left, rgba(91, 140, 255, 0.24), transparent 28%),
    radial-gradient(circle at right top, rgba(139, 92, 246, 0.18), transparent 26%),
    linear-gradient(180deg, #07111f 0%, #091628 45%, #0b1320 100%);
  --glow-1: rgba(91, 140, 255, 0.26);
  --glow-2: rgba(139, 92, 246, 0.2);
  --input-bg: rgba(255, 255, 255, 0.05);
  --card-hover: rgba(91, 140, 255, 0.12);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-hover: rgba(255, 255, 255, 0.045);
  --user-msg: linear-gradient(135deg, rgba(91, 140, 255, 0.28), rgba(91, 140, 255, 0.16));
  --assistant-msg: rgba(255, 255, 255, 0.055);
  --msg-border: rgba(255, 255, 255, 0.07);
  --role-bg: rgba(255, 255, 255, 0.08);
  --btn-gradient: linear-gradient(135deg, #5b8cff, #8b5cf6);
  --scrollbar: rgba(91, 140, 255, 0.25);
  --focus-ring: rgba(91, 140, 255, 0.75);
  --focus-shadow: rgba(91, 140, 255, 0.12);
  --thinking-line: rgba(91, 140, 255, 0.3);
  --thinking-glow: rgba(91, 140, 255, 0.35);
}

[data-theme="clay"] {
  --bg: #1a1714;
  --bg-soft: rgba(32, 28, 22, 0.82);
  --card: rgba(28, 24, 19, 0.92);
  --line: rgba(160, 140, 110, 0.2);
  --text: #f0e8dc;
  --text-secondary: #ddd0c0;
  --muted: #b8a890;
  --accent: #c8956c;
  --accent-2: #a67c52;
  --accent-soft: rgba(200, 149, 108, 0.12);
  --accent-border: rgba(200, 149, 108, 0.22);
  --danger: #d4645a;
  --danger-soft: rgba(212, 100, 90, 0.1);
  --danger-border: rgba(212, 100, 90, 0.18);
  --danger-text: #f0b0a8;
  --success: #7ab07a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --bg-gradient: radial-gradient(circle at top left, rgba(200, 149, 108, 0.15), transparent 30%),
    radial-gradient(circle at bottom right, rgba(166, 124, 82, 0.1), transparent 30%),
    linear-gradient(180deg, #1a1714 0%, #1e1b16 50%, #161310 100%);
  --glow-1: rgba(200, 149, 108, 0.15);
  --glow-2: rgba(166, 124, 82, 0.12);
  --input-bg: rgba(255, 245, 230, 0.05);
  --card-hover: rgba(200, 149, 108, 0.12);
  --surface: rgba(255, 245, 230, 0.04);
  --surface-border: rgba(200, 170, 130, 0.12);
  --surface-hover: rgba(200, 149, 108, 0.08);
  --user-msg: linear-gradient(135deg, rgba(200, 149, 108, 0.28), rgba(200, 149, 108, 0.14));
  --assistant-msg: rgba(255, 245, 230, 0.05);
  --msg-border: rgba(200, 170, 130, 0.1);
  --role-bg: rgba(255, 245, 230, 0.08);
  --btn-gradient: linear-gradient(135deg, #c8956c, #a67c52);
  --scrollbar: rgba(200, 149, 108, 0.25);
  --focus-ring: rgba(200, 149, 108, 0.6);
  --focus-shadow: rgba(200, 149, 108, 0.12);
  --thinking-line: rgba(200, 149, 108, 0.3);
  --thinking-glow: rgba(200, 149, 108, 0.35);
}


[data-theme="rose"] {
  --bg: #18141a;
  --bg-soft: rgba(28, 22, 32, 0.82);
  --card: rgba(24, 18, 28, 0.9);
  --line: rgba(180, 140, 160, 0.18);
  --text: #f2e8ef;
  --text-secondary: #e0ccd8;
  --muted: #b8a0b0;
  --accent: #d4718c;
  --accent-2: #a8527a;
  --accent-soft: rgba(212, 113, 140, 0.12);
  --accent-border: rgba(212, 113, 140, 0.22);
  --danger: #e05570;
  --danger-soft: rgba(224, 85, 112, 0.1);
  --danger-border: rgba(224, 85, 112, 0.18);
  --danger-text: #f0b0c0;
  --success: #60b88a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --bg-gradient: radial-gradient(circle at top right, rgba(212, 113, 140, 0.15), transparent 30%),
    radial-gradient(circle at bottom left, rgba(168, 82, 122, 0.1), transparent 30%),
    linear-gradient(180deg, #18141a 0%, #1c161e 50%, #140f16 100%);
  --glow-1: rgba(212, 113, 140, 0.15);
  --glow-2: rgba(168, 82, 122, 0.12);
  --input-bg: rgba(255, 220, 235, 0.05);
  --card-hover: rgba(212, 113, 140, 0.12);
  --surface: rgba(255, 220, 235, 0.04);
  --surface-border: rgba(180, 140, 160, 0.12);
  --surface-hover: rgba(212, 113, 140, 0.08);
  --user-msg: linear-gradient(135deg, rgba(212, 113, 140, 0.28), rgba(212, 113, 140, 0.14));
  --assistant-msg: rgba(255, 220, 235, 0.05);
  --msg-border: rgba(180, 140, 160, 0.1);
  --role-bg: rgba(255, 220, 235, 0.08);
  --btn-gradient: linear-gradient(135deg, #d4718c, #a8527a);
  --scrollbar: rgba(212, 113, 140, 0.25);
  --focus-ring: rgba(212, 113, 140, 0.6);
  --focus-shadow: rgba(212, 113, 140, 0.12);
  --thinking-line: rgba(212, 113, 140, 0.3);
  --thinking-glow: rgba(212, 113, 140, 0.35);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

*::-webkit-scrollbar {
  width: 5px;
}

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

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar);
  opacity: 0.7;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
}

body {
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

body.app-body {
  overflow: hidden;
  height: 100vh;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.45;
}

body::before {
  width: 320px;
  height: 320px;
  top: 40px;
  left: -40px;
  background: var(--glow-1);
}

body::after {
  width: 360px;
  height: 360px;
  right: -80px;
  bottom: 10vh;
  background: var(--glow-2);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card-hover);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.login-shell,
.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: center;
}

.login-hero {
  padding: 24px 8px;
}

.login-hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.06;
}

.login-hero p {
  max-width: 620px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--muted);
}

.hero-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero-card {
  padding: 18px;
  border-radius: var(--radius-large);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-card strong {
  font-size: 16px;
}

.hero-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-card {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -120px auto auto -120px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-1), transparent 70%);
}

.logo-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-medium);
  background: var(--btn-gradient);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 18px;
  color: white;
  box-shadow: 0 18px 38px var(--focus-shadow);
}

.login-card h2,
.chat-header h2,
.sidebar h1 {
  margin: 0;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  border-radius: var(--radius-medium);
  outline: none;
  padding: 14px 16px;
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-shadow);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: var(--radius-small);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  color: white;
  background: var(--btn-gradient);
}

.secondary-btn {
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.secondary-btn:disabled,
.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ghost-btn {
  color: var(--danger-text);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
}

.error-text {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.login-tips {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.login-tips > div {
  padding: 14px 16px;
  border-radius: var(--radius-medium);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  display: grid;
  gap: 6px;
}

.login-tips strong {
  font-size: 14px;
}

.login-tips span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.hero-preview {
  margin-top: 28px;
  padding: 16px;
}

.preview-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.preview-dot.red { background: #ff6b81; }
.preview-dot.yellow { background: #ffd166; }
.preview-dot.green { background: #18c29c; }

.preview-path {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.preview-content {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
}

.preview-side {
  display: grid;
  gap: 10px;
}

.preview-pill {
  padding: 12px 14px;
  border-radius: var(--radius-medium);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-size: 13px;
}

.preview-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.preview-main {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 14px 16px;
  border-radius: var(--radius-medium);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  display: grid;
  gap: 8px;
}

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

.preview-chat {
  padding: 14px 16px;
  border-radius: var(--radius-large);
  line-height: 1.75;
  font-size: 14px;
}

.preview-chat.user {
  margin-left: auto;
  max-width: 78%;
  background: var(--card-hover);
}

.preview-chat.assistant {
  max-width: 88%;
  background: var(--surface);
}

.app-shell {
  height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

.sidebar,
.chat-panel {
  padding: 20px;
  overflow: hidden;
}

.sidebar-top {
  display: grid;
  gap: 12px;
}

.sidebar-info-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.sidebar-banner {
  padding: 18px;
  border-radius: var(--radius-large);
  background: var(--card-hover);
  border: 1px solid var(--accent-border);
  display: grid;
  gap: 8px;
}

.sidebar-banner-tag {
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--role-bg);
  font-size: 12px;
  color: var(--text);
}

.sidebar-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar h1 {
  font-size: 20px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.sidebar-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-panel {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: min(42vh, 420px);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.small {
  font-size: 12px;
}

.prompt-grid {
  display: grid;
  gap: 6px;
}

.prompt-card {
  text-align: left;
  padding: 9px 34px 9px 12px;
  border-radius: var(--radius-small);
  border: 1px solid var(--surface-border);
  background: var(--surface-hover);
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.prompt-card:hover,
.shortcut-chip:hover {
  border-color: var(--accent-border);
  background: var(--card-hover);
}

.prompt-card {
  position: relative;
}

.prompt-delete {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  padding: 0;
  border: none;
  cursor: pointer;
}

.prompt-card:hover .prompt-delete {
  display: block;
}

.prompt-delete:hover {
  background: var(--danger-border);
}

.icon-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

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

.modal-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 420px;
  width: 90vw;
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body h3 {
  margin: 0;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.kbd-hint {
  display: none;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 4px 0;
}

@media (hover: hover) {
  .kbd-hint {
    display: block;
  }
}

.info-item {
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.info-item-model {
  grid-column: 1 / -1;
}

.info-item.compact strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-item-model strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.info-item span {
  font-size: 11px;
  color: var(--muted);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  position: relative;
  min-width: 0;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.request-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--muted);
  font-size: 12px;
}

.request-pill.busy {
  color: var(--text-secondary);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.composer-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shortcut-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 12px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  background: rgba(26, 138, 74, 0.1);
  border: 1px solid rgba(26, 138, 74, 0.2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(24, 194, 156, 0.12);
}

.chat-log {
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
  scrollbar-gutter: stable;
}

.chat-log > * {
  min-width: 0;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 460px;
  line-height: 1.8;
}

.message {
  max-width: min(78%, 860px);
  padding: 16px 18px;
  border-radius: var(--radius-large);
  white-space: pre-wrap;
  line-height: 1.72;
  border: 1px solid var(--msg-border);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.ephemeral {
  opacity: 0.85;
}

.message.user {
  align-self: flex-end;
  background: var(--user-msg);
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant-msg);
}

.message.system {
  align-self: center;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.message.system.thinking {
  background: none;
  border: none;
  padding: 8px 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.message.system.thinking::before,
.message.system.thinking::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--thinking-line), transparent);
}

.thinking-text {
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  animation: thinking-pulse 1.8s ease-in-out infinite;
}

.thinking-text::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--thinking-glow), transparent);
  animation: thinking-shimmer 2.2s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes thinking-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.message-meta,
.message-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-meta {
  margin-bottom: 10px;
}

.message-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.message-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--role-bg);
  font-size: 12px;
  font-weight: 700;
}

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

.message-body {
  white-space: pre-wrap;
  line-height: 1.8;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-action {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
  font-size: 12px;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--surface-border);
  min-width: 0;
}

.chat-form textarea {
  min-height: 52px;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  min-width: 0;
}

.input-row textarea {
  flex: 1;
  min-width: 0;
}

.upload-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-small);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.upload-btn:hover {
  background: var(--card-hover);
  color: var(--accent);
}

.image-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.image-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-small);
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.image-preview-item .img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  border: none;
  cursor: pointer;
  padding: 0;
  display: none;
}

.image-preview-item:hover .img-remove {
  display: block;
}

.image-preview-status {
  position: absolute;
  inset: auto 4px 4px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 4px 6px;
  text-align: center;
}

.message-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  max-width: 100%;
}

.message-images img {
  max-width: 180px;
  max-height: 120px;
  border-radius: var(--radius-small);
  object-fit: cover;
  cursor: zoom-in;
}

.message-images img:hover {
  opacity: 0.85;
}

.lightbox-dialog {
  border: none;
  background: transparent;
  padding: 0;
  width: min(96vw, 1200px);
  max-width: none;
}

.lightbox-dialog::backdrop {
  background: rgba(6, 15, 12, 0.82);
  backdrop-filter: blur(8px);
}

.lightbox-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-shell img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-large);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.46);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.theme-picker {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: max-content;
  overflow: visible;
}

.theme-picker-label {
  font-size: 11px;
  color: var(--muted);
  margin-right: 2px;
}

.theme-dot {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-top > .panel-title-row {
  flex-wrap: wrap;
  row-gap: 10px;
}

.sidebar-top > .panel-title-row .theme-picker {
  margin-left: auto;
}

.theme-dot:hover {
  transform: scale(1.15);
}

.theme-dot.active {
  border-color: var(--text);
}

.theme-dot[data-theme="midnight"] { background: linear-gradient(135deg, #5b8cff, #8b5cf6); }
.theme-dot[data-theme="clay"] { background: linear-gradient(135deg, #c8956c, #a67c52); }
.theme-dot[data-theme="mint"] { background: linear-gradient(135deg, #1e7a5a, #146048); }
.theme-dot[data-theme="rose"] { background: linear-gradient(135deg, #d4718c, #a8527a); }

@media (max-width: 980px) {
  body {
    padding: 16px;
  }

  body.app-body {
    overflow: auto;
    height: auto;
  }

  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

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

  .preview-content,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 75vh;
  }

  .composer-shortcuts {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .message {
    max-width: 100%;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-info-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
