/* AI workspace — full-page chat (history rail + centered thread) */
.sp-content.gm {
  padding: 0;
  max-width: none;
  width: 100%;
  height: calc(100dvh - var(--sp-topbar-h));
  min-height: 0;
  display: flex;
  background: var(--sp-bg);
}
html.sp-mini .sp-content.gm { width: 100%; max-width: none; margin: 0; align-self: stretch; }

.gm-side {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 12px 12px;
  border-right: 1px solid var(--sp-divider);
  background: var(--sp-surface);
}
.gm-new {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--sp-primary-soft);
  color: var(--sp-primary-text);
  font-weight: 600;
  font-size: .88rem;
}
.gm-new:hover { background: var(--sp-primary-soft-2); }
.gm-new iconify-icon { font-size: 1.1rem; }
.gm-find {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sp-bg);
  color: var(--sp-muted);
}
.gm-find input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sp-text);
  font-size: .82rem;
}
.gm-find input::placeholder { color: var(--sp-placeholder); }
.gm-list { flex: 1; min-height: 0; overflow: auto; margin-top: 14px; padding-right: 2px; }
.gm-group {
  margin: 14px 8px 6px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--sp-subtle);
}
.gm-group:first-child { margin-top: 4px; }
.gm-chat {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sp-text);
  padding: 8px 6px 8px 10px;
  cursor: pointer;
}
.gm-chat:hover, .gm-chat.is-on { background: var(--sp-surface-2); }
.gm-chat-t {
  flex: 1;
  min-width: 0;
  font-size: .84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gm-chat input.gm-rename {
  flex: 1;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--sp-primary);
  border-radius: 8px;
  background: var(--sp-surface);
  color: var(--sp-text);
  font-size: .84rem;
  padding: 0 8px;
  outline: 0;
}
.gm-more {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.gm-chat:hover .gm-more, .gm-chat.is-on .gm-more, .gm-more:focus-visible { opacity: 1; }
.gm-more:hover { background: var(--sp-surface-3); color: var(--sp-text); }
.gm-empty-hist { padding: 24px 12px; text-align: center; color: var(--sp-muted); font-size: .8rem; }
.gm-lib {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--sp-muted);
  font-size: .78rem;
}
.gm-lib:hover { background: var(--sp-surface-2); color: var(--sp-text); }

.gm-pop {
  position: fixed;
  z-index: 40;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  box-shadow: var(--sp-shadow-lg);
}
.gm-pop[hidden] { display: none !important; }
.gm-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-text);
  font-size: .82rem;
  text-align: left;
}
.gm-pop button:hover { background: var(--sp-surface-2); }
.gm-pop button.is-danger { color: var(--sp-danger); }

.gm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; overflow: hidden; }
.gm-main > * { position: relative; z-index: 1; }
.gm-main::after {
  content: '';
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  pointer-events: none;
  background: radial-gradient(ellipse 78% 90% at 50% 120%, rgba(96, 165, 250, .32) 0%, rgba(59, 130, 246, .14) 38%, transparent 70%);
  filter: blur(36px);
  -webkit-mask-image: linear-gradient(to top, transparent 0%, #000 34%);
  mask-image: linear-gradient(to top, transparent 0%, #000 34%);
  animation: gm-glow-hue 14s linear infinite;
}
@keyframes gm-glow-hue {
  from { filter: blur(36px) hue-rotate(0deg); }
  to { filter: blur(36px) hue-rotate(360deg); }
}
[data-bs-theme="light"] .gm-main::after { opacity: .48; }
.gm-bar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}
.gm-menu { display: none; }
.gm-model {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sp-text);
  font-weight: 600;
  font-size: .92rem;
}
.gm-model:hover, .gm-model.is-open { background: var(--sp-surface-2); }
.gm-spark {
  width: 22px;
  height: 22px;
  background: url('../../assets/img/ai-logo.svg') center / contain no-repeat;
}
.gm-model-menu {
  position: absolute;
  top: 52px;
  left: 16px;
  z-index: 5;
  width: 260px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  box-shadow: var(--sp-shadow-lg);
}
.gm-model-menu[hidden] { display: none !important; }
.gm-model-menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--sp-primary-soft);
  color: var(--sp-text);
  text-align: left;
}
.gm-model-menu b { font-size: .86rem; }
.gm-model-menu small { color: var(--sp-muted); font-size: .72rem; }

.gm-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 24px; }
.gm-hello, .gm-thread { width: min(740px, 100%); margin: 0 auto; }
.gm.is-empty .gm-scroll { display: flex; align-items: center; }
.gm-hello { text-align: center; padding-bottom: 12px; }
.gm-hello-logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  background: url('../../assets/img/ai-logo.svg') center / contain no-repeat;
}
.gm-hello h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.15;
  background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 40%, #60a5fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-bs-theme="dark"] .gm-hello h1 { background: linear-gradient(90deg, #93c5fd, #bfdbfe 50%, #60a5fa); -webkit-background-clip: text; background-clip: text; }
.gm-caret {
  display: inline-block;
  width: 3px;
  height: .82em;
  margin-left: 3px;
  border-radius: 2px;
  background: #2563eb;
  vertical-align: -1px;
  animation: gm-blink .75s steps(1) infinite;
}
[data-bs-theme="dark"] .gm-caret { background: #93c5fd; }
.gm-hello.is-typed .gm-caret { animation: none; opacity: 0; }
@keyframes gm-blink { 50% { opacity: 0; } }
.gm-hello p { margin: 10px 0 0; color: var(--sp-muted); font-size: .95rem; }
.gm-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; text-align: left; }
.gm-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px 16px;
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  background: var(--sp-surface);
  color: var(--sp-text);
  font-size: .86rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  transition: border-color .28s ease, box-shadow .28s ease, background-color .28s ease;
}
.gm-card:hover,
.gm-card:focus-visible,
.gm-card:active {
  border-color: #3b82f6;
  background: var(--sp-surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}
.gm-card iconify-icon { font-size: 1.15rem; color: var(--sp-primary); margin-top: 1px; }

.gm-thread { display: flex; flex-direction: column; gap: 22px; padding-top: 8px; }
.gm-msg { display: flex; gap: 12px; }
.gm-msg.user { justify-content: flex-end; }
.gm-msg.user .gm-bubble {
  max-width: min(520px, 86%);
  padding: 12px 16px;
  border-radius: 22px;
  background: var(--sp-surface-3);
  color: var(--sp-text);
  font-size: .95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.gm-msg.model { align-items: flex-start; }
.gm-avatar {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 2px, transparent 3px),
    conic-gradient(from 200deg, #7eb6ff, #3b82f6, #1d4ed8, #93c5fd, #7eb6ff);
}
.gm-body { min-width: 0; flex: 1; }
.gm-text { font-size: .98rem; line-height: 1.6; color: var(--sp-text); white-space: pre-wrap; }
.gm-actions { display: flex; gap: 4px; margin-top: 6px; opacity: 0; }
.gm-msg:hover .gm-actions, .gm-actions:focus-within { opacity: 1; }
.gm-actions button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gm-actions button:hover { background: var(--sp-surface-2); color: var(--sp-text); }
.gm-dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.gm-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sp-primary);
  opacity: .35;
  animation: gm-dot 1s ease-in-out infinite;
}
.gm-dots i:nth-child(2) { animation-delay: .15s; }
.gm-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes gm-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

@property --gm-shift {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}
.gm-compose { width: min(740px, calc(100% - 32px)); margin: 0 auto 10px; }
.gm-box {
  --gm-shift: 0%;
  position: relative;
  isolation: isolate;
  border: 1.5px solid var(--sp-border);
  border-radius: 28px;
  background: var(--sp-surface);
  box-shadow: 0 8px 28px -18px rgba(15, 23, 42, .45);
  padding: 10px 10px 8px 16px;
  transition: border-color .35s ease;
}
.gm-box::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -5px;
  border-radius: 33px;
  padding: 7px;
  background: linear-gradient(100deg, #4285f4, #ea4335, #fbbc05, #34a853, #4285f4);
  background-size: 300% 100%;
  background-position: var(--gm-shift) 50%;
  filter: blur(6px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.gm-box:hover,
.gm-box:focus-within,
.gm-box:active {
  border-color: transparent;
  background:
    linear-gradient(var(--sp-surface), var(--sp-surface)) padding-box,
    linear-gradient(100deg, #4285f4, #ea4335, #fbbc05, #34a853, #4285f4) border-box;
  background-size: 100% 100%, 300% 100%;
  background-position: 0 0, var(--gm-shift) 50%;
  animation: gm-google-shift 3.2s linear infinite;
}
.gm-box:hover::before,
.gm-box:focus-within::before,
.gm-box:active::before {
  opacity: .5;
}
@keyframes gm-google-shift {
  to { --gm-shift: 100%; }
}
.gm-box textarea {
  display: block;
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sp-text);
  font: 400 1rem/1.45 var(--sp-font);
  max-height: 160px;
  padding: 6px 4px 4px 0;
}
.gm-box textarea::placeholder { color: var(--sp-placeholder); }
.gm-tools { display: flex; align-items: center; gap: 4px; }
.gm-tool, .gm-send {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sp-text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gm-tool:hover { background: var(--sp-surface-2); }
.gm-tool-label { font-size: .75rem; font-weight: 600; color: var(--sp-muted); padding: 0 6px; }
.gm-tools-end { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.gm-send { background: var(--sp-surface-3); color: var(--sp-subtle); }
.gm-send.is-ready { background: var(--sp-primary); color: #fff; }
.gm-send:disabled { cursor: default; }
.gm-note { position: relative; z-index: 1; margin: 14px 0 6px; text-align: center; font-size: .72rem; color: var(--sp-subtle); }
.gm-backdrop { display: none; }

@media (max-width: 860px) {
  .gm-menu { display: inline-flex; }
  .gm-side {
    position: fixed;
    z-index: 35;
    top: var(--sp-topbar-h);
    bottom: 0;
    left: 0;
    width: min(300px, 88vw);
    transform: translateX(-105%);
    transition: transform .25s var(--sp-ease);
    box-shadow: var(--sp-shadow-lg);
  }
  .gm.is-history .gm-side { transform: none; }
  .gm.is-history .gm-backdrop { display: block; position: fixed; z-index: 34; inset: var(--sp-topbar-h) 0 0 0; background: var(--sp-overlay); }
  .gm-cards { grid-template-columns: 1fr; }
  .gm-actions { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .gm-dots i { animation: none; opacity: .7; }
  .gm-caret { animation: none; opacity: 0; }
  .gm-main::after, .gm-box { animation: none; }
}
