:root {
  color-scheme: light;
  --font-sans: "SF Pro Display", "SF Pro Text", "PingFang SC", "Noto Sans SC", sans-serif;
  --bg: #f5f7fb;
  --bg-accent: rgba(77, 111, 255, 0.18);
  --bg-warm: rgba(255, 205, 154, 0.22);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-soft: rgba(247, 248, 252, 0.82);
  --assistant-bubble: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 248, 252, 0.94));
  --user-bubble: linear-gradient(180deg, #111827, #1f2937);
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.14);
  --text: #111827;
  --muted: #667085;
  --subtle: #8c96a8;
  --accent: #2d5bff;
  --accent-strong: #1f46d6;
  --accent-soft: rgba(45, 91, 255, 0.1);
  --success: #198754;
  --shadow-lg: 0 24px 80px rgba(16, 24, 40, 0.12);
  --shadow-md: 0 14px 36px rgba(16, 24, 40, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b14;
  --bg-accent: rgba(82, 115, 255, 0.22);
  --bg-warm: rgba(255, 176, 84, 0.16);
  --surface: rgba(12, 16, 28, 0.72);
  --surface-strong: rgba(11, 14, 24, 0.88);
  --surface-soft: rgba(18, 24, 39, 0.9);
  --assistant-bubble: linear-gradient(180deg, rgba(17, 22, 35, 0.96), rgba(11, 15, 25, 0.94));
  --user-bubble: linear-gradient(180deg, #4a6cff, #3553d7);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7ff;
  --muted: #a9b3c9;
  --subtle: #7f8aa5;
  --accent: #8ea5ff;
  --accent-strong: #dbe4ff;
  --accent-soft: rgba(142, 165, 255, 0.16);
  --success: #67d8a5;
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.46);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-accent), transparent 26%),
    radial-gradient(circle at top right, var(--bg-warm), transparent 24%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 54%, #eef2f8 100%);
  transition: background 220ms ease, color 220ms ease;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, var(--bg-accent), transparent 28%),
    radial-gradient(circle at top right, var(--bg-warm), transparent 22%),
    linear-gradient(180deg, #0c1020 0%, var(--bg) 56%, #060811 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 12px 14px 28px;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 6px 2px 10px;
  backdrop-filter: blur(16px);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hero-badge span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #7fc7ff);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.theme-switcher {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-md);
}

.theme-button {
  border: 0;
  border-radius: 999px;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.theme-button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.cards-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  margin: 8px 0 3px;
  max-width: none;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.chat-shell {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow-lg);
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px;
}

.assistant-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

.assistant-chip strong {
  font-size: 14px;
}

.assistant-chip p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent);
}

.assistant-avatar,
.message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.assistant-avatar {
  background: linear-gradient(135deg, #0f172a, #344054);
  color: #fff;
}

:root[data-theme="dark"] .assistant-avatar {
  background: linear-gradient(135deg, #8ea5ff, #b9c7ff);
  color: #10131c;
}

.messages {
  display: grid;
  gap: 11px;
  min-height: 48vh;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.message.user {
  justify-content: flex-end;
}

.message.user .message-avatar {
  order: 2;
  background: linear-gradient(135deg, rgba(45, 91, 255, 0.15), rgba(45, 91, 255, 0.32));
  color: var(--accent-strong);
  border: 1px solid rgba(45, 91, 255, 0.16);
}

:root[data-theme="dark"] .message.user .message-avatar {
  background: linear-gradient(135deg, rgba(142, 165, 255, 0.18), rgba(142, 165, 255, 0.32));
  color: var(--accent-strong);
  border-color: rgba(142, 165, 255, 0.18);
}

.message-bubble {
  max-width: min(100%, 680px);
  padding: 13px 13px 11px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--assistant-bubble);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.message.user .message-bubble {
  background: var(--user-bubble);
  color: #fff;
  border-color: transparent;
}

.message-role {
  margin-bottom: 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
}

.message.user .message-role {
  color: rgba(255, 255, 255, 0.78);
}

.message-content {
  display: grid;
  gap: 6px;
  line-height: 1.58;
  font-size: 14px;
}

.message-paragraph {
  margin: 0;
}

.message-paragraph a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message.user .message-content {
  gap: 0;
}

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

.brand-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.brand-card h3 {
  margin: 0;
  font-size: 15px;
}

.brand-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.brand-description {
  margin: 0;
  color: var(--text);
  line-height: 1.52;
}

.cards-page {
  max-width: 1100px;
}

.cards-hero {
  margin-bottom: 6px;
}

.category-filter {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  padding: 4px 2px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.filter-button.is-active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.directory {
  display: grid;
  gap: 10px;
}

.directory-loading {
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.directory-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.directory-summary span,
.manager-heading span {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
}

.directory-summary h2 {
  margin: 0;
  padding-top: 5px;
  font-size: 16px;
}

.directory-summary p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.manager-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.manager-main {
  display: grid;
  gap: 8px;
}

.manager-heading {
  display: grid;
  gap: 4px;
}

.manager-heading h2 {
  margin: 0;
  font-size: 16px;
}

.manager-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.manager-brand-list {
  display: grid;
  gap: 6px;
}

.manager-brand-item {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.manager-brand-item div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.manager-brand-item strong {
  color: var(--text);
  font-size: 14px;
}

.manager-brand-item span {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
}

.manager-brand-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.manager-card-preview {
  display: grid;
  align-content: end;
  gap: 6px;
  justify-items: center;
  min-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
}

.manager-card-preview img {
  width: 112px;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.card-modal[hidden] {
  display: none;
}

.card-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 28, 0.62);
  backdrop-filter: blur(12px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  max-height: 92vh;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 28px 80px rgba(8, 13, 28, 0.34);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.modal-title {
  margin: 0;
  padding-right: 40px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.modal-panel img {
  width: min(100%, 380px);
  max-height: 72vh;
  justify-self: center;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
}

.modal-tip {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

body.modal-open {
  overflow: hidden;
}

.contact-card {
  align-content: start;
  padding-top: 10px;
}

.contact-card .contact-label {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.contact-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
}

.contact-card img {
  width: min(100%, 230px);
  display: block;
  border-radius: 16px;
  margin-top: 8px;
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.quick-prompts button,
.quick-cards-link {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.quick-prompts button:hover,
.quick-cards-link:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.quick-cards-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 0;
  background:
    linear-gradient(135deg, rgba(45, 91, 255, 0.14), rgba(127, 199, 255, 0.18)),
    var(--surface-soft);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(45, 91, 255, 0.1);
}

.quick-cards-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-cards-link strong {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.quick-cards-link::after {
  content: "›";
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.typing {
  opacity: 0.92;
}

.typing-dots {
  display: inline-flex;
  gap: 6px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  animation: blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-form input {
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text);
}

.chat-form input::placeholder {
  color: var(--subtle);
}

.chat-form input:disabled,
.chat-form button:disabled {
  opacity: 0.66;
}

.chat-form button {
  min-width: 92px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(45, 91, 255, 0.22);
}

@keyframes blink {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 8px 10px 18px;
  }

  .hero-top,
  .chat-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .theme-switcher {
    align-self: flex-end;
  }

  .hero-actions {
    justify-content: flex-end;
    gap: 6px;
  }

  .cards-link {
    min-height: 40px;
    padding: 0 12px;
    font-size: 11px;
  }

  .chat-shell {
    gap: 12px;
    padding: 12px;
    border-radius: 22px;
  }

  .category-filter {
    margin-bottom: 8px;
    gap: 6px;
  }

  .filter-button {
    min-height: 32px;
    padding: 0 11px;
    font-size: 11px;
  }

  .directory-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
  }

  .directory-summary h2 {
    font-size: 15px;
  }

  .manager-section {
    grid-template-columns: minmax(0, 1fr) 92px;
    align-items: stretch;
    gap: 8px;
    padding: 9px;
    border-radius: 12px;
  }

  .manager-heading h2 {
    font-size: 15px;
  }

  .manager-brand-item {
    padding: 7px;
  }

  .manager-brand-item strong {
    font-size: 13px;
  }

  .manager-brand-item p {
    font-size: 11px;
  }

  .manager-card-preview img {
    width: 92px;
  }

  .message-bubble {
    max-width: calc(100vw - 86px);
    padding: 12px 12px 10px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 4px 2px 8px;
  }

  .hero h1 {
    margin: 7px 0 2px;
    font-size: 21px;
  }

  .hero p {
    font-size: 12px;
    line-height: 1.4;
  }

  .assistant-chip {
    padding: 10px 12px;
    border-radius: 18px;
  }

  .assistant-avatar,
  .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    font-size: 12px;
  }

  .status-pill {
    justify-content: center;
    padding: 9px 12px;
    font-size: 11px;
  }

  .messages {
    gap: 9px;
    min-height: 42vh;
  }

  .message {
    gap: 8px;
  }

  .message-content {
    gap: 6px;
    font-size: 13px;
    line-height: 1.5;
  }

  .brand-card {
    gap: 4px;
    padding: 9px;
    border-radius: 10px;
  }

  .brand-card h3 {
    font-size: 15px;
  }

  .brand-description {
    font-size: 13px;
    line-height: 1.5;
  }

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

  .contact-card img {
    width: min(100%, 210px);
  }

  .quick-prompts {
    gap: 8px;
  }

  .quick-prompts button,
  .quick-cards-link {
    padding: 8px 12px;
    font-size: 12px;
  }

  .quick-cards-link {
    width: fit-content;
    max-width: 92%;
    justify-content: space-between;
    margin-left: auto;
    order: 10;
  }

  .quick-cards-link span,
  .quick-cards-link strong {
    font-size: 12px;
  }

  .chat-form input,
  .chat-form button {
    min-height: 46px;
    border-radius: 16px;
  }

  .directory {
    gap: 12px;
  }

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

  .directory-card {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    padding: 9px;
    border-radius: 10px;
  }

  .directory-card img {
    width: 96px;
    border-radius: 9px;
  }

  .directory-copy p {
    font-size: 12px;
    line-height: 1.42;
  }
}
