:root {
  color-scheme: dark;

  --background: #06101d;
  --surface: #081728;
  --surface-strong: #0b1c30;
  --border: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #9fb0c5;
  --muted-dark: #71869f;
  --cyan: #38d9ff;
  --violet: #8b5cf6;
  --green: #4ade80;
  --amber: #fbbf24;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.42);

  /*
    Official @n8n/chat theme variables.
    These customize the package without replacing its internal layout.
  */
  --chat--color-primary: #19c8ff;
  --chat--color-primary-shade-50: #0eb8ee;
  --chat--color-primary-shade-100: #0891b2;

  --chat--color-secondary: #8b5cf6;
  --chat--color-secondary-shade-50: #7c3aed;

  --chat--color-white: #ffffff;
  --chat--color-light: #0d1e33;
  --chat--color-light-shade-50: #10253e;
  --chat--color-light-shade-100: #17314f;
  --chat--color-medium: #7f94ad;
  --chat--color-dark: #f8fafc;

  --chat--spacing: 1rem;
  --chat--border-radius: 18px;
  --chat--transition-duration: 0.2s;

  --chat--window--width: 100%;
  --chat--window--height: 100%;

  --chat--header--background: #081728;
  --chat--header--color: #ffffff;
  --chat--header--padding: 1rem;

  --chat--message--font-size: 0.96rem;

  --chat--message--bot--background: rgba(255, 255, 255, 0.055);
  --chat--message--bot--color: #eaf2ff;
  --chat--message--bot--border: 1px solid rgba(148, 163, 184, 0.18);

  --chat--message--user--background: #0eb8ee;
  --chat--message--user--color: #ffffff;
  --chat--message--user--border: none;

  --chat--message--pre--background: #050b14;

  --chat--input--background: #081728;
  --chat--input--text-color: #f8fafc;
  --chat--input--border: 1px solid rgba(148, 163, 184, 0.23);
  --chat--textarea--height: 58px;

  --chat--toggle--background: #19c8ff;
  --chat--toggle--hover--background: #0eb8ee;
  --chat--toggle--active--background: #0891b2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(
      circle at 10% 10%,
      rgba(56, 217, 255, 0.14),
      transparent 28%
    ),
    radial-gradient(
      circle at 88% 14%,
      rgba(139, 92, 246, 0.16),
      transparent 27%
    ),
    linear-gradient(145deg, #030811, #07111f 46%, #09182b);
}

button {
  color: inherit;
  font: inherit;
}

.background-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px
    );
  background-size: 34px 34px;
}

.glow {
  position: fixed;
  z-index: -2;
  width: 420px;
  aspect-ratio: 1;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.16;
  animation: float 11s ease-in-out infinite alternate;
}

.glow-one {
  top: -160px;
  left: -130px;
  background: var(--cyan);
}

.glow-two {
  right: -130px;
  bottom: -180px;
  background: var(--violet);
  animation-delay: -4s;
}

@keyframes float {
  from {
    transform: translate(-10px, -10px) scale(0.95);
  }

  to {
    transform: translate(28px, 22px) scale(1.07);
  }
}

.app-shell {
  width: min(1580px, calc(100% - 28px));
  height: calc(100dvh - 28px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: rgba(4, 12, 23, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 27px 24px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(
      180deg,
      rgba(15, 38, 65, 0.9),
      rgba(5, 16, 29, 0.98)
    ),
    radial-gradient(
      circle at top left,
      rgba(56, 217, 255, 0.15),
      transparent 34%
    );
}

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

.brand-logo,
.assistant-avatar {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(
      145deg,
      rgba(56, 217, 255, 0.2),
      rgba(139, 92, 246, 0.23)
    );
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
}

.brand-logo svg,
.assistant-avatar svg {
  width: 25px;
  height: 25px;
}

.brand-name {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.sidebar-hero {
  padding: 37px 0 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: #a6efff;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid rgba(56, 217, 255, 0.23);
  border-radius: 999px;
  background: rgba(56, 217, 255, 0.08);
}

.status-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.1);
}

.sidebar-hero h1 {
  margin: 20px 0 15px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.3rem, 3.7vw, 3.7rem);
  line-height: 0.99;
  letter-spacing: -0.055em;
}

.sidebar-hero h1 em {
  color: transparent;
  font-style: normal;
  background: linear-gradient(90deg, #85ecff, #d3c2ff);
  background-clip: text;
  -webkit-background-clip: text;
}

.sidebar-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.feature-grid article {
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
}

.feature-grid article > span {
  display: grid;
  width: 31px;
  height: 31px;
  margin-bottom: 9px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.065);
}

.feature-grid strong,
.feature-grid small {
  display: block;
}

.feature-grid strong {
  font-size: 0.8rem;
}

.feature-grid small {
  margin-top: 3px;
  color: var(--muted-dark);
  font-size: 0.68rem;
  line-height: 1.4;
}

.sidebar-disclaimer {
  margin: auto 0 0;
  padding: 12px 13px;
  color: #91a4bb;
  font-size: 0.69rem;
  line-height: 1.52;
  border: 1px solid rgba(251, 191, 36, 0.14);
  border-radius: 14px;
  background: rgba(251, 191, 36, 0.045);
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(5, 14, 25, 0.54);
}

.topbar {
  min-height: 78px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 15, 27, 0.8);
}

.assistant-details {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.assistant-avatar {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 15px;
}

.assistant-avatar::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  content: "";
  border: 2px solid #07111f;
  border-radius: 50%;
  background: var(--green);
}

.assistant-details h2 {
  margin: 0;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-details p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--green);
}

.new-chat-button,
.menu-button,
.drawer-close {
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
}

.new-chat-button {
  min-height: 40px;
  padding: 0 14px;
  color: #d9e6f5;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 12px;
}

.new-chat-button:hover,
.menu-button:hover,
.drawer-close:hover {
  border-color: rgba(56, 217, 255, 0.35);
  background: rgba(56, 217, 255, 0.09);
}

.menu-button {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.ticker-strip {
  flex: 0 0 auto;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.022);
}

.ticker-track {
  width: max-content;
  display: flex;
  gap: 10px;
  padding: 9px 0;
  animation: ticker 34s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

.ticker-track span {
  padding: 7px 11px;
  color: var(--green);
  font-size: 0.69rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.ticker-track b {
  margin-right: 7px;
  color: #dbe9f8;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

.prompt-section {
  flex: 0 0 auto;
  padding: 13px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 15, 27, 0.58);
}

.prompt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.prompt-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.prompt-heading span {
  color: var(--muted-dark);
  font-size: 0.68rem;
}

.prompt-list {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.prompt-list button {
  flex: 0 0 auto;
  padding: 10px 13px;
  color: #dbe8f7;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  transition: 0.18s ease;
}

.prompt-list button:hover {
  color: white;
  border-color: rgba(56, 217, 255, 0.4);
  background: rgba(56, 217, 255, 0.09);
  transform: translateY(-1px);
}

/*
  This is the critical layout fix:
  the official chat gets a real flex height and owns all its internal UI.
*/
.chat-host {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
}

#n8n-chat {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
}

/*
  Keep the package's normal layout.
  Only enforce dimensions on its top-level root.
*/
#n8n-chat > * {
  width: 100%;
  min-height: 0;
  height: 100%;
}

/*
  The package uses fullscreen mode inside the supplied target.
  These rules ensure its root remains inside this panel.
*/
#n8n-chat .chat-layout {
  width: 100%;
  min-height: 0;
  height: 100%;
}

/*
  Do not hide .chat-input, textarea, button, or package internals.
  The official package remains responsible for those controls.
*/

.mobile-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: min(86vw, 340px);
  padding: 22px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(4, 13, 24, 0.98);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 59;
  pointer-events: none;
  opacity: 0;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.22s ease;
}

.mobile-overlay.open {
  pointer-events: auto;
  opacity: 1;
}

.drawer-close {
  width: 40px;
  height: 40px;
  display: grid;
  margin-left: auto;
  place-items: center;
  border-radius: 12px;
}

.drawer-content {
  padding-top: 16px;
}

.drawer-content h2 {
  margin: 21px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.8rem;
  line-height: 1.08;
}

.drawer-content p {
  color: var(--muted);
  line-height: 1.65;
}

.drawer-features {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.drawer-features div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .sidebar {
    padding: 23px 18px;
  }

  .sidebar-hero h1 {
    font-size: 2.55rem;
  }

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

@media (max-width: 760px) {
  body {
    background: #05101c;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    margin: 0;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    display: none;
  }

  .menu-button {
    display: grid;
    place-items: center;
  }

  .topbar {
    min-height: 68px;
    padding: 11px 12px;
  }

  .assistant-details p {
    max-width: 190px;
  }

  .ticker-strip {
    display: none;
  }

  .prompt-section {
    padding: 11px 12px 9px;
  }

  .prompt-heading span {
    display: none;
  }
}

@media (max-width: 470px) {
  .assistant-details h2 {
    font-size: 0.87rem;
  }

  .assistant-details p {
    max-width: 145px;
    font-size: 0.66rem;
  }

  .assistant-avatar {
    width: 41px;
    height: 41px;
  }

  .new-chat-button {
    width: 40px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .new-chat-button::after {
    content: "+";
    font-size: 1.2rem;
  }

  .prompt-list button {
    padding: 9px 11px;
    font-size: 0.72rem;
  }
}

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

