:root {
  color-scheme: dark;
  --bg: #212121;
  --sidebar: #111111;
  --surface: #181818;
  --panel: #2a2a2a;
  --panel-soft: #262626;
  --composer: #2f2f2f;
  --ink: #f5f5f5;
  --muted: #b7b7b7;
  --subtle: #8f8f8f;
  --line: #3c3c3c;
  --accent: #2cc6ff;
  --accent-2: #2458d6;
  --accent-dark: #114fb8;
  --warning: #f2b84b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Söhne", "Sohne", "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 400;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.chatgpt-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  padding: 12px;
  border-right: 1px solid #252525;
  background: var(--sidebar);
}

.sidebar-brand,
.mobile-topbar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 8px;
}

.sidebar-brand:hover,
.sidebar-links a:hover,
.new-chat:hover,
.prompt-grid button:hover,
.quick-actions button:hover {
  background: #2a2a2a;
}

.agent-avatar,
.agent-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #101010;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.logo-avatar,
.brand-logo-large {
  overflow: hidden;
  background: #050505;
}

.logo-avatar img,
.brand-logo-large img,
.message-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-wordmark {
  display: block;
  width: 112px;
  height: 34px;
  flex: 0 0 112px;
  object-fit: contain;
}

.sidebar-brand strong,
.sidebar-brand small,
.chat-header strong,
.chat-header span {
  display: block;
}

.sidebar-brand strong {
  overflow-wrap: anywhere;
  font-size: 0.96rem;
}

.sidebar-brand small,
.chat-header span {
  color: var(--muted);
  font-size: 0.78rem;
}

.new-chat {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1d1d1d;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.new-chat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}

.chat-sessions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.chat-session-item,
.chat-session-empty {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: #161616;
  color: var(--ink);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.94rem;
}

.chat-session-item {
  cursor: pointer;
}

.chat-session-item.active {
  background: rgba(44, 198, 255, 0.12);
  border-color: rgba(44, 198, 255, 0.25);
}

.partner-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(44, 198, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(44, 198, 255, 0.12), rgba(36, 88, 214, 0.05)),
    #1b1b1b;
}

.partner-card span {
  color: #cfcfcf;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
  text-transform: uppercase;
}

.partner-card img {
  display: block;
  width: min(168px, 100%);
  max-height: 44px;
  object-fit: contain;
  padding: 7px 9px;
  border-radius: 6px;
  background: #111111;
}

.intro-video-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f0f0f;
}

.intro-video-card video,
.intro-video-card canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 154px;
  object-fit: cover;
}

.intro-video-card video {
  position: relative;
  z-index: 2;
  background: #0f0f0f;
}

.intro-video-card canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.intro-video-card.video-missing video {
  opacity: 0;
  pointer-events: none;
}

.video-fallback {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.76);
  color: var(--ink);
  backdrop-filter: blur(8px);
}

.video-fallback span {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-links {
  display: grid;
  gap: 4px;
}

.sidebar-links a {
  padding: 11px 10px;
  border-radius: 8px;
  color: #dcdcdc;
  font-size: 0.92rem;
}

.sidebar-note {
  padding: 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #202020;
  color: var(--subtle);
  font-size: 0.78rem;
  line-height: 1.45;
}

.app-footer,
.mobile-footer {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.4;
}

.app-footer {
  margin-top: auto;
  padding: 8px 4px 2px;
}

.mobile-footer {
  display: none;
  width: min(850px, calc(100% - 36px));
  margin: -12px auto 18px;
  text-align: center;
}

.main-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 100vh;
  background: var(--sidebar);
}

.mobile-topbar {
  display: none;
}

.welcome-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(820px, 100%);
  margin: 0 auto;
  padding: min(9vh, 72px) 18px 34px;
  text-align: center;
}

.agent-logo {
  width: min(360px, 74vw);
  height: 90px;
  border-radius: 0;
  box-shadow: none;
}

.brand-logo-large {
  padding: 0;
  background: transparent;
}

.eyebrow {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: 0;
}

.welcome-partner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.welcome-partner img {
  display: block;
  width: 132px;
  height: 30px;
  object-fit: contain;
  padding: 4px 6px;
  border-radius: 999px;
  background: #111111;
}

.welcome-panel p {
  max-width: 720px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.prompt-grid button {
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #2b2b2b, #242424);
  color: #eeeeee;
  line-height: 1.25;
  text-align: left;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.prompt-grid button:hover {
  border-color: rgba(44, 198, 255, 0.55);
  background: linear-gradient(180deg, #313131, #272727);
  transform: translateY(-1px);
}

.prompt-grid strong {
  color: #ffffff;
  font-size: 0.94rem;
}

.prompt-grid span {
  color: var(--muted);
  font-size: 0.86rem;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px max(18px, calc((100% - 850px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(33, 33, 33, 0.78);
  backdrop-filter: blur(14px);
}

.agent-avatar {
  width: 48px;
  height: 38px;
  border-radius: 8px;
}

.reset-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #303030;
  color: var(--ink);
  font-size: 1.05rem;
}

.reset-button:hover {
  background: #3a3a3a;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 18px 0 24px;
  background: var(--sidebar);
}

.message {
  width: 100%;
  padding: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: min(850px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0;
}

.message.user .message-inner {
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #2cc6ff, #2458d6);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
}

.message.user .message-avatar {
  background: #3a3a3a;
  color: #d8d8d8;
  font-size: 0.68rem;
}

.message.system .message-avatar {
  background: rgba(242, 184, 75, 0.2);
  color: #f5d38d;
}

.message-content {
  position: relative;
  max-width: min(680px, 78%);
  padding: 11px 13px;
  border-radius: 16px;
  color: #f2f2f2;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.message.agent {
  border-bottom: 0;
  background: transparent;
  color: #f0f0f0;
}

.message.agent .message-content {
  border-bottom-left-radius: 5px;
  background: #2f3437;
}

.message.user {
  border-bottom: 0;
  background: transparent;
  color: #ffffff;
}

.message.user .message-content {
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #2cc6ff, #2458d6);
  color: #ffffff;
}

.message.system {
  background: transparent;
  color: #f5d38d;
  font-size: 0.92rem;
}

.message.system .message-inner {
  justify-content: center;
}

.message.system .message-avatar {
  display: none;
}

.message.system .message-content {
  max-width: min(680px, 92%);
  border: 1px solid rgba(242, 184, 75, 0.22);
  background: rgba(242, 184, 75, 0.12);
  color: #f5d38d;
  text-align: center;
}

.typing {
  color: var(--muted);
  font-weight: 650;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: auto;
  width: min(850px, calc(100% - 36px));
  margin: 8px auto 0;
  padding: 12px 0;
  border-top: 0;
  background: transparent;
}

.quick-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, #2b2b2b, #242424);
  color: #f2f2f2;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  line-height: 1;
  white-space: nowrap;
}

.quick-actions button:hover {
  background: linear-gradient(180deg, #313131, #272727);
  border-color: rgba(44, 198, 255, 0.4);
  transform: translateY(-1px);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: min(850px, calc(100% - 36px));
  margin: 0 auto;
  padding: 8px 0 22px;
  background: transparent;
}

.chat-form input {
  min-width: 0;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  outline: 0;
  background: var(--composer);
  color: var(--ink);
}

.chat-form input::placeholder {
  color: #a8a8a8;
}

.chat-form input:focus {
  border-color: rgba(44, 198, 255, 0.66);
  box-shadow: 0 0 0 3px rgba(44, 198, 255, 0.15);
}

.chat-form button {
  display: grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  align-self: center;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #101010;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
}

.chat-form button:hover {
  background: #64d8ff;
}

.lead-delivery-status {
  width: min(850px, calc(100% - 36px));
  min-height: 20px;
  margin: -12px auto 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

.lead-delivery-status.success {
  color: #8be7bc;
}

.lead-delivery-status.error {
  color: #ffb4a9;
}

.admin-preview {
  display: none;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto 32px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

body.show-admin .admin-preview {
  display: block;
}

.admin-preview h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.admin-preview p {
  color: var(--muted);
  line-height: 1.45;
}

.admin-preview button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #303030;
  color: var(--ink);
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .chatgpt-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(33, 33, 33, 0.9);
    backdrop-filter: blur(12px);
  }

  .main-chat {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .mobile-footer {
    display: block;
  }
}

@media (max-width: 720px) {
  .welcome-panel {
    width: 100%;
    padding: 28px 16px 24px;
  }

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

  .chat-shell,
  .admin-preview {
    width: 100%;
  }

  .chat-header {
    padding-inline: 14px;
  }

  .message-inner,
  .quick-actions,
  .chat-form {
    width: min(100% - 24px, 850px);
  }

  .message-inner {
    gap: 11px;
  }

  .message-content {
    max-width: min(78vw, 640px);
  }
}

@media (max-width: 520px) {
  .welcome-partner {
    flex-wrap: wrap;
    border-radius: 14px;
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .chat-form button {
    width: 44px;
  }
}
