/* GOracle chat — SCION (NL Query) design language, light theme, polished. */

:root {
  --go-purple: #4b2d7f;
  --go-violet: #6b3fa0;
  --go-teal: #2aabb3;
  --go-coral: #e8734a;
  --go-magenta: #c74b8b;
  --go-blue: #0098fc;
  --go-purple-light: #f3eefa;
  --go-bg: #f7f8fc;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --card-border: rgba(75, 45, 127, 0.07);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 24px rgba(75, 45, 127, 0.07);
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --glass: rgba(255, 255, 255, 0.92);
  --header-bg: rgba(255, 255, 255, 0.78);
  --btn-bg: rgba(255, 255, 255, 0.85);
  --btn-border: #d8dde5;
  --input-border: #dbe3ec;
  --placeholder: #b0b8c4;
  --kbd-bg: #f1f4f8;
  --badge-bg: #f3f4f6;
  --spectrum: linear-gradient(90deg, var(--go-teal), var(--go-blue), var(--go-purple), var(--go-magenta), var(--go-coral), var(--go-teal));
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", "Inter", -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  height: 100vh;
  background:
    radial-gradient(ellipse 70% 45% at 12% -4%, rgba(42, 171, 179, 0.14), transparent 60%),
    radial-gradient(ellipse 60% 40% at 92% -6%, rgba(146, 37, 200, 0.09), transparent 60%),
    radial-gradient(ellipse 50% 35% at 55% 108%, rgba(232, 115, 74, 0.07), transparent 60%),
    linear-gradient(180deg, #fcfdff 0%, #f6f8fc 100%);
  background-attachment: fixed;
}

::selection { background: rgba(107, 63, 160, 0.18); }

.hidden { display: none !important; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* --- scrollbar --- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(75, 45, 127, 0.14);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgba(75, 45, 127, 0.28); }

/* --- sign-in --- */
.signin { height: 100vh; display: flex; align-items: center; justify-content: center; }
.signin-card {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03), 0 24px 64px rgba(75, 45, 127, 0.13);
  padding: 2.8rem 3.4rem;
  text-align: center;
  max-width: 26rem;
  animation: riseIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.signin-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--spectrum);
  background-size: 300% 100%;
  animation: spectrumFlow 8s linear infinite;
}
.signin-mark { width: 92px; height: 92px; margin-bottom: 0.4rem; }
.signin-card h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.signin-card p { color: var(--muted); margin: 0.8rem 0 1.6rem; line-height: 1.5; font-size: 0.9rem; }
#gis-button { display: flex; justify-content: center; }

/* --- header: glass + animated spectrum hairline --- */
header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 62px;
  padding: 0 1.5rem;
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(75, 45, 127, 0.08);
  box-shadow: 0 1px 12px rgba(75, 45, 127, 0.05);
  z-index: 5;
}
header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--spectrum);
  background-size: 300% 100%;
  animation: spectrumFlow 8s linear infinite;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img {
  width: 34px; height: 28px; object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.brand:hover img { transform: rotate(-12deg) scale(1.12); }

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--go-purple);
}
h1 span { color: var(--text); font-weight: 700; }

.tagline { margin: 0; color: var(--muted); font-size: 0.83rem; flex: 1; }
.header-links { display: flex; align-items: center; gap: 0.9rem; font-size: 0.83rem; }
.header-links a {
  color: var(--go-violet);
  text-decoration: none;
  font-weight: 600;
  padding: 0.32rem 0.8rem;
  border-radius: 99px;
  border: 1.5px solid rgba(107, 63, 160, 0.25);
  transition: all 0.2s ease;
}
.header-links a:hover {
  background: var(--go-purple-light);
  border-color: var(--go-violet);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(75, 45, 127, 0.14);
}
#who-email { color: var(--faint); }
#logout, #theme-toggle {
  background: transparent;
  border: 1.5px solid var(--btn-border);
  border-radius: 99px;
  color: var(--text-2);
  cursor: pointer;
  padding: 0.32rem 0.8rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
}
#logout:hover, #theme-toggle:hover { background: white; border-color: var(--go-violet); color: var(--go-violet); }

/* --- messages --- */
main {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 56rem;
  width: 100%;
  margin: 0 auto;
}

/* welcome hero (shown until the first question) */
.welcome {
  margin: auto;
  text-align: center;
  max-width: 40rem;
  animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.welcome img {
  width: 110px; height: 110px; object-fit: contain; margin-bottom: 0.6rem;
  filter: drop-shadow(0 10px 24px rgba(75, 45, 127, 0.35));
  animation: floaty 5s ease-in-out infinite;
}
.welcome h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 0.5rem;
  background: linear-gradient(100deg, var(--go-purple) 10%, var(--go-violet) 45%, var(--go-teal) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome p { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.6rem; line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
/* --- drag & drop overlay --- */
#dropzone {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(75, 45, 127, 0.14);
  backdrop-filter: blur(6px);
  pointer-events: none; /* the drop event falls through to the document */
  animation: fadeInOverlay 0.15s ease;
}
.dz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.6rem 3.6rem;
  border: 2.5px dashed var(--go-violet);
  border-radius: 22px;
  background: var(--glass);
  color: var(--go-violet);
  box-shadow: 0 24px 64px rgba(75, 45, 127, 0.25);
}
.dz-inner svg { width: 44px; height: 44px; }
.dz-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--text); }
.dz-sub { font-size: 0.8rem; color: var(--muted); }
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }
:root[data-theme="dark"] #dropzone { background: rgba(146, 92, 216, 0.12); }
:root[data-theme="dark"] .dz-inner { border-color: #b490e4; color: #b490e4; }

/* --- search-history dropdown (mirrors SCION's nlq-history picker) --- */
.hist-wrap { position: relative; }
#history-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1.5px solid var(--btn-border);
  border-radius: 99px;
  color: var(--text-2);
  cursor: pointer;
  padding: 0.32rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
#history-btn svg { width: 13px; height: 13px; }
#history-btn .chev { color: var(--faint); font-size: 0.65rem; }
#history-btn:hover { border-color: var(--go-violet); color: var(--go-violet); }
#history-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: 26rem;
  max-width: 90vw;
  max-height: 26rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 18px 48px rgba(75, 45, 127, 0.18);
  animation: riseIn 0.18s ease;
}
.hist-search-row { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
#hist-filter {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
#hist-filter::placeholder { color: var(--placeholder); }
.hist-body { overflow-y: auto; flex: 1; padding: 0.25rem 0; }
.hist-row {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  font: inherit;
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.4;
}
.hist-row:hover { background: var(--go-purple-light); }
.hist-row .q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row .when { flex: none; color: var(--faint); font-size: 0.68rem; }
.hist-empty { padding: 1rem; color: var(--faint); font-size: 0.82rem; }
.cached-note {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 600;
}
.chips .chip:nth-child(1) { animation-delay: 0.25s; }
.chips .chip:nth-child(2) { animation-delay: 0.35s; }
.chips .chip:nth-child(3) { animation-delay: 0.45s; }
.chips .chip:nth-child(4) { animation-delay: 0.55s; }
.chip {
  animation: riseIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  background: var(--btn-bg);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  color: var(--text-2);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 550;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.chip:hover {
  border-color: var(--go-teal);
  color: var(--go-purple);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(42, 171, 179, 0.18);
}

/* message rows with avatars */
.row { display: flex; gap: 0.7rem; animation: riseIn 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
.row.user { flex-direction: row-reverse; }
.avatar {
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: 0.08s;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: white;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(75, 45, 127, 0.22);
}
.avatar.user { background: linear-gradient(135deg, var(--go-teal), var(--go-blue)); }
.avatar.agent {
  background: linear-gradient(135deg, var(--go-purple), var(--go-violet));
  padding: 5px;
}
.avatar.agent img { width: 100%; height: 100%; object-fit: contain; filter: brightness(0) invert(1); }

.msg { line-height: 1.62; white-space: pre-wrap; font-size: 0.95rem; min-width: 0; }
.msg.user {
  background: linear-gradient(135deg, #efe8f9 0%, #e9f6f7 130%);
  border: 1px solid rgba(75, 45, 127, 0.08);
  color: var(--text);
  border-radius: 16px 16px 4px 16px;
  padding: 0.8rem 1.1rem;
  max-width: 82%;
}
.msg.agent {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 4px 16px 16px 16px;
  box-shadow: var(--card-shadow);
  padding: 1.1rem 1.3rem;
  max-width: 100%;
}
.msg.agent strong { color: var(--go-purple); font-weight: 750; }
.msg.agent a { color: var(--go-violet); word-break: break-all; }
.msg.error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 12px; padding: 0.8rem 1.1rem; }

/* thinking / loader */
.msg.agent.thinking {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.msg.agent.thinking img { width: 42px; height: 34px; object-fit: contain; }
.msg.agent.thinking .status { transition: opacity 0.3s ease; }
.dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--go-violet);
  animation: bounce 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; background: var(--go-teal); }
.dots i:nth-child(3) { animation-delay: 0.3s; background: var(--go-coral); }

/* --- source cards --- */
.sources { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.source-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.8rem;
  max-width: 100%;
  transition: all 0.2s ease;
}
.source-card:hover {
  border-color: var(--go-violet);
  background: var(--panel);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(75, 45, 127, 0.14);
}
.card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24rem; }
.badge {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.14rem 0.5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--badge-bg);
  color: var(--muted);
}
.badge:empty { display: none; }
.badge.source.src-jira { background: #dbeafe; color: #1d4ed8; }
.badge.source.src-zendesk { background: #d1fae5; color: #059669; }
.badge.source.src-confluence { background: var(--go-purple-light); color: var(--go-purple); }
.badge.source.src-code { background: #fef3c7; color: #d97706; }

/* --- rendered markdown inside agent messages --- */
.msg.agent { white-space: normal; }
.md { line-height: 1.62; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-display);
  color: var(--go-purple);
  margin: 1.1em 0 0.4em;
  line-height: 1.3;
}
.md h1 { font-size: 1.15rem; }
.md h2 { font-size: 1.05rem; }
.md h3, .md h4 { font-size: 0.95rem; }
.md p { margin: 0.55em 0; }
.md ul, .md ol { margin: 0.5em 0; padding-left: 1.4em; }
.md li { margin: 0.25em 0; }
.md li > ul, .md li > ol { margin: 0.15em 0; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84em;
  background: var(--kbd-bg);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}
.md pre {
  background: var(--kbd-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  margin: 0.7em 0;
}
.md pre code { background: none; padding: 0; font-size: 0.82rem; }
.md blockquote {
  margin: 0.6em 0;
  padding: 0.2em 0 0.2em 0.9em;
  border-left: 3px solid var(--go-teal);
  color: var(--muted);
}
.md hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.md table { border-collapse: collapse; margin: 0.7em 0; font-size: 0.85rem; }
.md th, .md td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; text-align: left; }
.md th { background: var(--kbd-bg); font-weight: 700; }
:root[data-theme="dark"] .md h1,
:root[data-theme="dark"] .md h2,
:root[data-theme="dark"] .md h3,
:root[data-theme="dark"] .md h4 { color: #c9a8f0; }

/* --- feedback --- */
.fb { margin-top: 0.8rem; display: flex; gap: 0.4rem; align-items: center; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 99px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.7rem;
  transition: all 0.2s ease;
}
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn:hover { transform: translateY(-1px); border-color: var(--go-violet); color: var(--go-violet); }
.fb button {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 99px;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  transition: all 0.2s ease;
}
.fb button:hover { transform: translateY(-1px) scale(1.08); border-color: var(--go-violet); }
.fb button.chosen.up { color: #059669; border-color: #059669; background: #f0fdf4; }
.fb button.chosen.down { color: #b91c1c; border-color: #b91c1c; background: #fef2f2; }

/* --- composer: floating glass bar --- */
#composer {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  padding: 0.9rem 1.4rem 1.3rem;
  max-width: 56rem;
  width: 100%;
  margin: 0 auto;
}
.input-wrap {
  flex: 1;
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--input-border);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(75, 45, 127, 0.07);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.input-wrap:focus-within {
  border-color: var(--go-teal);
  box-shadow: 0 0 0 4px rgba(42, 171, 179, 0.13), 0 6px 24px rgba(75, 45, 127, 0.10);
}
#input {
  resize: none;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.85rem 1rem 0.4rem;
  font: inherit;
  font-size: 0.95rem;
  max-height: 14rem;
  overflow-y: auto;
}
#input::placeholder { color: var(--placeholder); }
#input:focus { outline: none; }
.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.6rem 0.4rem 1rem;
}
.input-hint {
  color: #c2c9d4;
  font-size: 0.68rem;
  user-select: none;
}
#attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--faint);
  cursor: pointer;
  transition: all 0.2s ease;
}
#attach:hover { color: var(--go-violet); background: var(--go-purple-light); transform: translateY(-1px); }
#attach svg { width: 16px; height: 16px; }
.previews {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem 0;
}
.previews .thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.previews .thumb img { width: 100%; height: 100%; object-fit: cover; }
.previews .thumb button {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(17, 24, 39, 0.75);
  color: white;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.msg.user .shots { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.msg.user .shots img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 10px;
  border: 1px solid rgba(75, 45, 127, 0.15);
  cursor: zoom-in;
}
.input-hint kbd {
  font-family: inherit;
  background: var(--kbd-bg);
  border-radius: 4px;
  padding: 0 0.3rem;
  color: var(--faint);
}
#send {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 46px;
  background: linear-gradient(135deg, var(--go-purple) 0%, var(--go-violet) 55%, #8352c2 100%);
  background-size: 150% 150%;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  padding: 0 1.4rem;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(75, 45, 127, 0.3);
  transition: all 0.25s ease;
}
#send:hover {
  transform: translateY(-2px);
  background-position: 100% 100%;
  box-shadow: 0 8px 24px rgba(75, 45, 127, 0.4);
}
#send:active { transform: translateY(0); }
#send:disabled { opacity: 0.65; cursor: wait; transform: none; }
#send img { width: 28px; height: 24px; object-fit: contain; }
#send svg { width: 16px; height: 16px; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
button:focus-visible, a:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--go-teal);
  outline-offset: 2px;
}
@keyframes spectrumFlow {
  from { background-position: 0% 0; }
  to { background-position: 300% 0; }
}
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

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

/* ============================ dark mode ============================ */
:root[data-theme="dark"] {
  --go-purple-light: rgba(146, 92, 216, 0.18);
  --text: #e7e9ee;
  --text-2: #c6cbd4;
  --muted: #98a1b1;
  --faint: #687083;
  --border: #2a3040;
  --card-border: rgba(146, 92, 216, 0.16);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 28px rgba(0, 0, 0, 0.42);
  --panel: #161923;
  --panel-2: #131620;
  --glass: rgba(19, 22, 31, 0.88);
  --header-bg: rgba(14, 16, 22, 0.78);
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-border: #333a4a;
  --input-border: #2e3546;
  --placeholder: #5b6478;
  --kbd-bg: #232937;
  --badge-bg: #232937;
  color-scheme: dark;
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 70% 45% at 12% -4%, rgba(42, 171, 179, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 92% -6%, rgba(146, 37, 200, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 35% at 55% 108%, rgba(232, 115, 74, 0.05), transparent 60%),
    linear-gradient(180deg, #10121a 0%, #0d0f15 100%);
  background-attachment: fixed;
}
:root[data-theme="dark"] h1 { color: #b490e4; }
:root[data-theme="dark"] h1 span { color: #f4f6fa; }
:root[data-theme="dark"] .msg.user {
  background: linear-gradient(135deg, rgba(107, 63, 160, 0.32) 0%, rgba(42, 171, 179, 0.16) 130%);
  border-color: rgba(146, 92, 216, 0.25);
}
:root[data-theme="dark"] .msg.error {
  background: rgba(185, 28, 28, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}
:root[data-theme="dark"] .msg.agent strong { color: #c9a8f0; }
:root[data-theme="dark"] .msg.agent a { color: #b490e4; }
:root[data-theme="dark"] .welcome h2 {
  background: linear-gradient(100deg, #b490e4 10%, #9d7fd4 45%, #4cc4cc 90%);
  -webkit-background-clip: text;
  background-clip: text;
}
:root[data-theme="dark"] .badge.source.src-jira { background: rgba(29, 78, 216, 0.25); color: #93c5fd; }
:root[data-theme="dark"] .badge.source.src-zendesk { background: rgba(5, 150, 105, 0.22); color: #6ee7b7; }
:root[data-theme="dark"] .badge.source.src-confluence { background: rgba(146, 92, 216, 0.22); color: #c9a8f0; }
:root[data-theme="dark"] .badge.source.src-code { background: rgba(217, 119, 6, 0.2); color: #fcd34d; }
:root[data-theme="dark"] .fb button.chosen.up { color: #34d399; border-color: #34d399; background: rgba(5, 150, 105, 0.12); }
:root[data-theme="dark"] .fb button.chosen.down { color: #f87171; border-color: #f87171; background: rgba(185, 28, 28, 0.12); }
:root[data-theme="dark"] .header-links a { border-color: rgba(180, 144, 228, 0.35); color: #b490e4; }
:root[data-theme="dark"] #logout, :root[data-theme="dark"] #theme-toggle { color: var(--text-2); }
:root[data-theme="dark"] #logout:hover, :root[data-theme="dark"] #theme-toggle:hover { background: var(--btn-bg); color: #b490e4; border-color: #8352c2; }

/* ============================ mobile ============================ */
@media (max-width: 720px) {
  header { height: 54px; padding: 0 0.8rem; gap: 0.55rem; }
  .tagline { display: none; }           /* the wrapping word-column killer */
  #who-email { display: none; }
  .header-links { gap: 0.45rem; }
  .header-links a, #logout, #theme-toggle, #history-btn {
    padding: 0.28rem 0.6rem; font-size: 0.75rem; white-space: nowrap;
  }
  #history-btn .label { display: none; }
  #history-menu { width: min(24rem, 94vw); }
  .brand img { width: 28px; height: 28px; }
  h1 { font-size: 1.05rem; }

  main { padding: 1rem 0.8rem; }
  .welcome img { width: 82px; height: 82px; }
  .welcome h2 { font-size: 1.35rem; }
  .welcome p { font-size: 0.86rem; }
  .chip { font-size: 0.78rem; padding: 0.45rem 0.85rem; }
  .msg.user { max-width: 90%; }
  .msg { font-size: 0.9rem; }

  #composer { padding: 0.6rem 0.8rem 0.9rem; gap: 0.5rem; }
  .input-hint { display: none; }
  .input-footer { padding: 0 0.5rem 0.35rem; justify-content: flex-end; }
  #send { padding: 0 1rem; height: 42px; }
}
