:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --line: #e6edf6;
  --line-strong: #d9e3ef;
  --text: #0f172a;
  --muted: #64748b;
  --muted-light: #8ea0b8;
  --brand: #2f7bff;
  --brand-strong: #1d5fe8;
  --shadow: 0 18px 45px rgba(30, 58, 138, 0.09);
  --radius: 8px;
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    "Noto Sans SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
}

body.is-dark {
  color-scheme: dark;
  --bg: #0f141b;
  --panel: #171e27;
  --panel-soft: #111923;
  --line: #253244;
  --line-strong: #35445b;
  --text: #e8eef8;
  --muted: #9aa7bb;
  --muted-light: #7e8da4;
  --brand: #6aa2ff;
  --brand-strong: #8cb7ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

svg {
  display: block;
  width: 1em;
  height: 1em;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 282px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  transform: translateX(-100%);
  transition: transform 180ms ease;
  backdrop-filter: blur(18px);
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sidebar-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.sidebar-tab.is-active {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 72vh;
  color: var(--muted-light);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #91a3bb;
  background: var(--panel-soft);
}

.empty-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.main-area {
  width: 100%;
  min-width: 0;
  padding-bottom: 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 520px) minmax(320px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 93%, transparent);
  backdrop-filter: blur(18px);
}

.brand-cluster,
.top-actions {
  display: flex;
  align-items: center;
}

.brand-cluster {
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #2168f3;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

body.is-dark .brand {
  color: #8cb7ff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: currentColor;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  color: #607086;
  background: transparent;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.icon-button:hover {
  color: var(--brand);
  background: var(--panel-soft);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-soft);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.search:focus-within {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent);
}

.search-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-left: 18px;
  color: #8aa0bb;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  outline: 0;
  padding: 0 10px;
}

.search input::placeholder {
  color: #8b9ab0;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #8aa0bb;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  font-size: 12px;
  font-family: inherit;
}

.top-actions {
  justify-content: flex-end;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.top-actions a {
  transition: color 160ms ease;
}

.top-actions a:hover {
  color: var(--brand);
}

.trial-badge {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #246dff, #7b45ff);
  box-shadow: 0 12px 26px rgba(47, 123, 255, 0.22);
  font-weight: 800;
  cursor: pointer;
}

.mobile-search-wrap {
  display: none;
  padding: 14px 16px 0;
}

.content {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 38px 24px 48px;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 52px;
}

.workflow-card {
  position: relative;
  min-height: 146px;
  overflow: hidden;
  border-radius: var(--radius);
  color: #fff;
  isolation: isolate;
  box-shadow: 0 12px 30px rgba(26, 76, 172, 0.12);
}

.workflow-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.94;
}

.workflow-card::after {
  content: "";
  position: absolute;
  inset: -45% -20% auto auto;
  z-index: -1;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}

.card-blue::before {
  background: linear-gradient(135deg, #2f75ef, #5a9fff);
}

.card-green::before {
  background: linear-gradient(135deg, #20ae61, #4bd67f);
}

.card-orange::before {
  background: linear-gradient(135deg, #f26a17, #ff8b36);
}

.card-purple::before {
  background: linear-gradient(135deg, #7b45ec, #a77cf4);
}

.custom-card {
  grid-column: 1 / 2;
}

.workflow-card-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 146px;
  padding: 24px 24px 22px;
}

.workflow-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0;
}

.workflow-card h2 svg {
  width: 18px;
  height: 18px;
  fill: rgba(255, 255, 255, 0.95);
  stroke: none;
}

.workflow-card p {
  margin: 14px 0 14px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 600;
}

.workflow-card button {
  min-width: 88px;
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.workflow-card button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.26);
}

.workflow-card button:focus-visible,
.tool-card:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.route-close:focus-visible {
  outline: 3px solid rgba(47, 123, 255, 0.28);
  outline-offset: 3px;
}

.assistant-panel {
  margin-bottom: 36px;
}

.greeting {
  margin-bottom: 36px;
}

.greeting p,
.greeting h1 {
  margin: 0;
  letter-spacing: 0;
}

.greeting p {
  color: #4d91fa;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.18;
  font-weight: 900;
}

.greeting h1 {
  margin-top: 2px;
  color: var(--text);
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.18;
  font-weight: 900;
}

.composer {
  min-height: 214px;
  padding: 26px 26px 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
  line-height: 1.65;
}

.composer textarea::placeholder {
  color: #8a9bb2;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.attach-button,
.select-pill,
.round-button,
.send-button {
  border: 1px solid var(--line);
  cursor: pointer;
}

.attach-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  color: #20304a;
  background: var(--panel-soft);
  font-weight: 800;
}

body.is-dark .attach-button {
  color: var(--text);
}

.attach-button svg {
  width: 18px;
  height: 18px;
}

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

.select-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  border-radius: 999px;
  background: #eef3ff;
}

body.is-dark .select-pill {
  background: #1c2635;
}

.select-pill select {
  min-width: 150px;
  height: 100%;
  appearance: none;
  border: 0;
  outline: 0;
  color: #263550;
  background: transparent;
  padding: 0 38px 0 16px;
  font-weight: 800;
  cursor: pointer;
}

body.is-dark .select-pill select {
  color: var(--text);
}

.select-pill::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #8a9bb2;
  border-bottom: 2px solid #8a9bb2;
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.round-button,
.send-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.round-button {
  color: #60738f;
  background: #edf2f8;
}

body.is-dark .round-button {
  background: #202b3a;
}

.send-button {
  border-color: transparent;
  color: #fff;
  background: #a9b8ca;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
  background: var(--brand);
}

.round-button svg,
.send-button svg {
  width: 22px;
  height: 22px;
}

.tool-section {
  margin-top: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-title svg {
  width: 20px;
  height: 20px;
  color: #16223a;
}

body.is-dark .section-title svg {
  color: var(--text);
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 900;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tool-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  min-height: 128px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(30, 58, 138, 0.04);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.tool-card:hover {
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
  box-shadow: 0 16px 32px rgba(30, 58, 138, 0.09);
  transform: translateY(-2px);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.tool-icon svg {
  width: 24px;
  height: 24px;
}

.tool-icon.mint {
  color: #0f8c83;
  background: #dff8f2;
}

.tool-icon.pink {
  color: #f0346b;
  background: #ffe7ef;
}

.tool-icon.green {
  color: #21a85d;
  background: #e5f9eb;
}

.tool-icon.blue {
  color: #2f7bff;
  background: #e6efff;
}

.tool-icon.orange {
  color: #f06d21;
  background: #fff0df;
}

.tool-icon.violet {
  color: #7b45ec;
  background: #f0e9ff;
}

.tool-card h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 900;
}

.tool-card h3 span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  color: #18a85b;
  background: #dcfce8;
  font-size: 12px;
  font-weight: 800;
}

.tool-card p {
  display: -webkit-box;
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  height: 62px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(16px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.bottom-nav svg {
  width: 20px;
  height: 20px;
}

.bottom-nav a.is-active,
.bottom-nav a:hover {
  color: var(--brand);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.route-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.route-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.route-dialog {
  position: relative;
  width: min(520px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.route-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--panel-soft);
  cursor: pointer;
}

.route-close svg {
  width: 18px;
  height: 18px;
}

.route-kicker {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--brand-strong);
  background: rgba(47, 123, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
}

.route-dialog h2 {
  margin: 0 38px 10px 0;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.2;
  letter-spacing: 0;
}

.route-dialog p[data-modal-description] {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.route-meta {
  margin-top: 16px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
}

.route-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius);
  cursor: pointer;
}

.secondary-action {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
}

.primary-action {
  border: 1px solid var(--brand);
  color: #fff;
  background: var(--brand);
}

.primary-action:hover {
  background: var(--brand-strong);
}

@media (min-width: 1420px) {
  .topbar {
    padding-inline: 48px;
  }

  .content {
    padding-top: 38px;
  }
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: minmax(200px, 1fr) minmax(280px, 440px) auto;
    padding-inline: 20px;
  }

  .top-actions {
    gap: 12px;
  }

  .top-actions a {
    display: none;
  }

  .workflow-grid,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    min-height: 58px;
    gap: 12px;
    padding-inline: 14px;
  }

  .topbar > .search {
    display: none;
  }

  .mobile-search-wrap {
    display: block;
  }

  .top-actions {
    gap: 8px;
  }

  .top-actions .icon-button {
    display: none;
  }

  .trial-badge {
    width: 36px;
    height: 36px;
  }

  .brand {
    font-size: 16px;
  }

  .content {
    padding: 22px 16px 84px;
  }

  .workflow-grid,
  .tool-grid,
  .tool-grid.compact {
    grid-template-columns: 1fr;
  }

  .workflow-grid {
    margin-bottom: 36px;
  }

  .custom-card {
    grid-column: auto;
  }

  .greeting {
    margin-bottom: 24px;
  }

  .composer {
    min-height: 240px;
    padding: 20px 18px 16px;
    border-radius: 22px;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 48px 48px;
    gap: 8px;
  }

  .select-pill select {
    min-width: 0;
    width: 100%;
    padding-left: 12px;
    padding-right: 28px;
    font-size: 13px;
  }

  .select-pill::after {
    right: 12px;
  }

  .round-button,
  .send-button {
    width: 48px;
    height: 48px;
  }

  .tool-card {
    min-height: 118px;
  }

  .bottom-nav {
    display: grid;
  }

  .toast {
    right: 16px;
    bottom: 78px;
  }
}

@media (max-width: 420px) {
  .brand span:last-child {
    max-width: 144px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-card-inner {
    padding: 20px;
  }

  .composer-controls {
    grid-template-columns: 1fr 48px 48px;
  }

  .composer-controls .select-pill:nth-child(2) {
    grid-column: 1 / -1;
    order: -1;
  }
}
